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 #include "GrConfigConversionEffect.h" | 8 #include "GrConfigConversionEffect.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrTBackendProcessorFactory.h" | 10 #include "GrTBackendProcessorFactory.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 "%s = %s.a <= 0.0 ? vec4(0,0,0,0) : vec4(floor(%s.%s / %
s.a * 255.0) / 255.0, %s.a);", | 74 "%s = %s.a <= 0.0 ? vec4(0,0,0,0) : vec4(floor(%s.%s / %
s.a * 255.0) / 255.0, %s.a);", |
75 tmpVar.c_str(), tmpVar.c_str(), tmpVar.c_str(), swiz, tm
pVar.c_str(), tmpVar.c_str()); | 75 tmpVar.c_str(), tmpVar.c_str(), tmpVar.c_str(), swiz, tm
pVar.c_str(), tmpVar.c_str()); |
76 break; | 76 break; |
77 default: | 77 default: |
78 SkFAIL("Unknown conversion op."); | 78 SkFAIL("Unknown conversion op."); |
79 break; | 79 break; |
80 } | 80 } |
81 fsBuilder->codeAppendf("%s = %s;", outputColor, tmpVar.c_str()); | 81 fsBuilder->codeAppendf("%s = %s;", outputColor, tmpVar.c_str()); |
82 } | 82 } |
83 SkString modulate; | 83 SkString modulate; |
84 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); | 84 GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); |
85 fsBuilder->codeAppend(modulate.c_str()); | 85 fsBuilder->codeAppend(modulate.c_str()); |
86 } | 86 } |
87 | 87 |
88 static inline void GenKey(const GrProcessor& processor, const GrGLCaps&, | 88 static inline void GenKey(const GrProcessor& processor, const GrGLCaps&, |
89 GrProcessorKeyBuilder* b) { | 89 GrProcessorKeyBuilder* b) { |
90 const GrConfigConversionEffect& conv = processor.cast<GrConfigConversion
Effect>(); | 90 const GrConfigConversionEffect& conv = processor.cast<GrConfigConversion
Effect>(); |
91 uint32_t key = (conv.swapsRedAndBlue() ? 0 : 1) | (conv.pmConversion() <
< 1); | 91 uint32_t key = (conv.swapsRedAndBlue() ? 0 : 1) | (conv.pmConversion() <
< 1); |
92 b->add32(key); | 92 b->add32(key); |
93 } | 93 } |
94 | 94 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 kNone_PMConversion != pmConversion) { | 276 kNone_PMConversion != pmConversion) { |
277 // The PM conversions assume colors are 0..255 | 277 // The PM conversions assume colors are 0..255 |
278 return NULL; | 278 return NULL; |
279 } | 279 } |
280 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 280 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
281 swapRedAndBlue, | 281 swapRedAndBlue, |
282 pmConversion, | 282 pmConversion, |
283 matrix)); | 283 matrix)); |
284 } | 284 } |
285 } | 285 } |
OLD | NEW |