OLD | NEW |
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const GrDrawEffect& effect, | 206 const GrDrawEffect& effect, |
207 EffectKey key, | 207 EffectKey key, |
208 const char* outputColor, | 208 const char* outputColor, |
209 const char* inputColor, | 209 const char* inputColor, |
210 const TextureSamplerArray& samplers) { | 210 const TextureSamplerArray& samplers) { |
211 | 211 |
212 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>(); | 212 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>(); |
213 const char* dstColor = builder->dstColor(); | 213 const char* dstColor = builder->dstColor(); |
214 SkASSERT(NULL != dstColor); | 214 SkASSERT(NULL != dstColor); |
215 if (NULL == inputColor) { | 215 if (NULL == inputColor) { |
216 inputColor = GrGLSLOnesVecf(4); | 216 inputColor = GrGLSLExpr<4>(1).c_str(); |
217 } | 217 } |
218 | 218 |
219 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor); | 219 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor); |
220 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor); | 220 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor); |
221 | 221 |
222 builder->fsCodeAppendf("\t\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb); \n", | 222 builder->fsCodeAppendf("\t\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb); \n", |
223 SK_ITU_BT709_LUM_COEFF_R, | 223 SK_ITU_BT709_LUM_COEFF_R, |
224 SK_ITU_BT709_LUM_COEFF_G, | 224 SK_ITU_BT709_LUM_COEFF_G, |
225 SK_ITU_BT709_LUM_COEFF_B, | 225 SK_ITU_BT709_LUM_COEFF_B, |
226 opB); | 226 opB); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // No background texture support. | 268 // No background texture support. |
269 if (effect && !background) { | 269 if (effect && !background) { |
270 *effect = GrLumaMaskEffect::Create(fMode); | 270 *effect = GrLumaMaskEffect::Create(fMode); |
271 return true; | 271 return true; |
272 } | 272 } |
273 | 273 |
274 return false; | 274 return false; |
275 } | 275 } |
276 | 276 |
277 #endif // SK_SUPPORT_GPU | 277 #endif // SK_SUPPORT_GPU |
OLD | NEW |