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 GrEffect_DEFINED | 8 #ifndef GrEffect_DEFINED |
9 #define GrEffect_DEFINED | 9 #define GrEffect_DEFINED |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 int numVertexAttribs() const { | 119 int numVertexAttribs() const { |
120 SkASSERT(0 == fVertexAttribTypes.count() || fRequiresVertexShader); | 120 SkASSERT(0 == fVertexAttribTypes.count() || fRequiresVertexShader); |
121 return fVertexAttribTypes.count(); | 121 return fVertexAttribTypes.count(); |
122 } | 122 } |
123 | 123 |
124 GrSLType vertexAttribType(int index) const { return fVertexAttribTypes[index
]; } | 124 GrSLType vertexAttribType(int index) const { return fVertexAttribTypes[index
]; } |
125 | 125 |
126 static const int kMaxVertexAttribs = 2; | 126 static const int kMaxVertexAttribs = 2; |
127 | 127 |
128 /** Useful for effects that want to insert a texture matrix that is implied
by the texture | |
129 dimensions */ | |
130 static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { | |
131 SkASSERT(NULL != texture); | |
132 SkMatrix mat; | |
133 mat.setIDiv(texture->width(), texture->height()); | |
134 return mat; | |
135 } | |
136 | |
137 void* operator new(size_t size); | 128 void* operator new(size_t size); |
138 void operator delete(void* target); | 129 void operator delete(void* target); |
139 | 130 |
140 void* operator new(size_t size, void* placement) { | 131 void* operator new(size_t size, void* placement) { |
141 return ::operator new(size, placement); | 132 return ::operator new(size, placement); |
142 } | 133 } |
143 void operator delete(void* target, void* placement) { | 134 void operator delete(void* target, void* placement) { |
144 ::operator delete(target, placement); | 135 ::operator delete(target, placement); |
145 } | 136 } |
146 | 137 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 * This creates an effect outside of the effect memory pool. The effect's destru
ctor will be called | 212 * This creates an effect outside of the effect memory pool. The effect's destru
ctor will be called |
222 * at global destruction time. NAME will be the name of the created GrEffect. | 213 * at global destruction time. NAME will be the name of the created GrEffect. |
223 */ | 214 */ |
224 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ | 215 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ |
225 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ | 216 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ |
226 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ | 217 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ |
227 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); | 218 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); |
228 | 219 |
229 | 220 |
230 #endif | 221 #endif |
OLD | NEW |