diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-01-27 15:34:34 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-27 15:34:43 +0000 |
commit | 052fd5158f7f85e478a9f87c45fecaacf7d0f5f3 (patch) | |
tree | 1dd49a45fbbaea5874cbc6d68fb8adf0994a1351 /src/effects | |
parent | 85eb4226a4cd8c10a0e3f3ba2f3a60efbb2dd61b (diff) |
Revert "Start of rewrite of GrFragmentProcessor optimizations."
This reverts commit 85eb4226a4cd8c10a0e3f3ba2f3a60efbb2dd61b.
Reason for revert: test failures on Windows, e.g. https://chromium-swarm.appspot.com/task?id=33f9527484414110&refresh=10
Original change's description:
> Start of rewrite of GrFragmentProcessor optimizations.
>
> This adds a replacement for computeInvariantOutput buts does not use it yet. The replacement allows for three types of optimizations:
>
> * known input color -> known output color for GrFP elimination
> * tracking of whether all color processors modulate their input for the "tweak alpha" optimziation
> * opaqueness tracking
>
> This loses some of the generality of computInvariantOutput. It does not track the known output status of individual color components (other than opaque alpha). It does not track whether GrFragmentProcessors read their input color. It doesn't allow a processor that will receive non-constant output to advertise that it produces a constant output. These could probably be added back in the unlikely case that they prove valuable.
>
> Unlike computeInvariantOutput the optimizations are decided at instantiation time and constant colors are expressed as GrColor4f rather than GrColor.
>
> Change-Id: I684d3f9050693dde2d28154fa695e049ed8cf61a
> Reviewed-on: https://skia-review.googlesource.com/7481
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
>
TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I2390df257456013fa74137cb5d7b5a93820c291e
Reviewed-on: https://skia-review.googlesource.com/7652
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/effects')
22 files changed, 107 insertions, 150 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index 8f9e45dc2b..a259607444 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -32,14 +32,6 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::Make( bounds)); } -inline GrFragmentProcessor::OptimizationFlags GrAlphaThresholdFragmentProcessor::OptFlags(float outerThreshold) { - if (outerThreshold >= 1.f) { - return kPreservesOpaqueInput_OptimizationFlag | kModulatesInput_OptimizationFlag; - } else { - return kModulatesInput_OptimizationFlag; - } -} - GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, @@ -47,17 +39,16 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( float innerThreshold, float outerThreshold, const SkIRect& bounds) - : INHERITED(OptFlags(outerThreshold)) - , fInnerThreshold(innerThreshold) - , fOuterThreshold(outerThreshold) - , fImageCoordTransform(SkMatrix::I(), texture, GrSamplerParams::kNone_FilterMode) - , fImageTextureSampler(texture) - , fColorSpaceXform(std::move(colorSpaceXform)) - , fMaskCoordTransform( - SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), - maskTexture, - GrSamplerParams::kNone_FilterMode) - , fMaskTextureSampler(maskTexture) { + : fInnerThreshold(innerThreshold) + , fOuterThreshold(outerThreshold) + , fImageCoordTransform(SkMatrix::I(), texture, GrSamplerParams::kNone_FilterMode) + , fImageTextureSampler(texture) + , fColorSpaceXform(std::move(colorSpaceXform)) + , fMaskCoordTransform(SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), + SkIntToScalar(-bounds.y())), + maskTexture, + GrSamplerParams::kNone_FilterMode) + , fMaskTextureSampler(maskTexture) { this->initClassID<GrAlphaThresholdFragmentProcessor>(); this->addCoordTransform(&fImageCoordTransform); this->addTextureSampler(&fImageTextureSampler); diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h index f2c14c64bc..f7a2491aee 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.h +++ b/src/effects/GrAlphaThresholdFragmentProcessor.h @@ -35,8 +35,6 @@ public: GrColorSpaceXform* colorSpaceXform() const { return fColorSpaceXform.get(); } private: - static OptimizationFlags OptFlags(float outerThreshold); - GrAlphaThresholdFragmentProcessor(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, GrTexture* maskTexture, diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index 91d17d6e6c..d3eb325b34 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -88,11 +88,10 @@ GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(const SkRect& circl float textureRadius, float solidRadius, GrTexture* blurProfile) - : INHERITED(kModulatesInput_OptimizationFlag) - , fCircle(circle) - , fSolidRadius(solidRadius) - , fTextureRadius(textureRadius) - , fBlurProfileSampler(blurProfile, GrSamplerParams::kBilerp_FilterMode) { + : fCircle(circle) + , fSolidRadius(solidRadius) + , fTextureRadius(textureRadius) + , fBlurProfileSampler(blurProfile, GrSamplerParams::kBilerp_FilterMode) { this->initClassID<GrCircleBlurFragmentProcessor>(); this->addTextureSampler(&fBlurProfileSampler); } diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp index a9a232554f..8d80984bdf 100644 --- a/src/effects/SkArithmeticImageFilter.cpp +++ b/src/effects/SkArithmeticImageFilter.cpp @@ -290,15 +290,9 @@ private: inout->setToUnknown(); } - // This could implement the const input -> const output optimization but it's unlikely to help. ArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor, sk_sp<GrFragmentProcessor> dst) - : INHERITED(kNone_OptimizationFlags) - , fK1(k1) - , fK2(k2) - , fK3(k3) - , fK4(k4) - , fEnforcePMColor(enforcePMColor) { + : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { this->initClassID<ArithmeticFP>(); SkASSERT(dst); SkDEBUGCODE(int dstIndex =) this->registerChildProcessor(std::move(dst)); diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index bf544077df..b53fc41dea 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -974,13 +974,12 @@ GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture return blurProfile; } -GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture* blurProfile, +GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blurProfile, GrSLPrecision precision) - : INHERITED(kModulatesInput_OptimizationFlag) - , fRect(rect) - , fSigma(sigma) - , fBlurProfileSampler(blurProfile) - , fPrecision(precision) { + : fRect(rect) + , fSigma(sigma) + , fBlurProfileSampler(blurProfile) + , fPrecision(precision) { this->initClassID<GrRectBlurEffect>(); this->addTextureSampler(&fBlurProfileSampler); } @@ -1207,11 +1206,10 @@ void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const inout->mulByUnknownSingleComponent(); } -GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture* ninePatchTexture) - : INHERITED(kModulatesInput_OptimizationFlag) - , fRRect(rrect) - , fSigma(sigma) - , fNinePatchSampler(ninePatchTexture) { +GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture) + : fRRect(rrect), + fSigma(sigma), + fNinePatchSampler(ninePatchTexture) { this->initClassID<GrRRectBlurEffect>(); this->addTextureSampler(&fNinePatchSampler); } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index cee47f4f3f..d838e1e347 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -487,26 +487,24 @@ void GrDisplacementMapEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, } GrDisplacementMapEffect::GrDisplacementMapEffect( - SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, - SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, - const SkVector& scale, - GrTexture* displacement, - const SkMatrix& offsetMatrix, - GrTexture* color, - sk_sp<GrColorSpaceXform> colorSpaceXform, - const SkISize& colorDimensions) - : INHERITED(GrPixelConfigIsOpaque(color->config()) ? kPreservesOpaqueInput_OptimizationFlag - : kNone_OptimizationFlags) - , fDisplacementTransform(offsetMatrix, displacement, GrSamplerParams::kNone_FilterMode) - , fDisplacementSampler(displacement) - , fColorTransform(color, GrSamplerParams::kNone_FilterMode) - , fDomain(color, GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(colorDimensions)), - GrTextureDomain::kDecal_Mode) - , fColorSampler(color) - , fColorSpaceXform(std::move(colorSpaceXform)) - , fXChannelSelector(xChannelSelector) - , fYChannelSelector(yChannelSelector) - , fScale(scale) { + SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, + SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, + const SkVector& scale, + GrTexture* displacement, + const SkMatrix& offsetMatrix, + GrTexture* color, + sk_sp<GrColorSpaceXform> colorSpaceXform, + const SkISize& colorDimensions) + : fDisplacementTransform(offsetMatrix, displacement, GrSamplerParams::kNone_FilterMode) + , fDisplacementSampler(displacement) + , fColorTransform(color, GrSamplerParams::kNone_FilterMode) + , fDomain(color, GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(colorDimensions)), + GrTextureDomain::kDecal_Mode) + , fColorSampler(color) + , fColorSpaceXform(std::move(colorSpaceXform)) + , fXChannelSelector(xChannelSelector) + , fYChannelSelector(yChannelSelector) + , fScale(scale) { this->initClassID<GrDisplacementMapEffect>(); this->addCoordTransform(&fDisplacementTransform); this->addTextureSampler(&fDisplacementSampler); diff --git a/src/effects/SkGaussianEdgeShader.cpp b/src/effects/SkGaussianEdgeShader.cpp index 5bd7dca124..7405fd14d9 100644 --- a/src/effects/SkGaussianEdgeShader.cpp +++ b/src/effects/SkGaussianEdgeShader.cpp @@ -63,11 +63,11 @@ private: class GaussianEdgeFP : public GrFragmentProcessor { public: - GaussianEdgeFP() : INHERITED(kNone_OptimizationFlags) { + GaussianEdgeFP() { this->initClassID<GaussianEdgeFP>(); // enable output of distance information for shape - this->setWillUseDistanceVectorField(); + fUsesDistanceVectorField = true; } class GLSLGaussianEdgeFP : public GrGLSLFragmentProcessor { @@ -123,8 +123,6 @@ private: } bool onIsEqual(const GrFragmentProcessor& proc) const override { return true; } - - typedef GrFragmentProcessor INHERITED; }; //////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 3a03a1701c..da4dcb8bdf 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1625,7 +1625,7 @@ SkString emitNormalFunc(BoundaryMode mode, } -class GrGLLightingEffect : public GrGLSLFragmentProcessor { +class GrGLLightingEffect : public GrGLSLFragmentProcessor { public: GrGLLightingEffect() : fLight(nullptr) { } virtual ~GrGLLightingEffect() { delete fLight; } @@ -1702,13 +1702,12 @@ GrLightingEffect::GrLightingEffect(GrTexture* texture, const SkMatrix& matrix, BoundaryMode boundaryMode, const SkIRect* srcBounds) - // Perhaps this could advertise the opaque or modulating optimizations? - : INHERITED(texture, nullptr, SkMatrix::I(), kNone_OptimizationFlags) - , fLight(light) - , fSurfaceScale(surfaceScale) - , fFilterMatrix(matrix) - , fBoundaryMode(boundaryMode) - , fDomain(create_domain(texture, srcBounds, GrTextureDomain::kDecal_Mode)) { + : INHERITED(texture, nullptr, SkMatrix::I()) + , fLight(light) + , fSurfaceScale(surfaceScale) + , fFilterMatrix(matrix) + , fBoundaryMode(boundaryMode) + , fDomain(create_domain(texture, srcBounds, GrTextureDomain::kDecal_Mode)) { fLight->ref(); } diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp index 1792437e34..a9516af63d 100644 --- a/src/effects/SkLumaColorFilter.cpp +++ b/src/effects/SkLumaColorFilter.cpp @@ -98,7 +98,7 @@ public: }; private: - LumaColorFilterEffect() : INHERITED(kConstantOutputForConstantInput_OptimizationFlag) { + LumaColorFilterEffect() { this->initClassID<LumaColorFilterEffect>(); } @@ -117,14 +117,6 @@ private: // The output is always black. The alpha value for the color passed in is arbitrary. inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0)); } - GrColor4f constantOutputForConstantInput(GrColor4f input) const override { - float luma = SK_ITU_BT709_LUM_COEFF_R * input.fRGBA[0] + - SK_ITU_BT709_LUM_COEFF_G * input.fRGBA[1] + - SK_ITU_BT709_LUM_COEFF_B * input.fRGBA[2]; - return GrColor4f(0, 0, 0, luma); - } - - typedef GrFragmentProcessor INHERITED; }; sk_sp<GrFragmentProcessor> SkLumaColorFilter::asFragmentProcessor(GrContext*, SkColorSpace*) const { diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 49f4fdddc3..c8b32aee70 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -27,6 +27,7 @@ #include "../private/GrGLSL.h" class GrMagnifierEffect : public GrSingleTextureEffect { + public: static sk_sp<GrFragmentProcessor> Make(GrTexture* texture, sk_sp<GrColorSpaceXform> colorSpaceXform, @@ -70,15 +71,14 @@ private: float yInvZoom, float xInvInset, float yInvInset) - : INHERITED(texture, std::move(colorSpaceXform), SkMatrix::I(), - ModulationFlags(texture->config())) - , fBounds(bounds) - , fXOffset(xOffset) - , fYOffset(yOffset) - , fXInvZoom(xInvZoom) - , fYInvZoom(yInvZoom) - , fXInvInset(xInvInset) - , fYInvInset(yInvInset) { + : INHERITED(texture, std::move(colorSpaceXform), SkMatrix::I()) + , fBounds(bounds) + , fXOffset(xOffset) + , fYOffset(yOffset) + , fXInvZoom(xInvZoom) + , fYInvZoom(yInvZoom) + , fXInvInset(xInvInset) + , fYInvInset(yInvInset) { this->initClassID<GrMagnifierEffect>(); } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index febde203d5..6e2a80507f 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -140,7 +140,9 @@ void SkDilateImageFilter::toString(SkString* str) const { * color. */ class GrMorphologyEffect : public Gr1DKernelEffect { + public: + enum MorphologyType { kErode_MorphologyType, kDilate_MorphologyType, @@ -325,9 +327,9 @@ GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, Direction direction, int radius, MorphologyType type) - : INHERITED(texture, direction, radius, ModulationFlags(texture->config())) - , fType(type) - , fUseRange(false) { + : INHERITED(texture, direction, radius) + , fType(type) + , fUseRange(false) { this->initClassID<GrMorphologyEffect>(); } @@ -336,9 +338,9 @@ GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, int radius, MorphologyType type, const float range[2]) - : INHERITED(texture, direction, radius, ModulationFlags(texture->config())) - , fType(type) - , fUseRange(true) { + : INHERITED(texture, direction, radius) + , fType(type) + , fUseRange(true) { this->initClassID<GrMorphologyEffect>(); fRange[0] = range[0]; fRange[1] = range[1]; diff --git a/src/effects/SkOverdrawColorFilter.cpp b/src/effects/SkOverdrawColorFilter.cpp index 243ef77cd0..dea4f8b6de 100644 --- a/src/effects/SkOverdrawColorFilter.cpp +++ b/src/effects/SkOverdrawColorFilter.cpp @@ -59,6 +59,7 @@ public: static sk_sp<GrFragmentProcessor> Make(const SkPMColor* colors); const char* name() const override { return "Overdraw"; } + private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} @@ -104,10 +105,7 @@ sk_sp<GrFragmentProcessor> OverdrawFragmentProcessor::Make(const SkPMColor* colo return sk_sp<OverdrawFragmentProcessor>(new OverdrawFragmentProcessor(grColors)); } -// This could implement the constant input -> constant output optimization, but we don't really -// care given how this is used. -OverdrawFragmentProcessor::OverdrawFragmentProcessor(const GrColor4f* colors) - : INHERITED(kNone_OptimizationFlags) { +OverdrawFragmentProcessor::OverdrawFragmentProcessor(const GrColor4f* colors) { this->initClassID<OverdrawFragmentProcessor>(); memcpy(fColors, colors, SkOverdrawColorFilter::kNumColors * sizeof(GrColor4f)); } diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 450fcaa4ef..3798a407ac 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -538,18 +538,18 @@ private: inout->setToUnknown(); } - GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, int numOctaves, bool stitchTiles, + GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, + int numOctaves, bool stitchTiles, SkPerlinNoiseShader::PaintingData* paintingData, GrTexture* permutationsTexture, GrTexture* noiseTexture, const SkMatrix& matrix) - : INHERITED(kNone_OptimizationFlags) - , fType(type) - , fCoordTransform(matrix) - , fNumOctaves(numOctaves) - , fStitchTiles(stitchTiles) - , fPermutationsSampler(permutationsTexture) - , fNoiseSampler(noiseTexture) - , fPaintingData(paintingData) { + : fType(type) + , fCoordTransform(matrix) + , fNumOctaves(numOctaves) + , fStitchTiles(stitchTiles) + , fPermutationsSampler(permutationsTexture) + , fNoiseSampler(noiseTexture) + , fPaintingData(paintingData) { this->initClassID<GrPerlinNoiseEffect>(); this->addTextureSampler(&fPermutationsSampler); this->addTextureSampler(&fNoiseSampler); diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp index 223887bab9..5da3ed1eb1 100644 --- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp +++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp @@ -207,7 +207,9 @@ public: }; RRectsGaussianEdgeFP(const SkRRect& first, const SkRRect& second, SkScalar radius) - : INHERITED(kNone_OptimizationFlags), fFirst(first), fSecond(second), fRadius(radius) { + : fFirst(first) + , fSecond(second) + , fRadius(radius) { this->initClassID<RRectsGaussianEdgeFP>(); fFirstMode = ComputeMode(fFirst); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 9198460c66..1fd4c90eed 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -512,11 +512,10 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, SkBitmap b ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, unsigned flags) - : INHERITED(kNone_OptimizationFlags) // Not bothering with table-specific optimizations. - , fTextureSampler(texture) - , fFlags(flags) - , fAtlas(atlas) - , fRow(row) { + : fTextureSampler(texture) + , fFlags(flags) + , fAtlas(atlas) + , fRow(row) { this->initClassID<ColorTableEffect>(); this->addTextureSampler(&fTextureSampler); } diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 9a3438efe0..b1d3e13a46 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1572,13 +1572,7 @@ void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBui ///////////////////////////////////////////////////////////////////// -inline GrFragmentProcessor::OptimizationFlags GrGradientEffect::OptFlags(bool isOpaque) { - return isOpaque ? kPreservesOpaqueInput_OptimizationFlag | kModulatesInput_OptimizationFlag - : kModulatesInput_OptimizationFlag; -} - -GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque) - : INHERITED(OptFlags(isOpaque)) { +GrGradientEffect::GrGradientEffect(const CreateArgs& args) { const SkGradientShaderBase& shader(*args.fShader); fIsOpaque = shader.isOpaque(); diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 6f46698eba..48ccbd50d0 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -352,6 +352,8 @@ public: class GLSLProcessor; + GrGradientEffect(const CreateArgs&); + virtual ~GrGradientEffect(); bool useAtlas() const { return SkToBool(-1 != fRow); } @@ -400,8 +402,6 @@ public: } protected: - GrGradientEffect(const CreateArgs&, bool isOpaque); - /** Helper struct that stores (and populates) parameters to construct a random gradient. If fUseColors4f is true, then the SkColor4f factory should be called, with fColors4f and fColorSpace. Otherwise, the SkColor factory should be called, with fColors. fColorCount @@ -430,8 +430,6 @@ protected: const GrCoordTransform& getCoordTransform() const { return fCoordTransform; } private: - static OptimizationFlags OptFlags(bool isOpaque); - // If we're in legacy mode, then fColors will be populated. If we're gamma-correct, then // fColors4f and fColorSpaceXform will be populated. SkTDArray<SkColor> fColors; diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 07418e8010..aab1ac787a 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -426,7 +426,8 @@ public: const char* name() const override { return "Linear Gradient"; } private: - GrLinearGradient(const CreateArgs& args) : INHERITED(args, args.fShader->colorsAreOpaque()) { + GrLinearGradient(const CreateArgs& args) + : INHERITED(args) { this->initClassID<GrLinearGradient>(); } diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index 4eb3e6d93a..887410aa96 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -256,7 +256,8 @@ public: const char* name() const override { return "Radial Gradient"; } private: - GrRadialGradient(const CreateArgs& args) : INHERITED(args, args.fShader->colorsAreOpaque()) { + GrRadialGradient(const CreateArgs& args) + : INHERITED(args) { this->initClassID<GrRadialGradient>(); } diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 7e93a21de4..64778c3a54 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -138,7 +138,8 @@ public: const char* name() const override { return "Sweep Gradient"; } private: - GrSweepGradient(const CreateArgs& args) : INHERITED(args, args.fShader->colorsAreOpaque()) { + GrSweepGradient(const CreateArgs& args) + : INHERITED(args) { this->initClassID<GrSweepGradient>(); } diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index 75b1cf7090..5f26dcdb13 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -92,7 +92,7 @@ private: } Edge2PtConicalEffect(const CreateArgs& args) - : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */) { + : INHERITED(args) { const SkTwoPointConicalGradient& shader = *static_cast<const SkTwoPointConicalGradient*>(args.fShader); fCenterX1 = shader.getCenterX1(); @@ -398,15 +398,10 @@ private: this->fIsFlipped == s.fIsFlipped); } - static bool IsFlipped(const CreateArgs& args) { - // eww. - return static_cast<const SkTwoPointConicalGradient*>(args.fShader)->isFlippedGrad(); - } - FocalOutside2PtConicalEffect(const CreateArgs& args, SkScalar focalX) - : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */) - , fFocalX(focalX) - , fIsFlipped(IsFlipped(args)) { + : INHERITED(args) + , fFocalX(focalX) + , fIsFlipped(static_cast<const SkTwoPointConicalGradient*>(args.fShader)->isFlippedGrad()) { this->initClassID<FocalOutside2PtConicalEffect>(); } @@ -418,7 +413,7 @@ private: typedef GrGradientEffect INHERITED; }; -class FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor +class FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor : public GrGradientEffect::GLSLProcessor { public: GLSLFocalOutside2PtConicalProcessor(const GrProcessor&); @@ -611,7 +606,7 @@ private: } FocalInside2PtConicalEffect(const CreateArgs& args, SkScalar focalX) - : INHERITED(args, args.fShader->colorsAreOpaque()), fFocalX(focalX) { + : INHERITED(args), fFocalX(focalX) { this->initClassID<FocalInside2PtConicalEffect>(); } @@ -852,7 +847,7 @@ private: } CircleInside2PtConicalEffect(const CreateArgs& args, const CircleConicalInfo& info) - : INHERITED(args, args.fShader->colorsAreOpaque()), fInfo(info) { + : INHERITED(args), fInfo(info) { this->initClassID<CircleInside2PtConicalEffect>(); } @@ -1069,8 +1064,7 @@ private: } CircleOutside2PtConicalEffect(const CreateArgs& args, const CircleConicalInfo& info) - : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */) - , fInfo(info) { + : INHERITED(args), fInfo(info) { this->initClassID<CircleOutside2PtConicalEffect>(); const SkTwoPointConicalGradient& shader = *static_cast<const SkTwoPointConicalGradient*>(args.fShader); diff --git a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp index e7d8d31302..d92a7b548c 100755 --- a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp +++ b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp @@ -140,7 +140,9 @@ void SkAmbientShadowMaskFilterImpl::flatten(SkWriteBuffer& buffer) const { // class ShadowEdgeFP : public GrFragmentProcessor { public: - ShadowEdgeFP() : INHERITED(kNone_OptimizationFlags) { this->initClassID<ShadowEdgeFP>(); } + ShadowEdgeFP() { + this->initClassID<ShadowEdgeFP>(); + } class GLSLShadowEdgeFP : public GrGLSLFragmentProcessor { public: @@ -177,8 +179,6 @@ private: } bool onIsEqual(const GrFragmentProcessor& proc) const override { return true; } - - typedef GrFragmentProcessor INHERITED; }; /////////////////////////////////////////////////////////////////////////////////////////////////// |