class DCFP : public GrFragmentProcessor {
public:
- DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
+ DCFP(GrShaderDataManager*, const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
this->addCoordTransform(&fDeviceTransform);
this->initClassID<DCFP>();
}
bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix& viewM,
const SkMatrix* localMatrix, GrColor* color,
- GrShaderDataManager*, GrFragmentProcessor** fp) const {
- *fp = SkNEW_ARGS(DCFP, (fDeviceMatrix));
+ GrShaderDataManager* shaderDataManager,
+ GrFragmentProcessor** fp) const {
+ *fp = SkNEW_ARGS(DCFP, (shaderDataManager, fDeviceMatrix));
*color = GrColorPackA4(paint.getAlpha());
return true;
}
#include "SkColor.h"
class GrFragmentProcessor;
+class GrShaderDataManager;
class GrTexture;
class GrXPFactory;
class SkString;
required. Upon success the function returns true and the caller owns a ref to the fragment
parameter. Upon failure false is returned and the processor param is not written to.
*/
- virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* background) const;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*,
+ GrTexture* background) const;
/** A subclass may implement this factory function to work with the GPU backend. It is legal
to call this with xpf NULL to simply test the return value. If xpf is non-NULL then the
namespace GrCustomXfermode {
bool IsSupportedMode(SkXfermode::Mode mode);
- GrFragmentProcessor* CreateFP(SkXfermode::Mode mode, GrTexture* background);
+ GrFragmentProcessor* CreateFP(GrShaderDataManager*, SkXfermode::Mode mode,
+ GrTexture* background);
GrXPFactory* CreateXPFactory(SkXfermode::Mode mode);
};
return false;
}
-bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const {
+bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*,
+ GrTexture*) const {
return false;
}
#include "effects/GrCustomXfermode.h"
bool SkProcCoeffXfermode::asFragmentProcessor(GrFragmentProcessor** fp,
+ GrShaderDataManager* shaderDataManager,
GrTexture* background) const {
if (GrCustomXfermode::IsSupportedMode(fMode)) {
if (fp) {
- *fp = GrCustomXfermode::CreateFP(fMode, background);
+ SkASSERT(shaderDataManager);
+ *fp = GrCustomXfermode::CreateFP(shaderDataManager, fMode, background);
SkASSERT(*fp);
}
return true;
bool isOpaque(SkXfermode::SrcColorOpacity opacityType) const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* background) const override;
+ bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*,
+ GrTexture* background) const override;
bool asXPFactory(GrXPFactory**) const override;
#endif
class AlphaThresholdEffect : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(GrTexture* texture,
+ static GrFragmentProcessor* Create(GrShaderDataManager* shaderDataManager,
+ GrTexture* texture,
GrTexture* maskTexture,
float innerThreshold,
float outerThreshold) {
- return SkNEW_ARGS(AlphaThresholdEffect, (texture,
+ return SkNEW_ARGS(AlphaThresholdEffect, (shaderDataManager,
+ texture,
maskTexture,
innerThreshold,
outerThreshold));
GrGLFragmentProcessor* createGLInstance() const override;
private:
- AlphaThresholdEffect(GrTexture* texture,
+ AlphaThresholdEffect(GrShaderDataManager*,
+ GrTexture* texture,
GrTexture* maskTexture,
float innerThreshold,
float outerThreshold)
GrTexture* maskTex = textures[GrProcessorUnitTest::kAlphaTextureIdx];
float inner_thresh = random->nextUScalar1();
float outer_thresh = random->nextUScalar1();
- return AlphaThresholdEffect::Create(bmpTex, maskTex, inner_thresh, outer_thresh);
+ GrShaderDataManager shaderDataManager;
+ return AlphaThresholdEffect::Create(&shaderDataManager, bmpTex, maskTex, inner_thresh,
+ outer_thresh);
}
///////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
- GrShaderDataManager*,
+ GrShaderDataManager* shaderDataManager,
GrTexture* texture,
const SkMatrix& in_matrix,
const SkIRect&) const {
}
}
- *fp = AlphaThresholdEffect::Create(texture,
+ *fp = AlphaThresholdEffect::Create(shaderDataManager,
+ texture,
maskTexture,
fInnerThreshold,
fOuterThreshold);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
#if SK_SUPPORT_GPU
- bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* background) const override;
+ bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*,
+ GrTexture* background) const override;
bool asXPFactory(GrXPFactory**) const override;
#endif
#if SK_SUPPORT_GPU
bool SkArithmeticMode_scalar::asFragmentProcessor(GrFragmentProcessor** fp,
+ GrShaderDataManager* shaderDataManager,
GrTexture* background) const {
if (fp) {
- *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]),
+ *fp = GrArithmeticFP::Create(shaderDataManager,
+ SkScalarToFloat(fK[0]),
SkScalarToFloat(fK[1]),
SkScalarToFloat(fK[2]),
SkScalarToFloat(fK[3]),
///////////////////////////////////////////////////////////////////////////////
-GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4,
+GrArithmeticFP::GrArithmeticFP(GrShaderDataManager*, float k1, float k2, float k3, float k4,
bool enforcePMColor, GrTexture* background)
: fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) {
this->initClassID<GrArithmeticFP>();
float k4 = rand->nextF();
bool enforcePMColor = rand->nextBool();
- return SkNEW_ARGS(GrArithmeticFP, (k1, k2, k3, k4, enforcePMColor, textures[0]));
+ GrShaderDataManager shaderDataManager;
+ return SkNEW_ARGS(GrArithmeticFP, (&shaderDataManager, k1, k2, k3, k4, enforcePMColor,
+ textures[0]));
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP);
class GrArithmeticFP : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor,
- GrTexture* background) {
- return SkNEW_ARGS(GrArithmeticFP, (k1, k2, k3, k4, enforcePMColor, background));
+ static GrFragmentProcessor* Create(GrShaderDataManager* shaderDataManager, float k1, float k2,
+ float k3, float k4, bool enforcePMColor,
+ GrTexture* background) {
+ return SkNEW_ARGS(GrArithmeticFP, (shaderDataManager, k1, k2, k3, k4, enforcePMColor,
+ background));
}
~GrArithmeticFP() override {};
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
- GrArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
- GrTexture* background);
+ GrArithmeticFP(GrShaderDataManager*, float k1, float k2, float k3, float k4,
+ bool enforcePMColor, GrTexture* background);
float fK1, fK2, fK3, fK4;
bool fEnforcePMColor;
class GrDisplacementMapEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(
+ GrShaderDataManager* shaderDataManager,
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale,
GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* color,
const SkISize& colorDimensions) {
- return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
+ return SkNEW_ARGS(GrDisplacementMapEffect, (shaderDataManager,
+ xChannelSelector,
yChannelSelector,
scale,
displacement,
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
- GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
+ GrDisplacementMapEffect(GrShaderDataManager*,
+ SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
const SkVector& scale,
GrTexture* displacement, const SkMatrix& offsetMatrix,
SkIntToScalar(colorOffset.fY - displacementOffset.fY));
paint.addColorProcessor(
- GrDisplacementMapEffect::Create(fXChannelSelector,
+ GrDisplacementMapEffect::Create(paint.getShaderDataManager(),
+ fXChannelSelector,
fYChannelSelector,
scale,
displacement,
///////////////////////////////////////////////////////////////////////////////
GrDisplacementMapEffect::GrDisplacementMapEffect(
+ GrShaderDataManager*,
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
const SkVector& scale,
SkISize colorDimensions;
colorDimensions.fWidth = random->nextRangeU(0, textures[texIdxColor]->width());
colorDimensions.fHeight = random->nextRangeU(0, textures[texIdxColor]->height());
- return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, scale,
+ GrShaderDataManager shaderDataManager;
+ return GrDisplacementMapEffect::Create(&shaderDataManager,
+ xChannelSelector, yChannelSelector, scale,
textures[texIdxDispl], SkMatrix::I(),
textures[texIdxColor], colorDimensions);
}
class GrPerlinNoiseEffect : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(SkPerlinNoiseShader::Type type,
+ static GrFragmentProcessor* Create(GrShaderDataManager* shaderDataManager,
+ SkPerlinNoiseShader::Type type,
int numOctaves, bool stitchTiles,
SkPerlinNoiseShader::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* noiseTexture,
const SkMatrix& matrix, uint8_t alpha) {
- return SkNEW_ARGS(GrPerlinNoiseEffect, (type, numOctaves, stitchTiles, paintingData,
- permutationsTexture, noiseTexture, matrix, alpha));
+ return SkNEW_ARGS(GrPerlinNoiseEffect, (shaderDataManager, type, numOctaves, stitchTiles,
+ paintingData, permutationsTexture, noiseTexture,
+ matrix, alpha));
}
virtual ~GrPerlinNoiseEffect() {
inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput);
}
- GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type,
+ GrPerlinNoiseEffect(GrShaderDataManager*, SkPerlinNoiseShader::Type type,
int numOctaves, bool stitchTiles,
SkPerlinNoiseShader::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* noiseTexture,
bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint& paint,
const SkMatrix& viewM,
const SkMatrix* externalLocalMatrix,
- GrColor* paintColor, GrShaderDataManager*,
+ GrColor* paintColor,
+ GrShaderDataManager* shaderDataManager,
GrFragmentProcessor** fp) const {
SkASSERT(context);
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
if ((permutationsTexture) && (noiseTexture)) {
- *fp = GrPerlinNoiseEffect::Create(fType,
+ *fp = GrPerlinNoiseEffect::Create(shaderDataManager,
+ fType,
fNumOctaves,
fStitchTiles,
paintingData,
#if SK_SUPPORT_GPU
bool SkXfermodeImageFilter::canFilterImageGPU() const {
- return fMode && fMode->asFragmentProcessor(NULL, NULL) && !cropRectIsSet();
+ return fMode && fMode->asFragmentProcessor(NULL, NULL, NULL) && !cropRectIsSet();
}
bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
return false;
}
- if (!fMode || !fMode->asFragmentProcessor(&xferProcessor, backgroundTex)) {
+ GrPaint paint;
+ if (!fMode || !fMode->asFragmentProcessor(&xferProcessor, paint.getShaderDataManager(),
+ backgroundTex)) {
// canFilterImageGPU() should've taken care of this
SkASSERT(false);
return false;
SkRect srcRect;
src.getBounds(&srcRect);
- GrPaint paint;
SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Create(
foregroundTex, foregroundMatrix,
GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()),
/////////////////////////////////////////////////////////////////////
GrGradientEffect::GrGradientEffect(GrContext* ctx,
+ GrShaderDataManager*,
const SkGradientShaderBase& shader,
const SkMatrix& matrix,
SkShader::TileMode tileMode) {
public:
GrGradientEffect(GrContext* ctx,
+ GrShaderDataManager*,
const SkGradientShaderBase& shader,
const SkMatrix& matrix,
SkShader::TileMode tileMode);
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkLinearGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm));
+ return SkNEW_ARGS(GrLinearGradient, (ctx, shaderDataManager, shader, matrix, tm));
}
virtual ~GrLinearGradient() { }
private:
GrLinearGradient(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkLinearGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm)
- : INHERITED(ctx, shader, matrix, tm) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm) {
this->initClassID<GrLinearGradient>();
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
const SkMatrix& viewm, const SkMatrix* localMatrix,
- GrColor* paintColor, GrShaderDataManager*,
+ GrColor* paintColor,
+ GrShaderDataManager* shaderDataManager,
GrFragmentProcessor** fp) const {
SkASSERT(context);
matrix.postConcat(fPtsToUnit);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
- *fp = GrLinearGradient::Create(context, *this, matrix, fTileMode);
+ *fp = GrLinearGradient::Create(context, shaderDataManager, *this, matrix, fTileMode);
return true;
}
class GrRadialGradient : public GrGradientEffect {
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkRadialGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm));
+ return SkNEW_ARGS(GrRadialGradient, (ctx, shaderDataManager, shader, matrix, tm));
}
virtual ~GrRadialGradient() { }
private:
GrRadialGradient(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkRadialGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm)
- : INHERITED(ctx, shader, matrix, tm) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm) {
this->initClassID<GrRadialGradient>();
}
bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
const SkMatrix& viewM,
const SkMatrix* localMatrix, GrColor* paintColor,
- GrShaderDataManager*, GrFragmentProcessor** fp) const {
+ GrShaderDataManager* shaderDataManager,
+ GrFragmentProcessor** fp) const {
SkASSERT(context);
SkMatrix matrix;
matrix.postConcat(fPtsToUnit);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
- *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode);
+ *fp = GrRadialGradient::Create(context, shaderDataManager, *this, matrix, fTileMode);
return true;
}
class GrSweepGradient : public GrGradientEffect {
public:
- static GrFragmentProcessor* Create(GrContext* ctx, const SkSweepGradient& shader,
- const SkMatrix& m) {
- return SkNEW_ARGS(GrSweepGradient, (ctx, shader, m));
+ static GrFragmentProcessor* Create(GrContext* ctx, GrShaderDataManager* shaderDataManager,
+ const SkSweepGradient& shader, const SkMatrix& m) {
+ return SkNEW_ARGS(GrSweepGradient, (ctx, shaderDataManager, shader, m));
}
virtual ~GrSweepGradient() { }
private:
GrSweepGradient(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkSweepGradient& shader,
const SkMatrix& matrix)
- : INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, SkShader::kClamp_TileMode) {
this->initClassID<GrSweepGradient>();
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
const SkMatrix& viewM,
const SkMatrix* localMatrix, GrColor* paintColor,
- GrShaderDataManager*,
+ GrShaderDataManager* shaderDataManager,
GrFragmentProcessor** effect) const {
SkMatrix matrix;
}
matrix.postConcat(fPtsToUnit);
- *effect = GrSweepGradient::Create(context, *this, matrix);
+ *effect = GrSweepGradient::Create(context, shaderDataManager, *this, matrix);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
return true;
const SkMatrix& viewM,
const SkMatrix* localMatrix,
GrColor* paintColor,
- GrShaderDataManager*,
+ GrShaderDataManager* shaderDataManager,
GrFragmentProcessor** fp) const {
SkASSERT(context);
SkASSERT(fPtsToUnit.isIdentity());
- *fp = Gr2PtConicalGradientEffect::Create(context, *this, fTileMode, localMatrix);
+ *fp = Gr2PtConicalGradientEffect::Create(context, shaderDataManager, *this, fTileMode,
+ localMatrix);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
return true;
}
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
- return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm));
+ return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shaderDataManager, shader, matrix, tm));
}
virtual ~Edge2PtConicalEffect() {}
}
Edge2PtConicalEffect(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm)
- : INHERITED(ctx, shader, matrix, tm),
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm),
fCenterX1(shader.getCenterX1()),
fRadius0(shader.getStartRadius()),
fDiffRadius(shader.getDiffRadius()){
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
- return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
+ return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shaderDataManager, shader, matrix, tm,
+ focalX));
}
virtual ~FocalOutside2PtConicalEffect() { }
}
FocalOutside2PtConicalEffect(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX)
- : INHERITED(ctx, shader, matrix, tm), fFocalX(focalX), fIsFlipped(shader.isFlippedGrad()) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm)
+ , fFocalX(focalX)
+ , fIsFlipped(shader.isFlippedGrad()) {
this->initClassID<FocalOutside2PtConicalEffect>();
}
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
- return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
+ return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shaderDataManager, shader, matrix, tm,
+ focalX));
}
virtual ~FocalInside2PtConicalEffect() {}
}
FocalInside2PtConicalEffect(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX)
- : INHERITED(ctx, shader, matrix, tm), fFocalX(focalX) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm), fFocalX(focalX) {
this->initClassID<FocalInside2PtConicalEffect>();
}
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
- return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm, info));
+ return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shaderDataManager, shader, matrix, tm,
+ info));
}
virtual ~CircleInside2PtConicalEffect() {}
}
CircleInside2PtConicalEffect(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info)
- : INHERITED(ctx, shader, matrix, tm), fInfo(info) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm), fInfo(info) {
this->initClassID<CircleInside2PtConicalEffect>();
}
public:
static GrFragmentProcessor* Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
- return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, tm, info));
+ return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shaderDataManager, shader, matrix,
+ tm, info));
}
virtual ~CircleOutside2PtConicalEffect() {}
}
CircleOutside2PtConicalEffect(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info)
- : INHERITED(ctx, shader, matrix, tm), fInfo(info) {
+ : INHERITED(ctx, shaderDataManager, shader, matrix, tm), fInfo(info) {
this->initClassID<CircleOutside2PtConicalEffect>();
if (shader.getStartRadius() != shader.getEndRadius()) {
fTLimit = shader.getStartRadius() / (shader.getStartRadius() - shader.getEndRadius());
//////////////////////////////////////////////////////////////////////////////
GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
SkShader::TileMode tm,
const SkMatrix* localMatrix) {
SkScalar focalX;
ConicalType type = set_matrix_focal_conical(shader, &matrix, &focalX);
if (type == kInside_ConicalType) {
- return FocalInside2PtConicalEffect::Create(ctx, shader, matrix, tm, focalX);
+ return FocalInside2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm,
+ focalX);
} else if(type == kEdge_ConicalType) {
set_matrix_edge_conical(shader, &matrix);
- return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm);
+ return Edge2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm);
} else {
- return FocalOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, focalX);
+ return FocalOutside2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm,
+ focalX);
}
}
ConicalType type = set_matrix_circle_conical(shader, &matrix, &info);
if (type == kInside_ConicalType) {
- return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, info);
+ return CircleInside2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm,
+ info);
} else if (type == kEdge_ConicalType) {
set_matrix_edge_conical(shader, &matrix);
- return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm);
+ return Edge2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm);
} else {
- return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, info);
+ return CircleOutside2PtConicalEffect::Create(ctx, shaderDataManager, shader, matrix, tm,
+ info);
}
}
* Creates an effect that produces a two point conical gradient based on the
* shader passed in.
*/
- GrFragmentProcessor* Create(GrContext* ctx, const SkTwoPointConicalGradient& shader,
+ GrFragmentProcessor* Create(GrContext* ctx,GrShaderDataManager* shaderDataManager,
+ const SkTwoPointConicalGradient& shader,
SkShader::TileMode tm, const SkMatrix* localMatrix);
};
// Fragment Processor
///////////////////////////////////////////////////////////////////////////////
-GrFragmentProcessor* GrCustomXfermode::CreateFP(SkXfermode::Mode mode, GrTexture* background) {
+GrFragmentProcessor* GrCustomXfermode::CreateFP(GrShaderDataManager* shaderDataManager,
+ SkXfermode::Mode mode, GrTexture* background) {
if (!GrCustomXfermode::IsSupportedMode(mode)) {
return NULL;
} else {
- return SkNEW_ARGS(GrCustomXferFP, (mode, background));
+ return SkNEW_ARGS(GrCustomXferFP, (shaderDataManager, mode, background));
}
}
///////////////////////////////////////////////////////////////////////////////
-GrCustomXferFP::GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background)
+GrCustomXferFP::GrCustomXferFP(GrShaderDataManager*, SkXfermode::Mode mode, GrTexture* background)
: fMode(mode) {
this->initClassID<GrCustomXferFP>();
GrTexture* textures[]) {
int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
- return SkNEW_ARGS(GrCustomXferFP, (static_cast<SkXfermode::Mode>(mode), textures[0]));
+ GrShaderDataManager shaderDataManager;
+ return SkNEW_ARGS(GrCustomXferFP, (&shaderDataManager, static_cast<SkXfermode::Mode>(mode),
+ textures[0]));
}
///////////////////////////////////////////////////////////////////////////////
class GrCustomXferFP : public GrFragmentProcessor {
public:
- GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background);
+ GrCustomXferFP(GrShaderDataManager*, SkXfermode::Mode mode, GrTexture* background);
void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;