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
This commit is contained in:
commit-bot@chromium.org 2013-04-02 20:48:38 +00:00
parent 00aae979fa
commit 5d01bec07a
3 changed files with 13 additions and 16 deletions

View File

@ -71,7 +71,7 @@ public:
protected: protected:
GrTBackendEffectFactory() { GrTBackendEffectFactory() {
fEffectClassID = GenID() << (kEffectKeyBits + kTextureKeyBits) ; fEffectClassID = GenID() << (kAttribKeyBits + kEffectKeyBits + kTextureKeyBits) ;
} }
}; };

View File

@ -451,11 +451,10 @@ public:
static GrEffectRef* Create() { static GrEffectRef* Create() {
// we go through this so we only have one copy of each effect // we go through this so we only have one copy of each effect
static GrEffectRef* gQuadEdgeEffectRef = static SkAutoTUnref<GrEffectRef> gQuadEdgeEffectRef(
CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect))); CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect))));
static SkAutoTUnref<GrEffectRef> gUnref(gQuadEdgeEffectRef);
gQuadEdgeEffectRef->ref(); gQuadEdgeEffectRef.get()->ref();
return gQuadEdgeEffectRef; return gQuadEdgeEffectRef;
} }
@ -524,7 +523,7 @@ public:
private: private:
typedef GrGLEffect INHERITED; typedef GrGLEffect INHERITED;
}; };
private: private:
QuadEdgeEffect() { QuadEdgeEffect() {
this->addVertexAttrib(kVec4f_GrSLType); this->addVertexAttrib(kVec4f_GrSLType);

View File

@ -509,11 +509,10 @@ public:
static GrEffectRef* Create() { static GrEffectRef* Create() {
// we go through this so we only have one copy of each effect // we go through this so we only have one copy of each effect
static GrEffectRef* gHairQuadEdgeEffectRef = static SkAutoTUnref<GrEffectRef> gHairQuadEdgeEffectRef(
CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect))); CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect))));
static SkAutoTUnref<GrEffectRef> gUnref(gHairQuadEdgeEffectRef);
gHairQuadEdgeEffectRef.get()->ref();
gHairQuadEdgeEffectRef->ref();
return gHairQuadEdgeEffectRef; return gHairQuadEdgeEffectRef;
} }
@ -611,11 +610,10 @@ public:
static GrEffectRef* Create() { static GrEffectRef* Create() {
// we go through this so we only have one copy of each effect // we go through this so we only have one copy of each effect
static GrEffectRef* gHairLineEdgeEffectRef = static SkAutoTUnref<GrEffectRef> gHairLineEdgeEffectRef(
CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect))); CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect))));
static SkAutoTUnref<GrEffectRef> gUnref(gHairLineEdgeEffectRef);
gHairLineEdgeEffectRef.get()->ref();
gHairLineEdgeEffectRef->ref();
return gHairLineEdgeEffectRef; return gHairLineEdgeEffectRef;
} }