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 "GrTBackendEffectFactory.h" | 10 #include "GrTBackendEffectFactory.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 default: | 69 default: |
70 GrCrash("Unknown conversion op."); | 70 GrCrash("Unknown conversion op."); |
71 break; | 71 break; |
72 } | 72 } |
73 } | 73 } |
74 SkString modulate; | 74 SkString modulate; |
75 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); | 75 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); |
76 builder->fsCodeAppend(modulate.c_str()); | 76 builder->fsCodeAppend(modulate.c_str()); |
77 } | 77 } |
78 | 78 |
79 void setData(const GrGLUniformManager& uman, const GrDrawEffect& drawEffect)
{ | 79 void setData(const GrGLContext& context, const GrDrawEffect& drawEffect) { |
80 const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigCon
versionEffect>(); | 80 const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigCon
versionEffect>(); |
81 fEffectMatrix.setData(uman, conv.getMatrix(), drawEffect, conv.texture(0
)); | 81 fEffectMatrix.setData(context, conv.getMatrix(), drawEffect, conv.textur
e(0)); |
82 } | 82 } |
83 | 83 |
84 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCap
s&) { | 84 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCap
s&) { |
85 const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigCon
versionEffect>(); | 85 const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigCon
versionEffect>(); |
86 EffectKey key = static_cast<EffectKey>(conv.swapsRedAndBlue()) | (conv.p
mConversion() << 1); | 86 EffectKey key = static_cast<EffectKey>(conv.swapsRedAndBlue()) | (conv.p
mConversion() << 1); |
87 key <<= GrGLEffectMatrix::kKeyBits; | 87 key <<= GrGLEffectMatrix::kKeyBits; |
88 EffectKey matrixKey = GrGLEffectMatrix::GenKey(conv.getMatrix(), | 88 EffectKey matrixKey = GrGLEffectMatrix::GenKey(conv.getMatrix(), |
89 drawEffect, | 89 drawEffect, |
90 conv.coordsType(), | 90 conv.coordsType(), |
91 conv.texture(0)); | 91 conv.texture(0)); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // The PM conversions assume colors are 0..255 | 287 // The PM conversions assume colors are 0..255 |
288 return NULL; | 288 return NULL; |
289 } | 289 } |
290 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, | 290 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, |
291 swapRedAndB
lue, | 291 swapRedAndB
lue, |
292 pmConversio
n, | 292 pmConversio
n, |
293 matrix))); | 293 matrix))); |
294 return CreateEffectRef(effect); | 294 return CreateEffectRef(effect); |
295 } | 295 } |
296 } | 296 } |
OLD | NEW |