From 5d01bec07a0740b30e4ebc51eec9057009a09bc2 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Tue, 2 Apr 2013 20:48:38 +0000 Subject: [PATCH] Fix for effect cache key. Adds the additional shift needed to incorporate the attribKeyBits. Also simplifies the creation of the static globals for the edge effects. Author: jvanverth@google.com Reviewed By: bsalomon@google.com Review URL: https://chromiumcodereview.appspot.com/13465019 git-svn-id: http://skia.googlecode.com/svn/trunk@8498 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/gpu/GrTBackendEffectFactory.h | 2 +- src/gpu/GrAAConvexPathRenderer.cpp | 9 ++++----- src/gpu/GrAAHairLinePathRenderer.cpp | 18 ++++++++---------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h index 8697f8eb7a..813f54b797 100644 --- a/include/gpu/GrTBackendEffectFactory.h +++ b/include/gpu/GrTBackendEffectFactory.h @@ -71,7 +71,7 @@ public: protected: GrTBackendEffectFactory() { - fEffectClassID = GenID() << (kEffectKeyBits + kTextureKeyBits) ; + fEffectClassID = GenID() << (kAttribKeyBits + kEffectKeyBits + kTextureKeyBits) ; } }; diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index ca5addcec9..1ef991ef59 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -451,11 +451,10 @@ public: static GrEffectRef* Create() { // we go through this so we only have one copy of each effect - static GrEffectRef* gQuadEdgeEffectRef = - CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect))); - static SkAutoTUnref gUnref(gQuadEdgeEffectRef); + static SkAutoTUnref gQuadEdgeEffectRef( + CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect)))); - gQuadEdgeEffectRef->ref(); + gQuadEdgeEffectRef.get()->ref(); return gQuadEdgeEffectRef; } @@ -524,7 +523,7 @@ public: private: typedef GrGLEffect INHERITED; }; - + private: QuadEdgeEffect() { this->addVertexAttrib(kVec4f_GrSLType); diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp index fdb6009857..08a4111a24 100644 --- a/src/gpu/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/GrAAHairLinePathRenderer.cpp @@ -509,11 +509,10 @@ public: static GrEffectRef* Create() { // we go through this so we only have one copy of each effect - static GrEffectRef* gHairQuadEdgeEffectRef = - CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect))); - static SkAutoTUnref gUnref(gHairQuadEdgeEffectRef); - - gHairQuadEdgeEffectRef->ref(); + static SkAutoTUnref gHairQuadEdgeEffectRef( + CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect)))); + + gHairQuadEdgeEffectRef.get()->ref(); return gHairQuadEdgeEffectRef; } @@ -611,11 +610,10 @@ public: static GrEffectRef* Create() { // we go through this so we only have one copy of each effect - static GrEffectRef* gHairLineEdgeEffectRef = - CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect))); - static SkAutoTUnref gUnref(gHairLineEdgeEffectRef); - - gHairLineEdgeEffectRef->ref(); + static SkAutoTUnref gHairLineEdgeEffectRef( + CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect)))); + + gHairLineEdgeEffectRef.get()->ref(); return gHairLineEdgeEffectRef; }