| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkBlendImageFilter.h" | 8 #include "SkBlendImageFilter.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 const GrBackendEffectFactory& GrBlendEffect::getFactory() const { | 208 const GrBackendEffectFactory& GrBlendEffect::getFactory() const { |
| 209 return GrTBackendEffectFactory<GrBlendEffect>::getInstance(); | 209 return GrTBackendEffectFactory<GrBlendEffect>::getInstance(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void GrBlendEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl
ags) const { | 212 void GrBlendEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl
ags) const { |
| 213 // The output alpha is always 1 - (1 - FGa) * (1 - BGa). So if either FGa or
BGa is known to | 213 // The output alpha is always 1 - (1 - FGa) * (1 - BGa). So if either FGa or
BGa is known to |
| 214 // be one then the output alpha is one. (This effect ignores its input. We s
hould have a way to | 214 // be one then the output alpha is one. (This effect ignores its input. We s
hould have a way to |
| 215 // communicate this.) | 215 // communicate this.) |
| 216 if (GrPixelConfigIsOpaque(fForegroundAccess.getTexture()->config()) || | 216 if (GrPixelConfigIsOpaque(fForegroundAccess.getTexture()->config()) || |
| 217 GrPixelConfigIsOpaque(fBackgroundAccess.getTexture()->config())) { | 217 GrPixelConfigIsOpaque(fBackgroundAccess.getTexture()->config())) { |
| 218 *validFlags = kA_ValidComponentFlag; | 218 *validFlags = kA_GrColorComponentFlag; |
| 219 *color = GrColorPackRGBA(0, 0, 0, 0xff); | 219 *color = GrColorPackRGBA(0, 0, 0, 0xff); |
| 220 } else { | 220 } else { |
| 221 *validFlags = 0; | 221 *validFlags = 0; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 /////////////////////////////////////////////////////////////////////////////// | 225 /////////////////////////////////////////////////////////////////////////////// |
| 226 | 226 |
| 227 GrGLBlendEffect::GrGLBlendEffect(const GrBackendEffectFactory& factory, | 227 GrGLBlendEffect::GrGLBlendEffect(const GrBackendEffectFactory& factory, |
| 228 const GrDrawEffect& drawEffect) | 228 const GrDrawEffect& drawEffect) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri
x(bgTex), | 312 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri
x(bgTex), |
| 313 drawEffect, | 313 drawEffect, |
| 314 kCoordsType, | 314 kCoordsType, |
| 315 bgTex); | 315 bgTex); |
| 316 bgKey <<= GrGLEffectMatrix::kKeyBits; | 316 bgKey <<= GrGLEffectMatrix::kKeyBits; |
| 317 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); | 317 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); |
| 318 | 318 |
| 319 return modeKey | bgKey | fgKey; | 319 return modeKey | bgKey | fgKey; |
| 320 } | 320 } |
| 321 #endif | 321 #endif |
| OLD | NEW |