Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: include/gpu/GrEffect.h

Issue 522873005: Move MakeDivByTextureWHMatrix to GrCoordTransform (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrCoordTransform.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « include/gpu/GrCoordTransform.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698