diff options
author | bsalomon <bsalomon@google.com> | 2014-07-08 06:52:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-08 06:52:35 -0700 |
commit | 97b9ab72cd5ee0cba4692082737266376425f27c (patch) | |
tree | 3061ad5cf5cb7cc81f4e5ee3014597ae1bf4dbab /src | |
parent | 4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443 (diff) |
Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.
Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef*
Make GrEffectRef a typedef for GrEffect.
Committed: https://skia.googlesource.com/skia/+/2011fe9cdfa63b83489a146cea6a724cede352c8
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/377503004
Diffstat (limited to 'src')
36 files changed, 58 insertions, 85 deletions
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp index 8e03a80427..37ba5403c4 100644 --- a/src/core/SkBitmapProcShader.cpp +++ b/src/core/SkBitmapProcShader.cpp @@ -471,7 +471,7 @@ bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/core/SkBitmapProcShader.h b/src/core/SkBitmapProcShader.h index 08e8397a73..550d1d257a 100644 --- a/src/core/SkBitmapProcShader.h +++ b/src/core/SkBitmapProcShader.h @@ -31,7 +31,7 @@ public: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) - bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffectRef**) + bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**) const SK_OVERRIDE; class BitmapProcShaderContext : public SkShader::Context { diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp index 8cf9fc010a..a686f4c412 100644 --- a/src/core/SkColorFilter.cpp +++ b/src/core/SkColorFilter.cpp @@ -40,6 +40,6 @@ SkColor SkColorFilter::filterColor(SkColor c) const { return SkUnPreMultiply::PMColorToColor(dst); } -GrEffectRef* SkColorFilter::asNewEffect(GrContext*) const { +GrEffect* SkColorFilter::asNewEffect(GrContext*) const { return NULL; } diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index b67fbe01e7..dfe74cb74b 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -204,9 +204,8 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top())); this->asNewEffect(&effect, srcTexture, matrix, bounds); SkASSERT(effect); - SkAutoUnref effectRef(effect); GrPaint paint; - paint.addColorEffect(effect); + paint.addColorEffect(effect)->unref(); context->drawRectToRect(paint, dstRect, srcRect); SkAutoTUnref<GrTexture> resultTex(dst.detach()); @@ -299,7 +298,7 @@ bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, return true; } -bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, const SkIRect&) const { +bool SkImageFilter::asNewEffect(GrEffect**, GrTexture*, const SkMatrix&, const SkIRect&) const { return false; } diff --git a/src/core/SkLocalMatrixShader.h b/src/core/SkLocalMatrixShader.h index 1143f062d3..b56cd4726f 100644 --- a/src/core/SkLocalMatrixShader.h +++ b/src/core/SkLocalMatrixShader.h @@ -35,7 +35,7 @@ public: #if SK_SUPPORT_GPU virtual bool asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, - GrColor* grColor, GrEffectRef** grEffect) const SK_OVERRIDE { + GrColor* grColor, GrEffect** grEffect) const SK_OVERRIDE { SkMatrix tmp = fProxyLocalMatrix; if (localMatrix) { tmp.preConcat(*localMatrix); @@ -46,7 +46,7 @@ public: #else virtual bool asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, - GrColor* grColor, GrEffectRef** grEffect) const SK_OVERRIDE { + GrColor* grColor, GrEffect** grEffect) const SK_OVERRIDE { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp index 2ab2843641..a2adc7c327 100644 --- a/src/core/SkMaskFilter.cpp +++ b/src/core/SkMaskFilter.cpp @@ -298,7 +298,7 @@ SkMaskFilter::filterRectsToNine(const SkRect[], int count, const SkMatrix&, } #if SK_SUPPORT_GPU -bool SkMaskFilter::asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix&) const { +bool SkMaskFilter::asNewEffect(GrEffect** effect, GrTexture*, const SkMatrix&) const { return false; } diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 2de8d4d4cb..e154131dcb 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -200,7 +200,7 @@ bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint, #else bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/core/SkPictureShader.h b/src/core/SkPictureShader.h index 294ffcd6b9..4995d268f3 100644 --- a/src/core/SkPictureShader.h +++ b/src/core/SkPictureShader.h @@ -29,7 +29,7 @@ public: SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) - bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffectRef**) + bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**) const SK_OVERRIDE; protected: diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 18fb0d2584..71781ee0d8 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -210,7 +210,7 @@ SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { bool SkShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrixOrNull, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { return false; } @@ -361,7 +361,7 @@ bool SkColorShader::asNewEffect(GrContext* context, const SkPaint& paint, bool SkColorShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index d62602e334..b3e2ed16bf 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -676,12 +676,12 @@ bool SkXfermode::asMode(Mode* mode) const { return false; } -bool SkXfermode::asNewEffect(GrEffectRef** effect, GrTexture* background) const { +bool SkXfermode::asNewEffect(GrEffect** effect, GrTexture* background) const { return false; } bool SkXfermode::AsNewEffectOrCoeff(SkXfermode* xfermode, - GrEffectRef** effect, + GrEffect** effect, Coeff* src, Coeff* dst, GrTexture* background) { diff --git a/src/core/SkXfermode_proccoeff.h b/src/core/SkXfermode_proccoeff.h index 7edf6654a4..b777f62b5c 100644 --- a/src/core/SkXfermode_proccoeff.h +++ b/src/core/SkXfermode_proccoeff.h @@ -31,7 +31,7 @@ public: virtual bool asCoeff(Coeff* sc, Coeff* dc) const SK_OVERRIDE; #if SK_SUPPORT_GPU - virtual bool asNewEffect(GrEffectRef** effect, + virtual bool asNewEffect(GrEffect** effect, GrTexture* background) const SK_OVERRIDE; #endif diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 6fcd2b4351..0bc906dae9 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -24,7 +24,7 @@ protected: virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; #if SK_SUPPORT_GPU - virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, + virtual bool asNewEffect(GrEffect** effect, GrTexture* texture, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE; #endif @@ -248,7 +248,7 @@ SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, } #if SK_SUPPORT_GPU -bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffectRef** effect, GrTexture* texture, +bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffect** effect, GrTexture* texture, const SkMatrix& in_matrix, const SkIRect&) const { if (effect) { GrContext* context = texture->getContext(); diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index 81d70a7ff9..bee3a50f3b 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -87,7 +87,7 @@ public: #endif #if SK_SUPPORT_GPU - virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE; + virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE; #endif SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkModeColorFilter) @@ -409,7 +409,7 @@ GrEffectRef* ModeColorFilterEffect::TestCreate(SkRandom* rand, return ModeColorFilterEffect::Create(color, mode); } -GrEffectRef* SkModeColorFilter::asNewEffect(GrContext*) const { +GrEffect* SkModeColorFilter::asNewEffect(GrContext*) const { if (SkXfermode::kDst_Mode != fMode) { return ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode); } diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp index ae8b905645..4c90f3d4f4 100644 --- a/src/effects/SkLumaColorFilter.cpp +++ b/src/effects/SkLumaColorFilter.cpp @@ -121,7 +121,7 @@ private: } }; -GrEffectRef* SkLumaColorFilter::asNewEffect(GrContext*) const { +GrEffect* SkLumaColorFilter::asNewEffect(GrContext*) const { return LumaColorFilterEffect::Create(); } #endif diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 7f0127ea5a..502cc0764b 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -946,7 +946,7 @@ void GrGLPerlinNoise::setData(const GrGLUniformManager& uman, const GrDrawEffect bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* externalLocalMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkASSERT(NULL != context); *grColor = SkColor2GrColorJustAlpha(paint.getColor()); @@ -1011,7 +1011,7 @@ bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint, bool SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* externalLocalMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 6a9ab10795..771d2fa0d3 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -43,7 +43,7 @@ public: virtual bool asComponentTable(SkBitmap* table) const SK_OVERRIDE; #if SK_SUPPORT_GPU - virtual GrEffectRef* asNewEffect(GrContext* context) const SK_OVERRIDE; + virtual GrEffect* asNewEffect(GrContext* context) const SK_OVERRIDE; #endif virtual void filterSpan(const SkPMColor src[], int count, diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 72b9d4792f..768623a2b0 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -579,7 +579,7 @@ bool SkLinearGradient::asNewEffect(GrContext* context, const SkPaint& paint, bool SkLinearGradient::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/gradients/SkLinearGradient.h b/src/effects/gradients/SkLinearGradient.h index f412a6897d..bb64188251 100644 --- a/src/effects/gradients/SkLinearGradient.h +++ b/src/effects/gradients/SkLinearGradient.h @@ -31,7 +31,7 @@ public: virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE; virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; virtual bool asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, - GrColor* grColor, GrEffectRef** grEffect) const SK_OVERRIDE; + GrColor* grColor, GrEffect** grEffect) const SK_OVERRIDE; SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index f0cb1612b0..38e6f33b38 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -591,7 +591,7 @@ bool SkRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint, bool SkRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/gradients/SkRadialGradient.h b/src/effects/gradients/SkRadialGradient.h index 197c967f4d..ac79a57d52 100644 --- a/src/effects/gradients/SkRadialGradient.h +++ b/src/effects/gradients/SkRadialGradient.h @@ -33,7 +33,7 @@ public: SkMatrix* matrix, TileMode* xy) const SK_OVERRIDE; virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; - virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffectRef**) const SK_OVERRIDE; + virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**) const SK_OVERRIDE; SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRadialGradient) diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 154e3a2f13..3b54ac8ae9 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -310,7 +310,7 @@ bool SkSweepGradient::asNewEffect(GrContext* context, const SkPaint& paint, bool SkSweepGradient::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/gradients/SkSweepGradient.h b/src/effects/gradients/SkSweepGradient.h index 0b12e718ea..7404ac7436 100644 --- a/src/effects/gradients/SkSweepGradient.h +++ b/src/effects/gradients/SkSweepGradient.h @@ -35,7 +35,7 @@ public: virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; - virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffectRef**) + virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**) const SK_OVERRIDE; SK_TO_STRING_OVERRIDE() diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index 4421b90a3a..6678000c90 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -396,7 +396,7 @@ bool SkTwoPointConicalGradient::asNewEffect(GrContext* context, const SkPaint& p bool SkTwoPointConicalGradient::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/gradients/SkTwoPointConicalGradient.h b/src/effects/gradients/SkTwoPointConicalGradient.h index f345d08e31..bff377ee79 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.h +++ b/src/effects/gradients/SkTwoPointConicalGradient.h @@ -66,7 +66,7 @@ public: TileMode* xy) const; virtual SkShader::GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor* grColor, - GrEffectRef**) const SK_OVERRIDE; + GrEffect**) const SK_OVERRIDE; virtual bool isOpaque() const SK_OVERRIDE; SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2); } diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.h b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h index 2b0f0612d7..4471ffc89c 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.h +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h @@ -10,7 +10,7 @@ #include "SkGradientShaderPriv.h" -class GrEffectRef; +class GrEffect; class SkTwoPointConicalGradient; namespace Gr2PtConicalGradientEffect { @@ -18,8 +18,8 @@ namespace Gr2PtConicalGradientEffect { * Creates an effect that produces a two point conical gradient based on the * shader passed in. */ - GrEffectRef* Create(GrContext* ctx, const SkTwoPointConicalGradient& shader, - SkShader::TileMode tm, const SkMatrix* localMatrix); + GrEffect* Create(GrContext* ctx, const SkTwoPointConicalGradient& shader, + SkShader::TileMode tm, const SkMatrix* localMatrix); }; #endif diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index e3d89960c6..3507c891c0 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -712,7 +712,7 @@ bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& pa bool SkTwoPointRadialGradient::asNewEffect(GrContext* context, const SkPaint& paint, const SkMatrix* localMatrix, GrColor* grColor, - GrEffectRef** grEffect) const { + GrEffect** grEffect) const { SkDEBUGFAIL("Should not call in GPU-less build"); return false; } diff --git a/src/effects/gradients/SkTwoPointRadialGradient.h b/src/effects/gradients/SkTwoPointRadialGradient.h index 8916754062..dc3a1553a1 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.h +++ b/src/effects/gradients/SkTwoPointRadialGradient.h @@ -22,7 +22,7 @@ public: TileMode* xy) const SK_OVERRIDE; virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; virtual bool asNewEffect(GrContext* context, const SkPaint&, const SkMatrix*, GrColor*, - GrEffectRef**) const SK_OVERRIDE; + GrEffect**) const SK_OVERRIDE; virtual size_t contextSize() const SK_OVERRIDE; diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index d2c60ea072..de14763a05 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -340,13 +340,13 @@ public: /// the color / coverage distinction. //// - const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) { + const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) { SkASSERT(NULL != effect); SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, attr1)); return effect; } - const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) { + const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, int attr1 = -1) { SkASSERT(NULL != effect); SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1)); return effect; @@ -356,27 +356,23 @@ public: * Creates a GrSimpleTextureEffect that uses local coords as texture coordinates. */ void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); - this->addColorEffect(effect)->unref(); + this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(); } void addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); - this->addCoverageEffect(effect)->unref(); + this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(); } void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix, const GrTextureParams& params) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params); - this->addColorEffect(effect)->unref(); + this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); } void addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix, const GrTextureParams& params) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params); - this->addCoverageEffect(effect)->unref(); + this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); } /** diff --git a/src/gpu/GrEffect.cpp b/src/gpu/GrEffect.cpp index 986e80a57e..f952483562 100644 --- a/src/gpu/GrEffect.cpp +++ b/src/gpu/GrEffect.cpp @@ -59,25 +59,7 @@ int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl /////////////////////////////////////////////////////////////////////////////// -GrEffectRef::~GrEffectRef() { - SkASSERT(this->unique()); - fEffect->EffectRefDestroyed(); - fEffect->unref(); -} - -void* GrEffectRef::operator new(size_t size) { - return GrEffect_Globals::GetTLS()->allocate(size); -} - -void GrEffectRef::operator delete(void* target) { - GrEffect_Globals::GetTLS()->release(target); -} - -/////////////////////////////////////////////////////////////////////////////// - -GrEffect::~GrEffect() { - SkASSERT(NULL == fEffectRef); -} +GrEffect::~GrEffect() {} const char* GrEffect::name() const { return this->getFactory().name(); diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index ddce0ef175..328484bd2d 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -12,27 +12,23 @@ #include "effects/GrSimpleTextureEffect.h" void GrPaint::addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); - this->addColorEffect(effect)->unref(); + this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(); } void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); - this->addCoverageEffect(effect)->unref(); + this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix))->unref(); } void GrPaint::addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix, const GrTextureParams& params) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params); - this->addColorEffect(effect)->unref(); + this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); } void GrPaint::addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix, const GrTextureParams& params) { - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params); - this->addCoverageEffect(effect)->unref(); + this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix, params))->unref(); } bool GrPaint::isOpaque() const { diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h index ced967127f..1a51e89ac8 100644 --- a/src/gpu/effects/GrDashingEffect.h +++ b/src/gpu/effects/GrDashingEffect.h @@ -35,8 +35,8 @@ namespace GrDashingEffect { * Bounding geometry is rendered and the effect computes coverage based on the fragment's * position relative to the dashed line. */ - GrEffectRef* Create(GrEffectEdgeType edgeType, const SkPathEffect::DashInfo& info, - SkScalar strokeWidth, DashCap cap); + GrEffect* Create(GrEffectEdgeType edgeType, const SkPathEffect::DashInfo& info, + SkScalar strokeWidth, DashCap cap); } #endif diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h index 63036c0c7f..88e0a27ae1 100644 --- a/src/gpu/effects/GrDitherEffect.h +++ b/src/gpu/effects/GrDitherEffect.h @@ -11,13 +11,13 @@ #include "GrTypes.h" #include "GrTypesPriv.h" -class GrEffectRef; +class GrEffect; namespace GrDitherEffect { /** * Creates an effect that dithers the resulting color to an RGBA8 framebuffer */ - GrEffectRef* Create(); + GrEffect* Create(); }; #endif diff --git a/src/gpu/effects/GrOvalEffect.h b/src/gpu/effects/GrOvalEffect.h index 796ee5befb..37574ec58c 100644 --- a/src/gpu/effects/GrOvalEffect.h +++ b/src/gpu/effects/GrOvalEffect.h @@ -11,14 +11,14 @@ #include "GrTypes.h" #include "GrTypesPriv.h" -class GrEffectRef; +class GrEffect; struct SkRect; namespace GrOvalEffect { /** * Creates an effect that performs clipping against an oval. */ - GrEffectRef* Create(GrEffectEdgeType, const SkRect&); + GrEffect* Create(GrEffectEdgeType, const SkRect&); }; #endif diff --git a/src/gpu/effects/GrRRectEffect.h b/src/gpu/effects/GrRRectEffect.h index 45ac5f43cf..bcf4884ddd 100644 --- a/src/gpu/effects/GrRRectEffect.h +++ b/src/gpu/effects/GrRRectEffect.h @@ -11,7 +11,7 @@ #include "GrTypes.h" #include "GrTypesPriv.h" -class GrEffectRef; +class GrEffect; class SkRRect; namespace GrRRectEffect { @@ -19,7 +19,7 @@ namespace GrRRectEffect { * Creates an effect that performs anti-aliased clipping against a SkRRect. It doesn't support * all varieties of SkRRect so the caller must check for a NULL return. */ - GrEffectRef* Create(GrEffectEdgeType, const SkRRect&); + GrEffect* Create(GrEffectEdgeType, const SkRRect&); }; #endif diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 1e3810f619..866f4a66b5 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -16,7 +16,7 @@ namespace { class YUVtoRGBEffect : public GrEffect { public: - static GrEffectRef* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture) { + static GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture) { AutoEffectUnref effect(SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture))); return CreateEffectRef(effect); } diff --git a/src/gpu/effects/GrYUVtoRGBEffect.h b/src/gpu/effects/GrYUVtoRGBEffect.h index cc86af7662..150acd5a90 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.h +++ b/src/gpu/effects/GrYUVtoRGBEffect.h @@ -8,14 +8,14 @@ #ifndef GrYUVtoRGBEffect_DEFINED #define GrYUVtoRGBEffect_DEFINED -class GrEffectRef; +class GrEffect; class GrTexture; namespace GrYUVtoRGBEffect { /** * Creates an effect that performs color conversion from YUV to RGB */ - GrEffectRef* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture); + GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture); }; #endif |