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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return (fEffectClassID << (kEffectKeyBits+kTextureKeyBits+kTransformKeyB
its+kAttribKeyBits)) | | 57 return (fEffectClassID << (kEffectKeyBits+kTextureKeyBits+kTransformKeyB
its+kAttribKeyBits)) | |
58 (attribKey << (kEffectKeyBits+kTextureKeyBits+kTransformKeyBits))
| | 58 (attribKey << (kEffectKeyBits+kTextureKeyBits+kTransformKeyBits))
| |
59 (transformKey << (kEffectKeyBits+kTextureKeyBits)) | | 59 (transformKey << (kEffectKeyBits+kTextureKeyBits)) | |
60 (textureKey << kEffectKeyBits) | | 60 (textureKey << kEffectKeyBits) | |
61 (effectKey); | 61 (effectKey); |
62 } | 62 } |
63 | 63 |
64 /** Returns a new instance of the appropriate *GL* implementation class | 64 /** Returns a new instance of the appropriate *GL* implementation class |
65 for the given GrEffect; caller is responsible for deleting | 65 for the given GrEffect; caller is responsible for deleting |
66 the object. */ | 66 the object. */ |
67 virtual GLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_
OVERRIDE { | 67 virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const S
K_OVERRIDE { |
68 return SkNEW_ARGS(GLEffect, (*this, drawEffect)); | 68 return SkNEW_ARGS(GLEffect, (*this, drawEffect)); |
69 } | 69 } |
70 | 70 |
71 /** This class is a singleton. This function returns the single instance. | 71 /** This class is a singleton. This function returns the single instance. |
72 */ | 72 */ |
73 static const GrBackendEffectFactory& getInstance() { | 73 static const GrBackendEffectFactory& getInstance() { |
74 static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem; | 74 static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem; |
75 static const GrTBackendEffectFactory* gInstance; | 75 static const GrTBackendEffectFactory* gInstance; |
76 if (!gInstance) { | 76 if (!gInstance) { |
77 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(), | 77 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(), |
78 GrTBackendEffectFactory); | 78 GrTBackendEffectFactory); |
79 } | 79 } |
80 return *gInstance; | 80 return *gInstance; |
81 } | 81 } |
82 | 82 |
83 protected: | 83 protected: |
84 GrTBackendEffectFactory() { | 84 GrTBackendEffectFactory() { |
85 fEffectClassID = GenID(); | 85 fEffectClassID = GenID(); |
86 } | 86 } |
87 }; | 87 }; |
88 | 88 |
89 #endif | 89 #endif |
OLD | NEW |