aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-23 15:37:27 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-23 15:37:27 +0000
commitd42aca31b9ddc1cb9a81522b4c73a9fe550450bc (patch)
tree0730e3a60d5cf96c80a93e15ac0d2fd7860036e1 /src/gpu
parentd42f7587e5972d7e787b5cf2a043c33fbe96091f (diff)
Remove static effects from the effect memory pool.
Review URL: https://codereview.chromium.org/14081016 git-svn-id: http://skia.googlecode.com/svn/trunk@8828 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp9
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp18
-rw-r--r--src/gpu/GrAARectRenderer.cpp7
-rw-r--r--src/gpu/GrOvalRenderer.cpp30
4 files changed, 24 insertions, 40 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index d7d19a355f..eb52b61923 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -450,12 +450,9 @@ class QuadEdgeEffect : public GrEffect {
public:
static GrEffectRef* Create() {
- // we go through this so we only have one copy of each effect
- static SkAutoTUnref<GrEffectRef> gQuadEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect))));
-
- gQuadEdgeEffectRef.get()->ref();
- return gQuadEdgeEffectRef;
+ GR_CREATE_STATIC_EFFECT(gQuadEdgeEffect, QuadEdgeEffect, ());
+ gQuadEdgeEffect->ref();
+ return gQuadEdgeEffect;
}
virtual ~QuadEdgeEffect() {}
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 0a19d6ca2e..a857dc4e99 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -508,12 +508,9 @@ class HairQuadEdgeEffect : public GrEffect {
public:
static GrEffectRef* Create() {
- // we go through this so we only have one copy of each effect
- static SkAutoTUnref<GrEffectRef> gHairQuadEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect))));
-
- gHairQuadEdgeEffectRef.get()->ref();
- return gHairQuadEdgeEffectRef;
+ GR_CREATE_STATIC_EFFECT(gHairQuadEdgeEffect, HairQuadEdgeEffect, ());
+ gHairQuadEdgeEffect->ref();
+ return gHairQuadEdgeEffect;
}
virtual ~HairQuadEdgeEffect() {}
@@ -609,12 +606,9 @@ class HairLineEdgeEffect : public GrEffect {
public:
static GrEffectRef* Create() {
- // we go through this so we only have one copy of each effect
- static SkAutoTUnref<GrEffectRef> gHairLineEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect))));
-
- gHairLineEdgeEffectRef.get()->ref();
- return gHairLineEdgeEffectRef;
+ GR_CREATE_STATIC_EFFECT(gHairLineEdge, HairLineEdgeEffect, ());
+ gHairLineEdge->ref();
+ return gHairLineEdge;
}
virtual ~HairLineEdgeEffect() {}
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index eacd3f1ec9..418d80d713 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -30,10 +30,9 @@ class GrGLRectEffect;
class GrRectEffect : public GrEffect {
public:
static GrEffectRef* Create() {
- static SkAutoTUnref<GrEffectRef> gRectEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW(GrRectEffect))));
- gRectEffectRef.get()->ref();
- return gRectEffectRef;
+ GR_CREATE_STATIC_EFFECT(gRectEffect, GrRectEffect, ());
+ gRectEffect->ref();
+ return gRectEffect;
}
virtual ~GrRectEffect() {}
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index f217262536..4b795287af 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -51,18 +51,15 @@ inline bool circle_stays_circle(const SkMatrix& m) {
class CircleEdgeEffect : public GrEffect {
public:
static GrEffectRef* Create(bool stroke) {
- // we go through this so we only have one copy of each effect (stroked/filled)
- static SkAutoTUnref<GrEffectRef> gCircleStrokeEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircleEdgeEffect, (true)))));
- static SkAutoTUnref<GrEffectRef> gCircleFillEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircleEdgeEffect, (false)))));
+ GR_CREATE_STATIC_EFFECT(gCircleStrokeEdge, CircleEdgeEffect, (true));
+ GR_CREATE_STATIC_EFFECT(gCircleFillEdge, CircleEdgeEffect, (false));
if (stroke) {
- gCircleStrokeEdgeEffectRef.get()->ref();
- return gCircleStrokeEdgeEffectRef;
+ gCircleStrokeEdge->ref();
+ return gCircleStrokeEdge;
} else {
- gCircleFillEdgeEffectRef.get()->ref();
- return gCircleFillEdgeEffectRef;
+ gCircleFillEdge->ref();
+ return gCircleFillEdge;
}
}
@@ -162,18 +159,15 @@ GrEffectRef* CircleEdgeEffect::TestCreate(SkMWCRandom* random,
class EllipseEdgeEffect : public GrEffect {
public:
static GrEffectRef* Create(bool stroke) {
- // we go through this so we only have one copy of each effect (stroked/filled)
- static SkAutoTUnref<GrEffectRef> gEllipseStrokeEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipseEdgeEffect, (true)))));
- static SkAutoTUnref<GrEffectRef> gEllipseFillEdgeEffectRef(
- CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipseEdgeEffect, (false)))));
+ GR_CREATE_STATIC_EFFECT(gEllipseStrokeEdge, EllipseEdgeEffect, (true));
+ GR_CREATE_STATIC_EFFECT(gEllipseFillEdge, EllipseEdgeEffect, (false));
if (stroke) {
- gEllipseStrokeEdgeEffectRef.get()->ref();
- return gEllipseStrokeEdgeEffectRef;
+ gEllipseStrokeEdge->ref();
+ return gEllipseStrokeEdge;
} else {
- gEllipseFillEdgeEffectRef.get()->ref();
- return gEllipseFillEdgeEffectRef;
+ gEllipseFillEdge->ref();
+ return gEllipseFillEdge;
}
}