aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/dcshader.cpp7
-rw-r--r--include/core/SkXfermode.h4
-rw-r--r--include/gpu/effects/GrCustomXfermode.h3
-rw-r--r--src/core/SkXfermode.cpp7
-rw-r--r--src/core/SkXfermode_proccoeff.h3
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp18
-rw-r--r--src/effects/SkArithmeticMode.cpp7
-rw-r--r--src/effects/SkArithmeticMode_gpu.cpp6
-rw-r--r--src/effects/SkArithmeticMode_gpu.h12
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp15
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp16
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp7
-rw-r--r--src/effects/gradients/SkGradientShader.cpp1
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h1
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp11
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp11
-rw-r--r--src/effects/gradients/SkSweepGradient.cpp13
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp5
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp53
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.h3
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp11
-rw-r--r--src/gpu/effects/GrCustomXfermodePriv.h2
22 files changed, 142 insertions, 74 deletions
diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp
index 0f481df268..d58d4e3c2e 100644
--- a/gm/dcshader.cpp
+++ b/gm/dcshader.cpp
@@ -55,7 +55,7 @@ SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) {
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>();
}
@@ -101,8 +101,9 @@ private:
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;
}
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index e7f3bd6541..7cbde0e7e8 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -14,6 +14,7 @@
#include "SkColor.h"
class GrFragmentProcessor;
+class GrShaderDataManager;
class GrTexture;
class GrXPFactory;
class SkString;
@@ -207,7 +208,8 @@ public:
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
diff --git a/include/gpu/effects/GrCustomXfermode.h b/include/gpu/effects/GrCustomXfermode.h
index ab131ee169..31c66d5f43 100644
--- a/include/gpu/effects/GrCustomXfermode.h
+++ b/include/gpu/effects/GrCustomXfermode.h
@@ -22,7 +22,8 @@ class GrTexture;
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);
};
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index d8ca8f1e6e..3ebd24c981 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -658,7 +658,8 @@ bool SkXfermode::asMode(Mode* mode) const {
return false;
}
-bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const {
+bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*,
+ GrTexture*) const {
return false;
}
@@ -928,10 +929,12 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
#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;
diff --git a/src/core/SkXfermode_proccoeff.h b/src/core/SkXfermode_proccoeff.h
index 596b2acc46..79e2a1ba4b 100644
--- a/src/core/SkXfermode_proccoeff.h
+++ b/src/core/SkXfermode_proccoeff.h
@@ -44,7 +44,8 @@ public:
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
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index 774092c2df..006b9e6052 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -62,11 +62,13 @@ SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
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));
@@ -84,7 +86,8 @@ public:
GrGLFragmentProcessor* createGLInstance() const override;
private:
- AlphaThresholdEffect(GrTexture* texture,
+ AlphaThresholdEffect(GrShaderDataManager*,
+ GrTexture* texture,
GrTexture* maskTexture,
float innerThreshold,
float outerThreshold)
@@ -212,7 +215,9 @@ GrFragmentProcessor* AlphaThresholdEffect::TestCreate(SkRandom* random,
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);
}
///////////////////////////////////////////////////////////////////////////////
@@ -265,7 +270,7 @@ SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
#if SK_SUPPORT_GPU
bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
- GrShaderDataManager*,
+ GrShaderDataManager* shaderDataManager,
GrTexture* texture,
const SkMatrix& in_matrix,
const SkIRect&) const {
@@ -303,7 +308,8 @@ bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
}
}
- *fp = AlphaThresholdEffect::Create(texture,
+ *fp = AlphaThresholdEffect::Create(shaderDataManager,
+ texture,
maskTexture,
fInnerThreshold,
fOuterThreshold);
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index 4914c696ee..944707de96 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -31,7 +31,8 @@ public:
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
@@ -235,9 +236,11 @@ SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
#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]),
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 2a1004d783..302e8b6405 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -101,7 +101,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
-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>();
@@ -149,7 +149,9 @@ GrFragmentProcessor* GrArithmeticFP::TestCreate(SkRandom* rand,
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);
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index b9235b3813..a3c3d3ba2c 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -31,9 +31,11 @@ class GrGLArtithmeticFP;
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 {};
@@ -55,8 +57,8 @@ private:
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;
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index d7d92c82b9..932a4b1e3a 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -332,11 +332,13 @@ private:
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,
@@ -370,7 +372,8 @@ private:
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,
@@ -446,7 +449,8 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
SkIntToScalar(colorOffset.fY - displacementOffset.fY));
paint.addColorProcessor(
- GrDisplacementMapEffect::Create(fXChannelSelector,
+ GrDisplacementMapEffect::Create(paint.getShaderDataManager(),
+ fXChannelSelector,
fYChannelSelector,
scale,
displacement,
@@ -475,6 +479,7 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
///////////////////////////////////////////////////////////////////////////////
GrDisplacementMapEffect::GrDisplacementMapEffect(
+ GrShaderDataManager*,
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
const SkVector& scale,
@@ -542,7 +547,9 @@ GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random,
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);
}
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 237af0e066..38a778406f 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -515,13 +515,15 @@ private:
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() {
@@ -563,7 +565,7 @@ private:
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,
@@ -945,7 +947,8 @@ void GrGLPerlinNoise::setData(const GrGLProgramDataManager& pdman, const GrProce
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);
@@ -984,7 +987,8 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint&
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,
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 599fd42b12..972884330b 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -123,7 +123,7 @@ void SkXfermodeImageFilter::toString(SkString* str) const {
#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,
@@ -166,7 +166,9 @@ 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;
@@ -180,7 +182,6 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
SkRect srcRect;
src.getBounds(&srcRect);
- GrPaint paint;
SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Create(
foregroundTex, foregroundMatrix,
GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()),
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 52731b395f..e7bc5277f0 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1058,6 +1058,7 @@ void GrGLGradientEffect::emitColor(GrGLFPBuilder* builder,
/////////////////////////////////////////////////////////////////////
GrGradientEffect::GrGradientEffect(GrContext* ctx,
+ GrShaderDataManager*,
const SkGradientShaderBase& shader,
const SkMatrix& matrix,
SkShader::TileMode tileMode) {
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index dff6983518..9cd573ae02 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -329,6 +329,7 @@ class GrGradientEffect : public GrFragmentProcessor {
public:
GrGradientEffect(GrContext* ctx,
+ GrShaderDataManager*,
const SkGradientShaderBase& shader,
const SkMatrix& matrix,
SkShader::TileMode tileMode);
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 7b20b2deef..2fbe435d14 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -489,10 +489,11 @@ class GrLinearGradient : public GrGradientEffect {
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() { }
@@ -510,10 +511,11 @@ public:
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;
@@ -569,7 +571,8 @@ void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder,
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);
@@ -587,7 +590,7 @@ bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
matrix.postConcat(fPtsToUnit);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
- *fp = GrLinearGradient::Create(context, *this, matrix, fTileMode);
+ *fp = GrLinearGradient::Create(context, shaderDataManager, *this, matrix, fTileMode);
return true;
}
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index b2e9a11e64..b46a044214 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -462,10 +462,11 @@ private:
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() { }
@@ -483,10 +484,11 @@ public:
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>();
}
@@ -545,7 +547,8 @@ void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder,
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;
@@ -562,7 +565,7 @@ bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
matrix.postConcat(fPtsToUnit);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
- *fp = GrRadialGradient::Create(context, *this, matrix, fTileMode);
+ *fp = GrRadialGradient::Create(context, shaderDataManager, *this, matrix, fTileMode);
return true;
}
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 24853ff76f..4bf80984fd 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -211,9 +211,9 @@ private:
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() { }
@@ -230,9 +230,10 @@ public:
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;
@@ -298,7 +299,7 @@ void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& paint,
const SkMatrix& viewM,
const SkMatrix* localMatrix, GrColor* paintColor,
- GrShaderDataManager*,
+ GrShaderDataManager* shaderDataManager,
GrFragmentProcessor** effect) const {
SkMatrix matrix;
@@ -314,7 +315,7 @@ bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& pai
}
matrix.postConcat(fPtsToUnit);
- *effect = GrSweepGradient::Create(context, *this, matrix);
+ *effect = GrSweepGradient::Create(context, shaderDataManager, *this, matrix);
*paintColor = SkColor2GrColorJustAlpha(paint.getColor());
return true;
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index ee531b271e..6e8fe4e2ab 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -394,12 +394,13 @@ bool SkTwoPointConicalGradient::asFragmentProcessor(GrContext* context,
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;
}
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index 357e39c3ad..07722e9724 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -59,10 +59,11 @@ class Edge2PtConicalEffect : public GrGradientEffect {
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() {}
@@ -90,10 +91,11 @@ private:
}
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()){
@@ -381,11 +383,13 @@ class FocalOutside2PtConicalEffect : public GrGradientEffect {
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() { }
@@ -410,11 +414,14 @@ private:
}
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>();
}
@@ -604,11 +611,13 @@ class FocalInside2PtConicalEffect : public GrGradientEffect {
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() {}
@@ -633,11 +642,12 @@ private:
}
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>();
}
@@ -852,11 +862,13 @@ class CircleInside2PtConicalEffect : public GrGradientEffect {
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() {}
@@ -885,11 +897,12 @@ private:
}
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>();
}
@@ -1077,11 +1090,13 @@ class CircleOutside2PtConicalEffect : public GrGradientEffect {
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() {}
@@ -1113,11 +1128,12 @@ private:
}
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());
@@ -1341,6 +1357,7 @@ void GLCircleOutside2PtConicalEffect::GenKey(const GrProcessor& processor,
//////////////////////////////////////////////////////////////////////////////
GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
+ GrShaderDataManager* shaderDataManager,
const SkTwoPointConicalGradient& shader,
SkShader::TileMode tm,
const SkMatrix* localMatrix) {
@@ -1360,12 +1377,14 @@ GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
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);
}
}
@@ -1373,12 +1392,14 @@ GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
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);
}
}
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.h b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h
index 54937c6ffb..928e530501 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.h
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h
@@ -18,7 +18,8 @@ namespace Gr2PtConicalGradientEffect {
* 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);
};
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index feea78f786..94d50f684e 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -431,11 +431,12 @@ static void emit_custom_xfermode_code(SkXfermode::Mode mode,
// 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));
}
}
@@ -478,7 +479,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
-GrCustomXferFP::GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background)
+GrCustomXferFP::GrCustomXferFP(GrShaderDataManager*, SkXfermode::Mode mode, GrTexture* background)
: fMode(mode) {
this->initClassID<GrCustomXferFP>();
@@ -514,7 +515,9 @@ GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand,
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]));
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrCustomXfermodePriv.h b/src/gpu/effects/GrCustomXfermodePriv.h
index 9157f36bd5..b92debb16f 100644
--- a/src/gpu/effects/GrCustomXfermodePriv.h
+++ b/src/gpu/effects/GrCustomXfermodePriv.h
@@ -27,7 +27,7 @@ class GrTexture;
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;