Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(507)

Unified Diff: src/effects/SkBlendImageFilter.cpp

Issue 7064057: Add GrEffect::updateKnownColorComponents(). It is used to determine whether the output of an effect… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b