| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrTBackendEffectFactory_DEFINED | 8 #ifndef GrTBackendEffectFactory_DEFINED |
| 9 #define GrTBackendEffectFactory_DEFINED | 9 #define GrTBackendEffectFactory_DEFINED |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 /** Returns a human-readable name for the effect. Implemented using GLEffect
::Name as described | 43 /** Returns a human-readable name for the effect. Implemented using GLEffect
::Name as described |
| 44 * in this class's comment. */ | 44 * in this class's comment. */ |
| 45 virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); } | 45 virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); } |
| 46 | 46 |
| 47 | 47 |
| 48 /** Implemented using GLEffect::GenKey as described in this class's comment.
*/ | 48 /** Implemented using GLEffect::GenKey as described in this class's comment.
*/ |
| 49 virtual void getGLEffectKey(const GrDrawEffect& drawEffect, | 49 virtual void getGLEffectKey(const GrDrawEffect& drawEffect, |
| 50 const GrGLCaps& caps, | 50 const GrGLCaps& caps, |
| 51 GrEffectKeyBuilder* b) const SK_OVERRIDE { | 51 GrEffectKeyBuilder* b) const SK_OVERRIDE { |
| 52 EffectKey effectKey = GLEffect::GenKey(drawEffect, caps); | 52 GLEffect::GenKey(drawEffect, caps, b); |
| 53 b->add32(effectKey); | |
| 54 } | 53 } |
| 55 | 54 |
| 56 /** Returns a new instance of the appropriate *GL* implementation class | 55 /** Returns a new instance of the appropriate *GL* implementation class |
| 57 for the given GrEffect; caller is responsible for deleting | 56 for the given GrEffect; caller is responsible for deleting |
| 58 the object. */ | 57 the object. */ |
| 59 virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const S
K_OVERRIDE { | 58 virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const S
K_OVERRIDE { |
| 60 return SkNEW_ARGS(GLEffect, (*this, drawEffect)); | 59 return SkNEW_ARGS(GLEffect, (*this, drawEffect)); |
| 61 } | 60 } |
| 62 | 61 |
| 63 /** This class is a singleton. This function returns the single instance. */ | 62 /** This class is a singleton. This function returns the single instance. */ |
| 64 static const GrBackendEffectFactory& getInstance() { | 63 static const GrBackendEffectFactory& getInstance() { |
| 65 static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem; | 64 static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem; |
| 66 static const GrTBackendEffectFactory* gInstance; | 65 static const GrTBackendEffectFactory* gInstance; |
| 67 if (!gInstance) { | 66 if (!gInstance) { |
| 68 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(), | 67 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(), |
| 69 GrTBackendEffectFactory); | 68 GrTBackendEffectFactory); |
| 70 } | 69 } |
| 71 return *gInstance; | 70 return *gInstance; |
| 72 } | 71 } |
| 73 | 72 |
| 74 protected: | 73 protected: |
| 75 GrTBackendEffectFactory() {} | 74 GrTBackendEffectFactory() {} |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 #endif | 77 #endif |
| OLD | NEW |