Index: src/effects/SkBlendImageFilter.cpp |
=================================================================== |
--- src/effects/SkBlendImageFilter.cpp (revision 7135) |
+++ src/effects/SkBlendImageFilter.cpp (working copy) |
@@ -153,6 +153,8 @@ |
typedef GrGLBlendEffect GLEffect; |
static const char* Name() { return "Blend"; } |
+ void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; |
+ |
private: |
GrTextureAccess fForegroundAccess; |
GrTextureAccess fBackgroundAccess; |
@@ -245,6 +247,19 @@ |
return GrTBackendEffectFactory<GrBlendEffect>::getInstance(); |
} |
+void GrBlendEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { |
+ // The output alpha is always 1 - (1 - FGa) * (1 - BGa). So if either FGa or BGa is known to |
+ // be one then the output alpha is one. (This effect ignores its input. We should have a way to |
+ // communicate this.) |
+ if (GrPixelConfigIsOpaque(fForegroundAccess.getTexture()->config()) || |
+ GrPixelConfigIsOpaque(fBackgroundAccess.getTexture()->config())) { |
+ *validFlags = kA_ValidComponentFlag; |
+ *color = GrColorPackRGBA(0, 0, 0, 0xff); |
+ } else { |
+ *validFlags = 0; |
+ } |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
GrGLBlendEffect::GrGLBlendEffect(const GrBackendEffectFactory& factory, const GrEffect& effect) |