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

Side by Side Diff: src/effects/SkLumaXfermode.cpp

Issue 25048002: Express (GLSL expression, possibly known value) pairs as a class (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing review comments Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/gradients/SkGradientShader.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkLumaXfermode.h" 8 #include "SkLumaXfermode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EffectKey key, 207 EffectKey key,
208 const char* outputColor, 208 const char* outputColor,
209 const char* inputColor, 209 const char* inputColor,
210 const TransformedCoordsArray&, 210 const TransformedCoordsArray&,
211 const TextureSamplerArray& samplers) { 211 const TextureSamplerArray& samplers) {
212 212
213 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>(); 213 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>();
214 const char* dstColor = builder->dstColor(); 214 const char* dstColor = builder->dstColor();
215 SkASSERT(NULL != dstColor); 215 SkASSERT(NULL != dstColor);
216 if (NULL == inputColor) { 216 if (NULL == inputColor) {
217 inputColor = GrGLSLOnesVecf(4); 217 inputColor = "vec4(1)";
218 } 218 }
219 219
220 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor); 220 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor);
221 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor); 221 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor);
222 222
223 builder->fsCodeAppendf("\t\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb); \n", 223 builder->fsCodeAppendf("\t\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb); \n",
224 SK_ITU_BT709_LUM_COEFF_R, 224 SK_ITU_BT709_LUM_COEFF_R,
225 SK_ITU_BT709_LUM_COEFF_G, 225 SK_ITU_BT709_LUM_COEFF_G,
226 SK_ITU_BT709_LUM_COEFF_B, 226 SK_ITU_BT709_LUM_COEFF_B,
227 opB); 227 opB);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // No background texture support. 269 // No background texture support.
270 if (effect && !background) { 270 if (effect && !background) {
271 *effect = GrLumaMaskEffect::Create(fMode); 271 *effect = GrLumaMaskEffect::Create(fMode);
272 return true; 272 return true;
273 } 273 }
274 274
275 return false; 275 return false;
276 } 276 }
277 277
278 #endif // SK_SUPPORT_GPU 278 #endif // SK_SUPPORT_GPU
OLDNEW
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698