зеркало из https://github.com/mozilla/moz-skia.git
Use asNewCustomStage instead of asABitmap in SkGpuDevice, also removed now-unecessary twoPointRadialParams parameter from asABitmap.
In SkGpuDevice we still fall back on using asABitmap for effects that don't have asNewCustomStage implemented, but it still simplifies things a fair amount. Review URL: https://codereview.appspot.com/6430060 git-svn-id: http://skia.googlecode.com/svn/trunk@4755 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
0567f222b9
Коммит
91f319c5dc
|
@ -44,8 +44,7 @@ public:
|
|||
// we return false for this, use asAGradient
|
||||
virtual BitmapType asABitmap(SkBitmap* outTexture,
|
||||
SkMatrix* outMatrix,
|
||||
TileMode xy[2],
|
||||
SkScalar* twoPointRadialParams) const SK_OVERRIDE;
|
||||
TileMode xy[2]) const SK_OVERRIDE;
|
||||
|
||||
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
about the first point.
|
||||
*/
|
||||
virtual BitmapType asABitmap(SkBitmap* outTexture, SkMatrix* outMatrix,
|
||||
TileMode xy[2], SkScalar* twoPointRadialParams) const;
|
||||
TileMode xy[2]) const;
|
||||
|
||||
/**
|
||||
* If the shader subclass can be represented as a gradient, asAGradient
|
||||
|
|
|
@ -53,8 +53,7 @@ void SkBitmapProcShader::endSession() {
|
|||
|
||||
SkShader::BitmapType SkBitmapProcShader::asABitmap(SkBitmap* texture,
|
||||
SkMatrix* texM,
|
||||
TileMode xy[],
|
||||
SkScalar* twoPointRadialParams) const {
|
||||
TileMode xy[]) const {
|
||||
if (texture) {
|
||||
*texture = fRawBitmap;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ public:
|
|||
virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count);
|
||||
virtual void beginSession();
|
||||
virtual void endSession();
|
||||
virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*,
|
||||
SkScalar* twoPointRadialParams) const;
|
||||
virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const;
|
||||
|
||||
static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty);
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ SkShader::MatrixClass SkShader::ComputeMatrixClass(const SkMatrix& mat) {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkShader::BitmapType SkShader::asABitmap(SkBitmap*, SkMatrix*,
|
||||
TileMode*, SkScalar*) const {
|
||||
TileMode*) const {
|
||||
return kNone_BitmapType;
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,7 @@ void SkColorShader::shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) {
|
|||
|
||||
// if we had a asAColor method, that would be more efficient...
|
||||
SkShader::BitmapType SkColorShader::asABitmap(SkBitmap* bitmap, SkMatrix* matrix,
|
||||
TileMode modes[],
|
||||
SkScalar* twoPointRadialParams) const {
|
||||
TileMode modes[]) const {
|
||||
return kNone_BitmapType;
|
||||
}
|
||||
|
||||
|
|
|
@ -1014,11 +1014,9 @@ HRESULT SkXPSDevice::createXpsBrush(const SkPaint& skPaint,
|
|||
SkBitmap outTexture;
|
||||
SkMatrix outMatrix;
|
||||
SkShader::TileMode xy[2];
|
||||
SkScalar twoPointRadialParams[3];
|
||||
SkShader::BitmapType bitmapType = shader->asABitmap(&outTexture,
|
||||
&outMatrix,
|
||||
xy,
|
||||
twoPointRadialParams);
|
||||
xy);
|
||||
switch (bitmapType) {
|
||||
case SkShader::kNone_BitmapType:
|
||||
break;
|
||||
|
|
|
@ -111,7 +111,6 @@ static const TileProc gTileProcs[] = {
|
|||
mirror_tileproc
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class Gradient_Shader : public SkShader {
|
||||
|
@ -796,8 +795,7 @@ public:
|
|||
virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE;
|
||||
virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
|
||||
virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
|
||||
virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*,
|
||||
SkScalar* twoPointRadialParams) const SK_OVERRIDE;
|
||||
virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE;
|
||||
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
|
||||
virtual GrCustomStage* asNewCustomStage(GrContext* context,
|
||||
GrSamplerState* sampler) const SK_OVERRIDE;
|
||||
|
@ -1025,8 +1023,7 @@ void Linear_Gradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC,
|
|||
|
||||
SkShader::BitmapType Linear_Gradient::asABitmap(SkBitmap* bitmap,
|
||||
SkMatrix* matrix,
|
||||
TileMode xy[],
|
||||
SkScalar* twoPointRadialParams) const {
|
||||
TileMode xy[]) const {
|
||||
if (bitmap) {
|
||||
this->commonAsABitmap(bitmap);
|
||||
}
|
||||
|
@ -1056,7 +1053,7 @@ GrCustomStage* Linear_Gradient::asNewCustomStage(GrContext* context,
|
|||
sampler->setWrapX(sk_tile_mode_to_grwrap(fTileMode));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(kClamp_TileMode));
|
||||
sampler->setFilter(GrSamplerState::kBilinear_Filter);
|
||||
return SkNEW_ARGS(GrLinearGradient, (context, *this));
|
||||
return SkNEW_ARGS(GrLinearGradient, (context, *this, sampler));
|
||||
}
|
||||
|
||||
static void dither_memset16(uint16_t dst[], uint16_t value, uint16_t other,
|
||||
|
@ -1442,9 +1439,7 @@ public:
|
|||
|
||||
virtual BitmapType asABitmap(SkBitmap* bitmap,
|
||||
SkMatrix* matrix,
|
||||
TileMode* xy,
|
||||
SkScalar* twoPointRadialParams)
|
||||
const SK_OVERRIDE {
|
||||
TileMode* xy) const SK_OVERRIDE {
|
||||
if (bitmap) {
|
||||
this->commonAsABitmap(bitmap);
|
||||
}
|
||||
|
@ -1476,7 +1471,7 @@ public:
|
|||
sampler->setWrapX(sk_tile_mode_to_grwrap(fTileMode));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(kClamp_TileMode));
|
||||
sampler->setFilter(GrSamplerState::kBilinear_Filter);
|
||||
return SkNEW_ARGS(GrRadialGradient, (context, *this));
|
||||
return SkNEW_ARGS(GrRadialGradient, (context, *this, sampler));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Radial_Gradient)
|
||||
|
@ -1886,13 +1881,12 @@ public:
|
|||
|
||||
virtual BitmapType asABitmap(SkBitmap* bitmap,
|
||||
SkMatrix* matrix,
|
||||
TileMode* xy,
|
||||
SkScalar* twoPointRadialParams) const {
|
||||
TileMode* xy) const {
|
||||
if (bitmap) {
|
||||
this->commonAsABitmap(bitmap);
|
||||
}
|
||||
SkScalar diffL = 0; // just to avoid gcc warning
|
||||
if (matrix || twoPointRadialParams) {
|
||||
if (matrix) {
|
||||
diffL = SkScalarSqrt(SkScalarSquare(fDiff.fX) +
|
||||
SkScalarSquare(fDiff.fY));
|
||||
}
|
||||
|
@ -1910,11 +1904,6 @@ public:
|
|||
xy[0] = fTileMode;
|
||||
xy[1] = kClamp_TileMode;
|
||||
}
|
||||
if (NULL != twoPointRadialParams) {
|
||||
twoPointRadialParams[0] = diffL;
|
||||
twoPointRadialParams[1] = fStartRadius;
|
||||
twoPointRadialParams[2] = fDiffRadius;
|
||||
}
|
||||
return kTwoPointRadial_BitmapType;
|
||||
}
|
||||
|
||||
|
@ -1944,7 +1933,8 @@ public:
|
|||
sampler->setWrapX(sk_tile_mode_to_grwrap(fTileMode));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(kClamp_TileMode));
|
||||
sampler->setFilter(GrSamplerState::kBilinear_Filter);
|
||||
return SkNEW_ARGS(GrRadial2Gradient, (context, *this));
|
||||
return SkNEW_ARGS(GrRadial2Gradient, (context, *this, sampler,
|
||||
diffLen, fStartRadius, fDiffRadius));
|
||||
}
|
||||
|
||||
virtual void shadeSpan(int x, int y, SkPMColor* dstCParam,
|
||||
|
@ -2349,8 +2339,7 @@ public:
|
|||
|
||||
virtual BitmapType asABitmap(SkBitmap* bitmap,
|
||||
SkMatrix* matrix,
|
||||
TileMode* xy,
|
||||
SkScalar* twoPointRadialParams) const {
|
||||
TileMode* xy) const {
|
||||
|
||||
SkPoint diff = fCenter2 - fCenter1;
|
||||
SkScalar diffRadius = fRadius2 - fRadius1;
|
||||
|
@ -2360,7 +2349,7 @@ public:
|
|||
if (bitmap) {
|
||||
this->commonAsABitmap(bitmap);
|
||||
}
|
||||
if (matrix || twoPointRadialParams) {
|
||||
if (matrix) {
|
||||
diffLen = diff.length();
|
||||
}
|
||||
if (matrix) {
|
||||
|
@ -2378,12 +2367,6 @@ public:
|
|||
xy[0] = fTileMode;
|
||||
xy[1] = kClamp_TileMode;
|
||||
}
|
||||
if (NULL != twoPointRadialParams) {
|
||||
twoPointRadialParams[0] = diffLen;
|
||||
twoPointRadialParams[1] = startRadius;
|
||||
twoPointRadialParams[2] = diffRadius;
|
||||
}
|
||||
|
||||
return kTwoPointConical_BitmapType;
|
||||
}
|
||||
|
||||
|
@ -2415,7 +2398,8 @@ public:
|
|||
sampler->setWrapX(sk_tile_mode_to_grwrap(fTileMode));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(kClamp_TileMode));
|
||||
sampler->setFilter(GrSamplerState::kBilinear_Filter);
|
||||
return SkNEW_ARGS(GrConical2Gradient, (context, *this));
|
||||
return SkNEW_ARGS(GrConical2Gradient, (context, *this, sampler,
|
||||
diffLen, fRadius1, fRadius2 - fRadius1));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Two_Point_Conical_Gradient)
|
||||
|
@ -2462,8 +2446,7 @@ public:
|
|||
|
||||
virtual BitmapType asABitmap(SkBitmap* bitmap,
|
||||
SkMatrix* matrix,
|
||||
TileMode* xy,
|
||||
SkScalar* twoPointRadialParams) const SK_OVERRIDE {
|
||||
TileMode* xy) const SK_OVERRIDE {
|
||||
if (bitmap) {
|
||||
this->commonAsABitmap(bitmap);
|
||||
}
|
||||
|
@ -2491,7 +2474,7 @@ public:
|
|||
sampler->setWrapX(sk_tile_mode_to_grwrap(fTileMode));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(kClamp_TileMode));
|
||||
sampler->setFilter(GrSamplerState::kBilinear_Filter);
|
||||
return SkNEW_ARGS(GrSweepGradient, (context, *this));
|
||||
return SkNEW_ARGS(GrSweepGradient, (context, *this, sampler));
|
||||
}
|
||||
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sweep_Gradient)
|
||||
|
|
|
@ -596,12 +596,26 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
|
|||
return false;
|
||||
}
|
||||
|
||||
GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx);
|
||||
GrCustomStage* stage = shader->asNewCustomStage(dev->context(), sampler);
|
||||
|
||||
if (NULL != stage) {
|
||||
sampler->setCustomStage(stage)->unref();
|
||||
SkMatrix localM;
|
||||
if (shader->getLocalMatrix(&localM)) {
|
||||
SkMatrix inverse;
|
||||
if (localM.invert(&inverse)) {
|
||||
sampler->matrix()->preConcat(inverse);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SkBitmap bitmap;
|
||||
SkMatrix* matrix = grPaint->textureSampler(kShaderTextureIdx)->matrix();
|
||||
SkMatrix* matrix = sampler->matrix();
|
||||
SkShader::TileMode tileModes[2];
|
||||
SkScalar twoPointParams[3];
|
||||
SkShader::BitmapType bmptype = shader->asABitmap(&bitmap, matrix,
|
||||
tileModes, twoPointParams);
|
||||
tileModes);
|
||||
|
||||
if (SkShader::kNone_BitmapType == bmptype) {
|
||||
SkShader::GradientInfo info;
|
||||
|
@ -627,13 +641,10 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
|
|||
}
|
||||
|
||||
// Must set wrap and filter on the sampler before requesting a texture.
|
||||
GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx);
|
||||
sampler->setWrapX(sk_tile_mode_to_grwrap(tileModes[0]));
|
||||
sampler->setWrapY(sk_tile_mode_to_grwrap(tileModes[1]));
|
||||
GrSamplerState::Filter filter;
|
||||
if (SkShader::kDefault_BitmapType == bmptype && !skPaint.isFilterBitmap()) {
|
||||
filter = GrSamplerState::kNearest_Filter;
|
||||
} else {
|
||||
GrSamplerState::Filter filter = GrSamplerState::kNearest_Filter;
|
||||
if (skPaint.isFilterBitmap()) {
|
||||
filter = GrSamplerState::kBilinear_Filter;
|
||||
}
|
||||
sampler->setFilter(filter);
|
||||
|
@ -644,34 +655,7 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (bmptype) {
|
||||
case SkShader::kRadial_BitmapType:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrRadialGradient, (texture)))->unref();
|
||||
break;
|
||||
case SkShader::kSweep_BitmapType:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrSweepGradient, (texture)))->unref();
|
||||
break;
|
||||
case SkShader::kTwoPointRadial_BitmapType:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrRadial2Gradient,
|
||||
(texture,
|
||||
twoPointParams[0],
|
||||
twoPointParams[1],
|
||||
twoPointParams[2] < 0)))->unref();
|
||||
break;
|
||||
case SkShader::kTwoPointConical_BitmapType:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrConical2Gradient,
|
||||
(texture,
|
||||
twoPointParams[0],
|
||||
twoPointParams[1],
|
||||
twoPointParams[2])))->unref();
|
||||
break;
|
||||
case SkShader::kLinear_BitmapType:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrLinearGradient, (texture)))->unref();
|
||||
break;
|
||||
default:
|
||||
sampler->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
|
||||
break;
|
||||
}
|
||||
|
||||
// since our texture coords will be in local space, we wack the texture
|
||||
// matrix to map them back into 0...1 before we load it
|
||||
|
@ -686,9 +670,6 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
|
|||
GrScalar sx = SkFloatToScalar(1.f / bitmap.width());
|
||||
GrScalar sy = SkFloatToScalar(1.f / bitmap.height());
|
||||
matrix->postScale(sx, sy);
|
||||
} else if (SkShader::kRadial_BitmapType == bmptype) {
|
||||
GrScalar s = SkFloatToScalar(1.f / bitmap.width());
|
||||
matrix->postScale(s, s);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gl/GrGLProgramStage.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
#include "SkGr.h"
|
||||
#include "../core/SkShader.h"
|
||||
|
||||
// Base class for GL gradient custom stages
|
||||
class GrGLGradientStage : public GrGLProgramStage {
|
||||
|
@ -51,7 +52,9 @@ GrGradientEffect::GrGradientEffect(GrTexture* texture)
|
|||
SkSafeRef(fTexture);
|
||||
}
|
||||
|
||||
GrGradientEffect::GrGradientEffect(GrContext* ctx, const SkShader& shader)
|
||||
GrGradientEffect::GrGradientEffect(GrContext* ctx,
|
||||
const SkShader& shader,
|
||||
GrSamplerState* sampler)
|
||||
: fTexture (NULL)
|
||||
, fUseTexture (false) {
|
||||
// TODO: check for simple cases where we don't need a texture:
|
||||
|
@ -60,16 +63,10 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx, const SkShader& shader)
|
|||
//if (info.fColorCount == 2) { ...
|
||||
|
||||
SkBitmap bitmap;
|
||||
shader.asABitmap(&bitmap, NULL, NULL, NULL);
|
||||
|
||||
// Note: we just construct a default sampler state here, which isn't great,
|
||||
// however, as long as the bitmap has power-of-two dimensions, which should
|
||||
// be the case for gradient bitmaps, it should be fine
|
||||
GrAssert(SkIsPow2(bitmap.width()) && SkIsPow2(bitmap.height()));
|
||||
GrSamplerState sampler;
|
||||
shader.asABitmap(&bitmap, NULL, NULL);
|
||||
|
||||
GrContext::TextureCacheEntry entry = GrLockCachedBitmapTexture(ctx, bitmap,
|
||||
&sampler);
|
||||
sampler);
|
||||
fTexture = entry.texture();
|
||||
SkSafeRef(fTexture);
|
||||
fUseTexture = true;
|
||||
|
@ -133,8 +130,10 @@ GrLinearGradient::GrLinearGradient(GrTexture* texture)
|
|||
: INHERITED(texture) {
|
||||
}
|
||||
|
||||
GrLinearGradient::GrLinearGradient(GrContext* ctx, const SkShader& shader)
|
||||
: INHERITED(ctx, shader) {
|
||||
GrLinearGradient::GrLinearGradient(GrContext* ctx,
|
||||
const SkShader& shader,
|
||||
GrSamplerState* sampler)
|
||||
: INHERITED(ctx, shader, sampler) {
|
||||
}
|
||||
|
||||
GrLinearGradient::~GrLinearGradient() {
|
||||
|
@ -188,8 +187,9 @@ GrRadialGradient::GrRadialGradient(GrTexture* texture)
|
|||
|
||||
}
|
||||
|
||||
GrRadialGradient::GrRadialGradient(GrContext* ctx, const SkShader& shader)
|
||||
: INHERITED(ctx, shader) {
|
||||
GrRadialGradient::GrRadialGradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler)
|
||||
: INHERITED(ctx, shader, sampler) {
|
||||
}
|
||||
|
||||
GrRadialGradient::~GrRadialGradient() {
|
||||
|
@ -445,17 +445,16 @@ GrRadial2Gradient::GrRadial2Gradient(GrTexture* texture,
|
|||
|
||||
}
|
||||
|
||||
GrRadial2Gradient::GrRadial2Gradient(GrContext* ctx, const SkShader& shader)
|
||||
: INHERITED(ctx, shader) {
|
||||
SkShader::GradientInfo info;
|
||||
info.fColorCount = 0;
|
||||
shader.asAGradient(&info);
|
||||
fCenterX1 = SkPoint::Distance(info.fPoint[0], info.fPoint[1]);
|
||||
SkScalar diffRadius = info.fRadius[1] - info.fRadius[0];
|
||||
fPosRoot = diffRadius < 0;
|
||||
SkScalar inv = 0 == diffRadius ? 0 : SkScalarInvert(diffRadius);
|
||||
fRadius0 = SkScalarMul(info.fRadius[0], inv);
|
||||
fCenterX1 = SkScalarMul(fCenterX1, inv);
|
||||
GrRadial2Gradient::GrRadial2Gradient(GrContext* ctx,
|
||||
const SkShader& shader,
|
||||
GrSamplerState* sampler,
|
||||
SkScalar center,
|
||||
SkScalar startRadius,
|
||||
SkScalar diffRadius)
|
||||
: INHERITED(ctx, shader, sampler)
|
||||
, fCenterX1(center)
|
||||
, fRadius0(startRadius)
|
||||
, fPosRoot(diffRadius < 0) {
|
||||
}
|
||||
|
||||
GrRadial2Gradient::~GrRadial2Gradient() {
|
||||
|
@ -776,14 +775,16 @@ GrConical2Gradient::GrConical2Gradient(GrTexture* texture,
|
|||
|
||||
}
|
||||
|
||||
GrConical2Gradient::GrConical2Gradient(GrContext* ctx, const SkShader& shader)
|
||||
: INHERITED(ctx, shader) {
|
||||
SkShader::GradientInfo info;
|
||||
info.fColorCount = 0;
|
||||
shader.asAGradient(&info);
|
||||
fCenterX1 = SkPoint::Distance(info.fPoint[0], info.fPoint[1]);
|
||||
fRadius0 = info.fRadius[0];
|
||||
fDiffRadius = info.fRadius[1] - info.fRadius[0];
|
||||
GrConical2Gradient::GrConical2Gradient(GrContext* ctx,
|
||||
const SkShader& shader,
|
||||
GrSamplerState* sampler,
|
||||
SkScalar center,
|
||||
SkScalar startRadius,
|
||||
SkScalar diffRadius)
|
||||
: INHERITED(ctx, shader, sampler)
|
||||
, fCenterX1(center)
|
||||
, fRadius0(startRadius)
|
||||
, fDiffRadius(diffRadius) {
|
||||
}
|
||||
|
||||
GrConical2Gradient::~GrConical2Gradient() {
|
||||
|
@ -846,8 +847,9 @@ GrSweepGradient::GrSweepGradient(GrTexture* texture)
|
|||
|
||||
}
|
||||
|
||||
GrSweepGradient::GrSweepGradient(GrContext* ctx, const SkShader& shader)
|
||||
: INHERITED(ctx, shader) {
|
||||
GrSweepGradient::GrSweepGradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler)
|
||||
: INHERITED(ctx, shader, sampler) {
|
||||
}
|
||||
|
||||
GrSweepGradient::~GrSweepGradient() {
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#include "GrSingleTextureEffect.h"
|
||||
#include "GrTypes.h"
|
||||
#include "GrScalar.h"
|
||||
#include "SkShader.h"
|
||||
|
||||
class GrSamplerState;
|
||||
class SkShader;
|
||||
|
||||
/*
|
||||
* The intepretation of the texture matrix depends on the sample mode. The
|
||||
|
@ -41,7 +43,8 @@ class GrGradientEffect : public GrCustomStage {
|
|||
public:
|
||||
|
||||
GrGradientEffect(GrTexture* texture);
|
||||
GrGradientEffect(GrContext* ctx, const SkShader& shader);
|
||||
GrGradientEffect(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler);
|
||||
|
||||
virtual ~GrGradientEffect();
|
||||
|
||||
|
@ -66,7 +69,8 @@ class GrLinearGradient : public GrGradientEffect {
|
|||
public:
|
||||
|
||||
GrLinearGradient(GrTexture* texture);
|
||||
GrLinearGradient(GrContext* ctx, const SkShader& shader);
|
||||
GrLinearGradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler);
|
||||
virtual ~GrLinearGradient();
|
||||
|
||||
static const char* Name() { return "Linear Gradient"; }
|
||||
|
@ -86,7 +90,8 @@ class GrRadialGradient : public GrGradientEffect {
|
|||
public:
|
||||
|
||||
GrRadialGradient(GrTexture* texture);
|
||||
GrRadialGradient(GrContext* ctx, const SkShader& shader);
|
||||
GrRadialGradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler);
|
||||
virtual ~GrRadialGradient();
|
||||
|
||||
static const char* Name() { return "Radial Gradient"; }
|
||||
|
@ -106,7 +111,9 @@ class GrRadial2Gradient : public GrGradientEffect {
|
|||
public:
|
||||
|
||||
GrRadial2Gradient(GrTexture* texture, GrScalar center, GrScalar radius, bool posRoot);
|
||||
GrRadial2Gradient(GrContext* ctx, const SkShader& shader);
|
||||
GrRadial2Gradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler, SkScalar center,
|
||||
SkScalar radius, SkScalar diffRadius);
|
||||
virtual ~GrRadial2Gradient();
|
||||
|
||||
static const char* Name() { return "Two-Point Radial Gradient"; }
|
||||
|
@ -143,7 +150,9 @@ class GrConical2Gradient : public GrGradientEffect {
|
|||
public:
|
||||
|
||||
GrConical2Gradient(GrTexture* texture, GrScalar center, GrScalar radius, GrScalar diffRadius);
|
||||
GrConical2Gradient(GrContext* ctx, const SkShader& shader);
|
||||
GrConical2Gradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler, SkScalar center,
|
||||
SkScalar radius, SkScalar diffRadius);
|
||||
virtual ~GrConical2Gradient();
|
||||
|
||||
static const char* Name() { return "Two-Point Conical Gradient"; }
|
||||
|
@ -180,7 +189,8 @@ class GrSweepGradient : public GrGradientEffect {
|
|||
public:
|
||||
|
||||
GrSweepGradient(GrTexture* texture);
|
||||
GrSweepGradient(GrContext* ctx, const SkShader& shader);
|
||||
GrSweepGradient(GrContext* ctx, const SkShader& shader,
|
||||
GrSamplerState* sampler);
|
||||
virtual ~GrSweepGradient();
|
||||
|
||||
static const char* Name() { return "Sweep Gradient"; }
|
||||
|
|
|
@ -944,7 +944,7 @@ SkPDFShader::State::State(const SkShader& shader,
|
|||
if (fType == SkShader::kNone_GradientType) {
|
||||
SkShader::BitmapType bitmapType;
|
||||
SkMatrix matrix;
|
||||
bitmapType = shader.asABitmap(&fImage, &matrix, fImageTileModes, NULL);
|
||||
bitmapType = shader.asABitmap(&fImage, &matrix, fImageTileModes);
|
||||
if (bitmapType != SkShader::kDefault_BitmapType) {
|
||||
fImage.reset();
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче