Remove GrEffect::CreateEffectRef and GrEffect::AutoEffectRef.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/371103003
This commit is contained in:
bsalomon 2014-07-08 07:34:20 -07:00 committed by Commit bot
parent 97b9ab72cd
commit 55fad7af61
34 changed files with 127 additions and 206 deletions

View File

@ -169,29 +169,7 @@ protected:
, fWillUseInputColor(true)
, fHasVertexCode(false) {}
/** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for
an example factory function. */
static GrEffect* CreateEffectRef(GrEffect* effect) {
return SkRef(effect);
}
static const GrEffect* CreateEffectRef(const GrEffect* effect) {
return CreateEffectRef(const_cast<GrEffect*>(effect));
}
/** Helper used in subclass factory functions to unref the effect after it has been wrapped in a
GrEffectRef. E.g.:
class EffectSubclass : public GrEffect {
public:
GrEffectRef* Create(ParamType1 param1, ParamType2 param2, ...) {
AutoEffectUnref effect(SkNEW_ARGS(EffectSubclass, (param1, param2, ...)));
return CreateEffectRef(effect);
}
*/
typedef SkAutoTUnref<GrEffect> AutoEffectUnref;
/** Helper for getting the GrEffect out of a GrEffectRef and down-casting to a GrEffect subclass
/** Helper for down-casting to a GrEffect subclass
*/
template <typename T>
static const T& CastEffect(const GrEffect& effectRef) {

View File

@ -797,8 +797,7 @@ public:
if (!IsSupportedMode(mode)) {
return NULL;
} else {
AutoEffectUnref effect(SkNEW_ARGS(XferEffect, (mode, background)));
return CreateEffectRef(effect);
return SkNEW_ARGS(XferEffect, (mode, background));
}
}
@ -1230,8 +1229,7 @@ GrEffectRef* XferEffect::TestCreate(SkRandom* rand,
GrTexture*[]) {
int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
AutoEffectUnref gEffect(SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL)));
return CreateEffectRef(gEffect);
return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL));
}
#endif

View File

@ -60,11 +60,10 @@ public:
GrTexture* maskTexture,
float innerThreshold,
float outerThreshold) {
AutoEffectUnref effect(SkNEW_ARGS(AlphaThresholdEffect, (texture,
maskTexture,
innerThreshold,
outerThreshold)));
return CreateEffectRef(effect);
return SkNEW_ARGS(AlphaThresholdEffect, (texture,
maskTexture,
innerThreshold,
outerThreshold));
}
virtual ~AlphaThresholdEffect() {};

View File

@ -264,9 +264,7 @@ class GrArithmeticEffect : public GrEffect {
public:
static GrEffectRef* Create(float k1, float k2, float k3, float k4, bool enforcePMColor,
GrTexture* background) {
AutoEffectUnref effect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor,
background)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, background));
}
virtual ~GrArithmeticEffect();
@ -422,9 +420,7 @@ GrEffectRef* GrArithmeticEffect::TestCreate(SkRandom* rand,
float k4 = rand->nextF();
bool enforcePMColor = rand->nextBool();
AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect,
(k1, k2, k3, k4, enforcePMColor, NULL)));
return CreateEffectRef(gEffect);
return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, NULL));
}
GR_DEFINE_EFFECT_TEST(GrArithmeticEffect);

View File

@ -572,8 +572,7 @@ public:
if (!createdBlurProfileTexture) {
return NULL;
}
AutoEffectUnref effect(SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture));
}
const SkRect& getRect() const { return fRect; }
@ -914,8 +913,7 @@ GrEffectRef* GrRRectBlurEffect::Create(GrContext* context, float sigma, const Sk
return NULL;
}
return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrRRectBlurEffect,
(sigma, rrect, blurNinePatchTexture))));
return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture));
}
void GrRRectBlurEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {

View File

@ -195,8 +195,7 @@ public:
SkDebugf("Failing to create color filter for mode %d\n", mode);
return NULL;
}
AutoEffectUnref effect(SkNEW_ARGS(ModeColorFilterEffect, (c, mode)));
return CreateEffectRef(effect);
return SkNEW_ARGS(ModeColorFilterEffect, (c, mode));
}
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;

View File

@ -331,8 +331,7 @@ bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const {
class ColorMatrixEffect : public GrEffect {
public:
static GrEffectRef* Create(const SkColorMatrix& matrix) {
AutoEffectUnref effect(SkNEW_ARGS(ColorMatrixEffect, (matrix)));
return CreateEffectRef(effect);
return SkNEW_ARGS(ColorMatrixEffect, (matrix));
}
static const char* Name() { return "Color Matrix"; }

View File

@ -305,13 +305,12 @@ public:
SkVector scale,
GrTexture* displacement, const SkMatrix& offsetMatrix,
GrTexture* color) {
AutoEffectUnref effect(SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
yChannelSelector,
scale,
displacement,
offsetMatrix,
color)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
yChannelSelector,
scale,
displacement,
offsetMatrix,
color));
}
virtual ~GrDisplacementMapEffect();

View File

