| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |