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/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index d2c60ea..de14763 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -340,13 +340,13 @@
/// 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 @@
* 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 986e80a..f952483 100644
--- a/src/gpu/GrEffect.cpp
+++ b/src/gpu/GrEffect.cpp
@@ -59,25 +59,7 @@
///////////////////////////////////////////////////////////////////////////////
-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 ddce0ef..328484b 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 ced9671..1a51e89 100644
--- a/src/gpu/effects/GrDashingEffect.h
+++ b/src/gpu/effects/GrDashingEffect.h
@@ -35,8 +35,8 @@
* 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 63036c0..88e0a27 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 796ee5b..37574ec 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 45ac5f4..bcf4884 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 @@
* 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 1e3810f..866f4a6 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -16,7 +16,7 @@
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 cc86af7..150acd5 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