@ -339,12 +339,11 @@ public:
SkScalar surfaceScale,
const SkMatrix& matrix,
SkScalar kd) {
AutoEffectUnref effect(SkNEW_ARGS(GrDiffuseLightingEffect, (texture,
light,
surfaceScale,
matrix,
kd)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrDiffuseLightingEffect, (texture,
light,
surfaceScale,
matrix,
kd));
}
static const char* Name() { return "DiffuseLighting"; }
@ -376,13 +375,12 @@ public:
const SkMatrix& matrix,
SkScalar ks,
SkScalar shininess) {
AutoEffectUnref effect(SkNEW_ARGS(GrSpecularLightingEffect, (texture,
light,
surfaceScale,
matrix,
ks,
shininess)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrSpecularLightingEffect, (texture,
light,
surfaceScale,
matrix,
ks,
shininess));
}
static const char* Name() { return "SpecularLighting"; }

View File

@ -61,8 +61,8 @@ void SkLumaColorFilter::toString(SkString* str) const {
class LumaColorFilterEffect : public GrEffect {
public:
static GrEffectRef* Create() {
AutoEffectUnref effect(SkNEW(LumaColorFilterEffect));
return CreateEffectRef(effect);
GR_CREATE_STATIC_EFFECT(gLumaEffect, LumaColorFilterEffect, ());
return SkRef(gLumaEffect);
}
static const char* Name() { return "Luminance-to-Alpha"; }

View File

@ -32,14 +32,13 @@ public:
float yInvZoom,
float xInvInset,
float yInvInset) {
AutoEffectUnref effect(SkNEW_ARGS(GrMagnifierEffect, (texture,
xOffset,
yOffset,
xInvZoom,
yInvZoom,
xInvInset,
yInvInset)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrMagnifierEffect, (texture,
xOffset,
yOffset,
xInvZoom,
yInvZoom,
xInvInset,
yInvInset));
}
virtual ~GrMagnifierEffect() {};

View File

@ -339,16 +339,15 @@ public:
const SkIPoint& kernelOffset,
TileMode tileMode,
bool convolveAlpha) {
AutoEffectUnref effect(SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
bounds,
kernelSize,
kernel,
gain,
bias,
kernelOffset,
tileMode,
convolveAlpha)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
bounds,
kernelSize,
kernel,
gain,
bias,
kernelOffset,
tileMode,
convolveAlpha));
}
virtual ~GrMatrixConvolutionEffect();

View File

@ -279,8 +279,7 @@ public:
};
static GrEffectRef* Create(GrTexture* tex, Direction dir, int radius, MorphologyType type) {
AutoEffectUnref effect(SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type));
}
virtual ~GrMorphologyEffect();

View File

@ -530,9 +530,8 @@ public:
SkPerlinNoiseShader::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* noiseTexture,
const SkMatrix& matrix, uint8_t alpha) {
AutoEffectUnref effect(SkNEW_ARGS(GrPerlinNoiseEffect, (type, numOctaves,
stitchTiles, paintingData, permutationsTexture, noiseTexture, matrix, alpha)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrPerlinNoiseEffect, (type, numOctaves, stitchTiles, paintingData,
permutationsTexture, noiseTexture, matrix, alpha));
}
virtual ~GrPerlinNoiseEffect() {

View File

@ -237,8 +237,7 @@ class GLColorTableEffect;
class ColorTableEffect : public GrEffect {
public:
static GrEffectRef* Create(GrTexture* texture, unsigned flags) {
AutoEffectUnref effect(SkNEW_ARGS(ColorTableEffect, (texture, flags)));
return CreateEffectRef(effect);
return SkNEW_ARGS(ColorTableEffect, (texture, flags));
}
virtual ~ColorTableEffect();

View File

@ -484,8 +484,7 @@ public:
const SkLinearGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
AutoEffectUnref effect(SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm));
}
virtual ~GrLinearGradient() { }

View File

@ -493,8 +493,7 @@ public:
const SkRadialGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
AutoEffectUnref effect(SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm));
}
virtual ~GrRadialGradient() { }

View File

@ -208,8 +208,7 @@ public:
static GrEffectRef* Create(GrContext* ctx,
const SkSweepGradient& shader,
const SkMatrix& matrix) {
AutoEffectUnref effect(SkNEW_ARGS(GrSweepGradient, (ctx, shader, matrix)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrSweepGradient, (ctx, shader, matrix));
}
virtual ~GrSweepGradient() { }

View File

@ -63,8 +63,7 @@ public:
const SkTwoPointConicalGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
AutoEffectUnref effect(SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm)));
return CreateEffectRef(effect);
return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm));
}
virtual ~Edge2PtConicalEffect() {}
@ -371,8 +370,7 @@ public:
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
AutoEffectUnref effect(SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm, focalX)));
return CreateEffectRef(effect);
return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
}
virtual ~FocalOutside2PtConicalEffect() { }
@ -586,8 +584,7 @@ public:
const SkMatrix& matrix,
SkShader::TileMode tm,
SkScalar focalX) {
AutoEffectUnref effect(SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm, focalX)));
return CreateEffectRef(effect);
return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
}
virtual ~FocalInside2PtConicalEffect() {}
@ -820,8 +817,7 @@ public:
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
AutoEffectUnref effect(SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm, info)));
return CreateEffectRef(effect);
return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm, info));
}
virtual ~CircleInside2PtConicalEffect() {}
@ -1033,8 +1029,7 @@ public:
const SkMatrix& matrix,
SkShader::TileMode tm,
const CircleConicalInfo& info) {
AutoEffectUnref effect(SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, tm, info)));
return CreateEffectRef(effect);
return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, tm, info));
}
virtual ~CircleOutside2PtConicalEffect() {}

View File

@ -438,8 +438,7 @@ public:
const SkTwoPointRadialGradient& shader,
const SkMatrix& matrix,
SkShader::TileMode tm) {
AutoEffectUnref effect(SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm)));
return CreateEffectRef(effect);
return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm));
}
virtual ~GrRadial2Gradient() { }

View File

@ -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));
}
/**

View File

@ -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));
}
}

View File

@ -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,

View File

@ -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));
}
/**

View File

@ -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();

View File

@ -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() {}

View File

@ -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() {}

View File

@ -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() {}

View File

@ -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() {};

View File

@ -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 {

View File

@ -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 {

View File

@ -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() {}

View File

@ -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));
}
}

View File

@ -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"; }