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
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index c26bc07..25e6bbe 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -15,7 +15,7 @@
#include "SkXfermode.h"
class SkBitmap;
-class GrEffectRef;
+class GrEffect;
class GrContext;
/**
@@ -126,7 +126,7 @@
/** A subclass may implement this factory function to work with the GPU backend. If the return
is non-NULL then the caller owns a ref on the returned object.
*/
- virtual GrEffectRef* asNewEffect(GrContext*) const;
+ virtual GrEffect* asNewEffect(GrContext*) const;
SK_TO_STRING_PUREVIRT()
diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h
index 8603577..ba17f6c 100644
--- a/include/core/SkColorShader.h
+++ b/include/core/SkColorShader.h
@@ -58,7 +58,7 @@
virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrix, GrColor* grColor,
- GrEffectRef** grEffect) const SK_OVERRIDE;
+ GrEffect** grEffect) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 15e9a2f..012a7f7 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -16,7 +16,7 @@
class SkColorFilter;
class SkBaseDevice;
struct SkIPoint;
-class GrEffectRef;
+class GrEffect;
class GrTexture;
/**
@@ -282,7 +282,7 @@
* will be called with (NULL, NULL, SkMatrix::I()) to query for support,
* so returning "true" indicates support for all possible matrices.
*/
- virtual bool asNewEffect(GrEffectRef** effect,
+ virtual bool asNewEffect(GrEffect** effect,
GrTexture*,
const SkMatrix& matrix,
const SkIRect& bounds) const;
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index 72f20af..3992512 100644
--- a/include/core/SkMaskFilter.h
+++ b/include/core/SkMaskFilter.h
@@ -72,7 +72,7 @@
* If effect is non-NULL, a new GrEffect instance is stored in it. The caller assumes ownership
* of the effect and must unref it.
*/
- virtual bool asNewEffect(GrEffectRef** effect,
+ virtual bool asNewEffect(GrEffect** effect,
GrTexture*,
const SkMatrix& ctm) const;
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 31f57cc..2ed91f8 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -20,7 +20,7 @@
class SkPicture;
class SkXfermode;
class GrContext;
-class GrEffectRef;
+class GrEffect;
/** \class SkShader
*
@@ -384,7 +384,7 @@
*/
virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
const SkMatrix* localMatrixOrNull, GrColor* grColor,
- GrEffectRef** grEffect) const;
+ GrEffect** grEffect) const;
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
/**
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index c0a6572..74fd9f8 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -13,7 +13,7 @@
#include "SkFlattenable.h"
#include "SkColor.h"
-class GrEffectRef;
+class GrEffect;
class GrTexture;
class SkString;
@@ -198,7 +198,7 @@
fragment shader. If NULL, the effect should request access to destination color
(setWillReadDstColor()), and use that in the fragment shader (builder->dstColor()).
*/
- virtual bool asNewEffect(GrEffectRef** effect, GrTexture* background = NULL) const;
+ virtual bool asNewEffect(GrEffect** effect, GrTexture* background = NULL) const;
/** Returns true if the xfermode can be expressed as coeffs (src, dst), or as an effect
(effect). This helper calls the asCoeff() and asNewEffect() virtuals. If the xfermode is
@@ -206,7 +206,7 @@
simply test the return value. effect, src, and dst must all be NULL or all non-NULL.
*/
static bool AsNewEffectOrCoeff(SkXfermode*,
- GrEffectRef** effect,
+ GrEffect** effect,
Coeff* src,
Coeff* dst,
GrTexture* background = NULL);
diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h
index 5cfa468..edbe07d 100644
--- a/include/effects/SkColorMatrixFilter.h
+++ b/include/effects/SkColorMatrixFilter.h
@@ -26,7 +26,7 @@
virtual uint32_t getFlags() const SK_OVERRIDE;
virtual bool asColorMatrix(SkScalar matrix[20]) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
- virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE;
+ virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE;
#endif
struct State {
diff --git a/include/effects/SkLumaColorFilter.h b/include/effects/SkLumaColorFilter.h
index f2cee29..06eb01a 100644
--- a/include/effects/SkLumaColorFilter.h
+++ b/include/effects/SkLumaColorFilter.h
@@ -28,7 +28,7 @@
virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
- virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE;
+ virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE;
#endif
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkMagnifierImageFilter.h b/include/effects/SkMagnifierImageFilter.h
index 9d8a9b6..b992e28 100644
--- a/include/effects/SkMagnifierImageFilter.h
+++ b/include/effects/SkMagnifierImageFilter.h
@@ -28,7 +28,8 @@
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, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
+ virtual bool asNewEffect(GrEffect** effect, GrTexture* texture, const SkMatrix& matrix,
+ const SkIRect& bounds) const SK_OVERRIDE;
#endif
private:
diff --git a/include/effects/SkMatrixConvolutionImageFilter.h b/include/effects/SkMatrixConvolutionImageFilter.h
index 606de57..6d4c826 100644
--- a/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/include/effects/SkMatrixConvolutionImageFilter.h
@@ -86,7 +86,7 @@
#if SK_SUPPORT_GPU
- virtual bool asNewEffect(GrEffectRef** effect,
+ virtual bool asNewEffect(GrEffect** effect,
GrTexture*,
const SkMatrix& ctm,
const SkIRect& bounds) const SK_OVERRIDE;
diff --git a/include/effects/SkPerlinNoiseShader.h b/include/effects/SkPerlinNoiseShader.h
index 2d9dfdd..3355925 100644
--- a/include/effects/SkPerlinNoiseShader.h
+++ b/include/effects/SkPerlinNoiseShader.h
@@ -97,7 +97,7 @@
};
virtual bool asNewEffect(GrContext* context, const SkPaint&, const SkMatrix*, GrColor*,
- GrEffectRef**) const SK_OVERRIDE;
+ GrEffect**) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader)
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendEffectFactory.h
index 0fc981c..af8d5c7 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendEffectFactory.h
@@ -23,7 +23,6 @@
of GrGLEffect.
*/
-class GrEffectRef;
class GrGLEffect;
class GrGLCaps;
class GrDrawEffect;
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index 5fed532..978ad3a 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -21,66 +21,17 @@
class GrVertexEffect;
class SkString;
-/**
- * A Wrapper class for GrEffect. Its ref-count will track owners that may use effects to enqueue
- * new draw operations separately from ownership within a deferred drawing queue. When the
- * GrEffectRef ref count reaches zero the scratch GrResources owned by the effect can be recycled
- * in service of later draws. However, the deferred draw queue may still own direct references to
- * the underlying GrEffect.
- *
- * GrEffectRefs created by new are placed in a per-thread managed pool. The pool is destroyed when
- * the thread ends. Therefore, all dynamically allocated GrEffectRefs must be unreffed before thread
- * termination.
- */
-class GrEffectRef : public SkRefCnt {
-public:
- SK_DECLARE_INST_COUNT(GrEffectRef);
- virtual ~GrEffectRef();
-
- GrEffect* get() { return fEffect; }
- const GrEffect* get() const { return fEffect; }
-
- const GrEffect* operator-> () { return fEffect; }
- const GrEffect* operator-> () const { return fEffect; }
-
- void* operator new(size_t size);
- void operator delete(void* target);
-
- void* operator new(size_t size, void* placement) {
- return ::operator new(size, placement);
- }
- void operator delete(void* target, void* placement) {
- ::operator delete(target, placement);
- }
-
-private:
- friend class GrEffect; // to construct these
-
- explicit GrEffectRef(GrEffect* effect);
-
- GrEffect* fEffect;
-
- typedef SkRefCnt INHERITED;
-};
-
/** Provides custom vertex shader, fragment shader, uniform data for a particular stage of the
Ganesh shading pipeline.
Subclasses must have a function that produces a human-readable name:
static const char* Name();
GrEffect objects *must* be immutable: after being constructed, their fields may not change.
- GrEffect subclass objects should be created by factory functions that return GrEffectRef.
- There is no public way to wrap a GrEffect in a GrEffectRef. Thus, a factory should be a static
- member function of a GrEffect subclass.
-
- Because almost no code should ever handle a GrEffect directly outside of a GrEffectRef, we
- privately inherit from SkRefCnt to help prevent accidental direct ref'ing/unref'ing of effects.
-
- Dynamically allocated GrEffects and their corresponding GrEffectRefs are managed by a per-thread
- memory pool. The ref count of an effect must reach 0 before the thread terminates and the pool
- is destroyed. To create a static effect use the macro GR_CREATE_STATIC_EFFECT declared below.
+ Dynamically allocated GrEffects are managed by a per-thread memory pool. The ref count of an
+ effect must reach 0 before the thread terminates and the pool is destroyed. To create a static
+ effect use the macro GR_CREATE_STATIC_EFFECT declared below.
*/
-class GrEffect : private SkRefCnt {
+class GrEffect : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrEffect)
@@ -124,8 +75,17 @@
computed by the GrBackendEffectFactory:
effectA.getFactory().glEffectKey(effectA) == effectB.getFactory().glEffectKey(effectB).
*/
- bool isEqual(const GrEffectRef& other) const {
- return this->isEqual(*other.get());
+ bool isEqual(const GrEffect& other) const {
+ if (&this->getFactory() != &other.getFactory()) {
+ return false;
+ }
+ bool result = this->onIsEqual(other);
+#ifdef SK_DEBUG
+ if (result) {
+ this->assertEquality(other);
+ }
+#endif
+ return result;
}
/** Human-meaningful string to identify this effect; may be embedded
@@ -185,24 +145,6 @@
::operator delete(target, placement);
}
- /** These functions are used when recording effects into a deferred drawing queue. The inc call
- keeps the effect alive outside of GrEffectRef while allowing any resources owned by the
- effect to be returned to the cache for reuse. The dec call must balance the inc call. */
- void incDeferredRefCounts() const {
- this->ref();
- int count = fTextureAccesses.count();
- for (int t = 0; t < count; ++t) {
- fTextureAccesses[t]->getTexture()->incDeferredRefCount();
- }
- }
- void decDeferredRefCounts() const {
- int count = fTextureAccesses.count();
- for (int t = 0; t < count; ++t) {
- fTextureAccesses[t]->getTexture()->decDeferredRefCount();
- }
- this->unref();
- }
-
protected:
/**
* Subclasses call this from their constructor to register coordinate transformations. The
@@ -225,32 +167,18 @@
: fWillReadDstColor(false)
, fWillReadFragmentPosition(false)
, fWillUseInputColor(true)
- , fHasVertexCode(false)
- , fEffectRef(NULL) {}
+ , fHasVertexCode(false) {}
/** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for
an example factory function. */
- static GrEffectRef* CreateEffectRef(GrEffect* effect) {
- if (NULL == effect->fEffectRef) {
- effect->fEffectRef = SkNEW_ARGS(GrEffectRef, (effect));
- } else {
- effect->fEffectRef->ref();
- }
- return effect->fEffectRef;
+ static GrEffect* CreateEffectRef(GrEffect* effect) {
+ return SkRef(effect);
}
- static const GrEffectRef* CreateEffectRef(const GrEffect* effect) {
+ static const GrEffect* CreateEffectRef(const GrEffect* effect) {
return CreateEffectRef(const_cast<GrEffect*>(effect));
}
- /** Used by GR_CREATE_STATIC_EFFECT below */
- static GrEffectRef* CreateStaticEffectRef(void* refStorage, GrEffect* effect) {
- SkASSERT(NULL == effect->fEffectRef);
- effect->fEffectRef = SkNEW_PLACEMENT_ARGS(refStorage, GrEffectRef, (effect));
- return effect->fEffectRef;
- }
-
-
/** Helper used in subclass factory functions to unref the effect after it has been wrapped in a
GrEffectRef. E.g.:
@@ -261,14 +189,7 @@
return CreateEffectRef(effect);
}
*/
- class AutoEffectUnref {
- public:
- AutoEffectUnref(GrEffect* effect) : fEffect(effect) { }
- ~AutoEffectUnref() { fEffect->unref(); }
- operator GrEffect*() { return fEffect; }
- private:
- GrEffect* fEffect;
- };
+ typedef SkAutoTUnref<GrEffect> AutoEffectUnref;
/** Helper for getting the GrEffect out of a GrEffectRef and down-casting to a GrEffect subclass
*/
@@ -299,19 +220,6 @@
void setWillNotUseInputColor() { fWillUseInputColor = false; }
private:
- bool isEqual(const GrEffect& other) const {
- if (&this->getFactory() != &other.getFactory()) {
- return false;
- }
- bool result = this->onIsEqual(other);
-#ifdef SK_DEBUG
- if (result) {
- this->assertEquality(other);
- }
-#endif
- return result;
- }
-
SkDEBUGCODE(void assertEquality(const GrEffect& other) const;)
/** Subclass implements this to support isEqual(). It will only be called if it is known that
@@ -319,12 +227,6 @@
getFactory()).*/
virtual bool onIsEqual(const GrEffect& other) const = 0;
- void EffectRefDestroyed() { fEffectRef = NULL; }
-
- friend class GrEffectRef; // to call EffectRefDestroyed()
- friend class GrEffectStage; // to rewrap GrEffect in GrEffectRef when restoring an effect-stage
- // from deferred state, to call isEqual on naked GrEffects, and
- // to inc/dec deferred ref counts.
friend class GrVertexEffect; // to set fHasVertexCode and build fVertexAttribTypes.
SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
@@ -334,32 +236,20 @@
bool fWillReadFragmentPosition;
bool fWillUseInputColor;
bool fHasVertexCode;
- GrEffectRef* fEffectRef;
typedef SkRefCnt INHERITED;
};
-inline GrEffectRef::GrEffectRef(GrEffect* effect) {
- SkASSERT(NULL != effect);
- effect->ref();
- fEffect = effect;
-}
+typedef GrEffect GrEffectRef;
/**
* This creates an effect outside of the effect memory pool. The effect's destructor will be called
- * at global destruction time. NAME will be the name of the created GrEffectRef.
+ * at global destruction time. NAME will be the name of the created GrEffect.
*/
#define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS) \
-enum { \
- k_##NAME##_EffectRefOffset = GR_CT_ALIGN_UP(sizeof(EFFECT_CLASS), 8), \
- k_##NAME##_StorageSize = k_##NAME##_EffectRefOffset + sizeof(GrEffectRef) \
-}; \
-static SkAlignedSStorage<k_##NAME##_StorageSize> g_##NAME##_Storage; \
-static void* NAME##_RefLocation = (char*)g_##NAME##_Storage.get() + k_##NAME##_EffectRefOffset; \
-static GrEffect* NAME##_Effect SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLASS, ARGS);\
-static SkAutoTDestroy<GrEffect> NAME##_ad(NAME##_Effect); \
-static GrEffectRef* NAME(GrEffect::CreateStaticEffectRef(NAME##_RefLocation, NAME##_Effect)); \
-static SkAutoTDestroy<GrEffectRef> NAME##_Ref_ad(NAME)
+static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage; \
+static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLASS, ARGS); \
+static SkAutoTDestroy<GrEffect> NAME##_ad(NAME);
#endif
diff --git a/include/gpu/GrEffectStage.h b/include/gpu/GrEffectStage.h
index 84ccbbf..fb0620d 100644
--- a/include/gpu/GrEffectStage.h
+++ b/include/gpu/GrEffectStage.h
@@ -20,8 +20,8 @@
class GrEffectStage {
public:
- explicit GrEffectStage(const GrEffectRef* effectRef, int attrIndex0 = -1, int attrIndex1 = -1)
- : fEffectRef(SkRef(effectRef)) {
+ explicit GrEffectStage(const GrEffect* effect, int attrIndex0 = -1, int attrIndex1 = -1)
+ : fEffect(SkRef(effect)) {
fCoordChangeMatrixSet = false;
fVertexAttribIndices[0] = attrIndex0;
fVertexAttribIndices[1] = attrIndex1;
@@ -36,14 +36,14 @@
if (other.fCoordChangeMatrixSet) {
fCoordChangeMatrix = other.fCoordChangeMatrix;
}
- fEffectRef.reset(SkRef(other.fEffectRef.get()));
+ fEffect.reset(SkRef(other.fEffect.get()));
memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexAttribIndices));
return *this;
}
bool operator== (const GrEffectStage& other) const {
- SkASSERT(NULL != fEffectRef.get());
- SkASSERT(NULL != other.fEffectRef.get());
+ SkASSERT(NULL != fEffect.get());
+ SkASSERT(NULL != other.fEffect.get());
if (!this->getEffect()->isEqual(*other.getEffect())) {
return false;
@@ -81,7 +81,7 @@
private:
bool fCoordChangeMatrixSet;
SkMatrix fCoordChangeMatrix;
- SkDEBUGCODE(mutable SkAutoTUnref<const GrEffectRef> fEffectRef;)
+ SkDEBUGCODE(mutable SkAutoTUnref<const GrEffect> fEffect;)
friend class GrEffectStage;
};
@@ -97,9 +97,9 @@
if (fCoordChangeMatrixSet) {
savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix;
}
- SkASSERT(NULL == savedCoordChange->fEffectRef.get());
- SkDEBUGCODE(SkRef(fEffectRef.get());)
- SkDEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef.get());)
+ SkASSERT(NULL == savedCoordChange->fEffect.get());
+ SkDEBUGCODE(SkRef(fEffect.get());)
+ SkDEBUGCODE(savedCoordChange->fEffect.reset(fEffect.get());)
}
/**
@@ -110,8 +110,8 @@
if (fCoordChangeMatrixSet) {
fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix;
}
- SkASSERT(savedCoordChange.fEffectRef.get() == fEffectRef);
- SkDEBUGCODE(savedCoordChange.fEffectRef.reset(NULL);)
+ SkASSERT(savedCoordChange.fEffect.get() == fEffect);
+ SkDEBUGCODE(savedCoordChange.fEffect.reset(NULL);)
}
/**
@@ -126,15 +126,15 @@
}
}
- const GrEffect* getEffect() const { return fEffectRef.get()->get(); }
+ const GrEffect* getEffect() const { return fEffect.get(); }
const int* getVertexAttribIndices() const { return fVertexAttribIndices; }
- int getVertexAttribIndexCount() const { return fEffectRef->get()->numVertexAttribs(); }
+ int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); }
private:
bool fCoordChangeMatrixSet;
SkMatrix fCoordChangeMatrix;
- SkAutoTUnref<const GrEffectRef> fEffectRef;
+ SkAutoTUnref<const GrEffect> fEffect;
int fVertexAttribIndices[2];
};
diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h
index f71ab54..ffc64f2 100644
--- a/include/gpu/GrEffectUnitTest.h
+++ b/include/gpu/GrEffectUnitTest.h
@@ -32,26 +32,26 @@
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
class GrContext;
-class GrEffectRef;
+class GrEffect;
class GrTexture;
class GrEffectTestFactory : SkNoncopyable {
public:
- typedef GrEffectRef* (*CreateProc)(SkRandom*,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture* dummyTextures[]);
+ typedef GrEffect* (*CreateProc)(SkRandom*,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture* dummyTextures[]);
GrEffectTestFactory(CreateProc createProc) {
fCreateProc = createProc;
GetFactories()->push_back(this);
}
- static GrEffectRef* CreateStage(SkRandom* random,
- GrContext* context,
- const GrDrawTargetCaps& caps,
- GrTexture* dummyTextures[]) {
+ static GrEffect* CreateStage(SkRandom* random,
+ GrContext* context,
+ const GrDrawTargetCaps& caps,
+ GrTexture* dummyTextures[]) {
uint32_t idx = random->nextRangeU(0, GetFactories()->count() - 1);
GrEffectTestFactory* factory = (*GetFactories())[idx];
return factory->fCreateProc(random, context, caps, dummyTextures);
@@ -67,10 +67,10 @@
*/
#define GR_DECLARE_EFFECT_TEST \
static GrEffectTestFactory gTestFactory; \
- static GrEffectRef* TestCreate(SkRandom*, \
- GrContext*, \
- const GrDrawTargetCaps&, \
- GrTexture* dummyTextures[2])
+ static GrEffect* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
/** GrEffect subclasses should insert this macro in their implementation file. They must then
* also implement this static function:
@@ -91,10 +91,10 @@
// The unit test relies on static initializers. Just declare the TestCreate function so that
// its definitions will compile.
#define GR_DECLARE_EFFECT_TEST \
- static GrEffectRef* TestCreate(SkRandom*, \
- GrContext*, \
- const GrDrawTargetCaps&, \
- GrTexture* dummyTextures[2])
+ static GrEffect* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
#define GR_DEFINE_EFFECT_TEST(X)
#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index db9b8cc..20dec35 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -87,9 +87,9 @@
/**
* Appends an additional color effect to the color computation.
*/
- 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);
- if (!(*effect)->willUseInputColor()) {
+ if (!effect->willUseInputColor()) {
fColorStages.reset();
}
SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, attr1));
@@ -99,9 +99,9 @@
/**
* Appends an additional coverage effect to the coverage computation.
*/
- 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);
- if (!(*effect)->willUseInputColor()) {
+ if (!effect->willUseInputColor()) {
fCoverageStages.reset();
}
SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1));