diff options
author | 2014-07-08 07:34:20 -0700 | |
---|---|---|
committer | 2014-07-08 07:34:21 -0700 | |
commit | 55fad7af61c21d502acb9891d631e8aa29e3628c (patch) | |
tree | 36a2e6b6aace85ff67b4d6e6ad9aedf53707aeb7 /src/gpu | |
parent | 97b9ab72cd5ee0cba4692082737266376425f27c (diff) |
Remove GrEffect::CreateEffectRef and GrEffect::AutoEffectRef.
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/371103003
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/effects/GrBicubicEffect.h | 13 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.cpp | 48 | ||||
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.h | 3 | ||||
-rw-r--r-- | src/gpu/effects/GrConvolutionEffect.h | 26 | ||||
-rw-r--r-- | src/gpu/effects/GrCustomCoordsTextureEffect.h | 3 | ||||
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrDistanceFieldTextureEffect.h | 18 | ||||
-rw-r--r-- | src/gpu/effects/GrDitherEffect.cpp | 3 | ||||
-rw-r--r-- | src/gpu/effects/GrOvalEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrRRectEffect.cpp | 5 | ||||
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.h | 11 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureDomain.cpp | 14 | ||||
-rw-r--r-- | src/gpu/effects/GrYUVtoRGBEffect.cpp | 3 |
14 files changed, 66 insertions, 95 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 1998e68780..eea4d4e883 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -44,10 +44,8 @@ public: SkShader::kClamp_TileMode }; return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), kTileModes); } else { - AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, - MakeDivByTextureWHMatrix(tex), - *domain))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, + MakeDivByTextureWHMatrix(tex), *domain)); } } @@ -65,17 +63,14 @@ public: */ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16], const SkMatrix& matrix, const SkShader::TileMode tileModes[2]) { - AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes)); } /** * Create a Mitchell filter effect with a texture matrix and a domain. */ static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const SkRect& domain) { - AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix, - domain))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix, domain)); } /** diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index f33ad239c5..260008c1e5 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -129,12 +129,11 @@ GrEffectRef* GrConfigConversionEffect::TestCreate(SkRandom* random, } else { swapRB = random->nextBool(); } - AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, + return SkNEW_ARGS(GrConfigConversionEffect, (textures[GrEffectUnitTest::kSkiaPMTextureIdx], swapRB, pmConv, - GrEffectUnitTest::TestMatrix(random)))); - return CreateEffectRef(effect); + GrEffectUnitTest::TestMatrix(random))); } /////////////////////////////////////////////////////////////////////////////// @@ -200,38 +199,34 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context // from readTex to tempTex followed by a PM->UPM draw to readTex and finally read the data. // We then verify that two reads produced the same values. - AutoEffectUnref pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex, - false, - *pmToUPMRule, - SkMatrix::I()))); - AutoEffectUnref upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex, - false, - *upmToPMRule, - SkMatrix::I()))); - AutoEffectUnref pmToUPM2(SkNEW_ARGS(GrConfigConversionEffect, (tempTex, - false, - *pmToUPMRule, - SkMatrix::I()))); - - SkAutoTUnref<GrEffectRef> pmToUPMEffect1(CreateEffectRef(pmToUPM1)); - SkAutoTUnref<GrEffectRef> upmToPMEffect(CreateEffectRef(upmToPM)); - SkAutoTUnref<GrEffectRef> pmToUPMEffect2(CreateEffectRef(pmToUPM2)); + SkAutoTUnref<GrEffect> pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex, + false, + *pmToUPMRule, + SkMatrix::I()))); + SkAutoTUnref<GrEffect> upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex, + false, + *upmToPMRule, + SkMatrix::I()))); + SkAutoTUnref<GrEffect> pmToUPM2(SkNEW_ARGS(GrConfigConversionEffect, (tempTex, + false, + *pmToUPMRule, + SkMatrix::I()))); context->setRenderTarget(readTex->asRenderTarget()); GrPaint paint1; - paint1.addColorEffect(pmToUPMEffect1); + paint1.addColorEffect(pmToUPM1); context->drawRectToRect(paint1, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead); context->setRenderTarget(tempTex->asRenderTarget()); GrPaint paint2; - paint2.addColorEffect(upmToPMEffect); + paint2.addColorEffect(upmToPM); context->drawRectToRect(paint2, kDstRect, kSrcRect); context->setRenderTarget(readTex->asRenderTarget()); GrPaint paint3; - paint3.addColorEffect(pmToUPMEffect2); + paint3.addColorEffect(pmToUPM2); context->drawRectToRect(paint3, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead); @@ -268,10 +263,9 @@ const GrEffectRef* GrConfigConversionEffect::Create(GrTexture* texture, // The PM conversions assume colors are 0..255 return NULL; } - AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, - swapRedAndBlue, - pmConversion, - matrix))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrConfigConversionEffect, (texture, + swapRedAndBlue, + pmConversion, + matrix)); } } diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index d24b45e10b..aebd5b0b89 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -25,7 +25,7 @@ public: static const char* Name() { return "AARect"; } static GrEffectRef* Create(GrEffectEdgeType edgeType, const SkRect& rect) { - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(AARectEffect, (edgeType, rect)))); + return SkNEW_ARGS(AARectEffect, (edgeType, rect)); } virtual void getConstantColorComponents(GrColor* color, diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h index 0e508c7c48..1a00f12d8a 100644 --- a/src/gpu/effects/GrConvexPolyEffect.h +++ b/src/gpu/effects/GrConvexPolyEffect.h @@ -41,8 +41,7 @@ public: if (n <= 0 || n > kMaxEdges || kHairlineAA_GrEffectEdgeType == edgeType) { return NULL; } - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrConvexPolyEffect, - (edgeType, n, edges)))); + return SkNEW_ARGS(GrConvexPolyEffect, (edgeType, n, edges)); } /** diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index 56a54b4a6a..77c2d347c6 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -28,13 +28,12 @@ public: const float* kernel, bool useBounds, float bounds[2]) { - AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex, - dir, - halfWidth, - kernel, - useBounds, - bounds))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrConvolutionEffect, (tex, + dir, + halfWidth, + kernel, + useBounds, + bounds)); } /// Convolve with a Gaussian kernel @@ -44,13 +43,12 @@ public: float gaussianSigma, bool useBounds, float bounds[2]) { - AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex, - dir, - halfWidth, - gaussianSigma, - useBounds, - bounds))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrConvolutionEffect, (tex, + dir, + halfWidth, + gaussianSigma, + useBounds, + bounds)); } virtual ~GrConvolutionEffect(); diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.h b/src/gpu/effects/GrCustomCoordsTextureEffect.h index 1caecf2f6d..5dc830aed1 100644 --- a/src/gpu/effects/GrCustomCoordsTextureEffect.h +++ b/src/gpu/effects/GrCustomCoordsTextureEffect.h @@ -21,8 +21,7 @@ class GrGLCustomCoordsTextureEffect; class GrCustomCoordsTextureEffect : public GrVertexEffect { public: static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { - AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p)); } virtual ~GrCustomCoordsTextureEffect() {} diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index e46cc040c7..fb58b84bc3 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -563,8 +563,7 @@ GrEffectRef* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashIn return NULL; } - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingCircleEffect, - (edgeType, info, radius)))); + return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius)); } DashingCircleEffect::~DashingCircleEffect() {} @@ -782,8 +781,7 @@ GrEffectRef* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo return NULL; } - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingLineEffect, - (edgeType, info, strokeWidth)))); + return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth)); } DashingLineEffect::~DashingLineEffect() {} diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h index 692290ccdb..b2e21b2895 100644 --- a/src/gpu/effects/GrDistanceFieldTextureEffect.h +++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h @@ -26,17 +26,15 @@ public: static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params, GrTexture* gamma, const GrTextureParams& gammaParams, float lum, bool similarity) { - AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, - gamma, gammaParams, lum, - similarity))); + return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, gamma, gammaParams, lum, + similarity)); + } #else static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params, bool similarity) { - AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, - similarity))); -#endif - return CreateEffectRef(effect); + return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, similarity)); } +#endif virtual ~GrDistanceFieldTextureEffect() {} @@ -85,10 +83,8 @@ public: GrTexture* gamma, const GrTextureParams& gammaParams, SkColor textColor, bool uniformScale, bool useBGR) { - AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, - (tex, params, gamma, gammaParams, textColor, uniformScale, - useBGR))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, + (tex, params, gamma, gammaParams, textColor, uniformScale, useBGR)); } virtual ~GrDistanceFieldLCDTextureEffect() {} diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 7409e5ff71..1db61ba146 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -20,7 +20,8 @@ class GLDitherEffect; class DitherEffect : public GrEffect { public: static GrEffectRef* Create() { - return CreateEffectRef(AutoEffectUnref(SkNEW(DitherEffect))); + GR_CREATE_STATIC_EFFECT(gDitherEffect, DitherEffect, ()) + return SkRef(gDitherEffect); } virtual ~DitherEffect() {}; diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index f2ee27880f..678abd0c38 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -53,8 +53,7 @@ GrEffectRef* CircleEffect::Create(GrEffectEdgeType edgeType, const SkPoint& center, SkScalar radius) { SkASSERT(radius >= 0); - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircleEffect, - (edgeType, center, radius)))); + return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); } void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { @@ -225,8 +224,7 @@ GrEffectRef* EllipseEffect::Create(GrEffectEdgeType edgeType, SkScalar rx, SkScalar ry) { SkASSERT(rx >= 0 && ry >= 0); - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipseEffect, - (edgeType, center, rx, ry)))); + return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); } void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index 11d8a18e61..33291ed5b3 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -81,8 +81,7 @@ GrEffectRef* CircularRRectEffect::Create(GrEffectEdgeType edgeType, if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) { return NULL; } - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircularRRectEffect, - (edgeType, circularCornerFlags, rrect)))); + return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect)); } void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { @@ -416,7 +415,7 @@ GrEffectRef* EllipticalRRectEffect::Create(GrEffectEdgeType edgeType, const SkRR if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) { return NULL; } - return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)))); + return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); } void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index c326ccf4c8..fea18e5eeb 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -26,8 +26,8 @@ public: static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, GrCoordSet coordSet = kLocal_GrCoordSet) { - AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordSet))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, + coordSet)); } /* clamp mode */ @@ -35,17 +35,14 @@ public: const SkMatrix& matrix, GrTextureParams::FilterMode filterMode, GrCoordSet coordSet = kLocal_GrCoordSet) { - AutoEffectUnref effect( - SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet)); } static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const GrTextureParams& p, GrCoordSet coordSet = kLocal_GrCoordSet) { - AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet))); - return CreateEffectRef(effect); + return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)); } virtual ~GrSimpleTextureEffect() {} diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 656000b059..cb2ad5f5da 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -208,14 +208,12 @@ GrEffectRef* GrTextureDomainEffect::Create(GrTexture* texture, return GrSimpleTextureEffect::Create(texture, matrix, filterMode); } else { - AutoEffectUnref effect(SkNEW_ARGS(GrTextureDomainEffect, (texture, - matrix, - domain, - mode, - filterMode, - coordSet))); - return CreateEffectRef(effect); - + return SkNEW_ARGS(GrTextureDomainEffect, (texture, + matrix, + domain, + mode, + filterMode, + coordSet)); } } diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 866f4a66b5..539b4ac186 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -17,8 +17,7 @@ namespace { class YUVtoRGBEffect : public GrEffect { public: static GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture) { - AutoEffectUnref effect(SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture))); - return CreateEffectRef(effect); + return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture)); } static const char* Name() { return "YUV to RGB"; } |