diff options
Diffstat (limited to 'include/gpu/GrEffect.h')
-rw-r--r-- | include/gpu/GrEffect.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h index b12a34662a..5fca4b2344 100644 --- a/include/gpu/GrEffect.h +++ b/include/gpu/GrEffect.h @@ -8,9 +8,10 @@ #ifndef GrEffect_DEFINED #define GrEffect_DEFINED -#include "GrRefCnt.h" -#include "GrNoncopyable.h" +#include "GrColor.h" #include "GrEffectUnitTest.h" +#include "GrNoncopyable.h" +#include "GrRefCnt.h" #include "GrTexture.h" #include "GrTextureAccess.h" @@ -31,9 +32,27 @@ public: GrEffect() {}; virtual ~GrEffect(); - /** If given an input texture that is/is not opaque, is this effect guaranteed to produce an - opaque output? */ - virtual bool isOpaque(bool inputTextureIsOpaque) const; + /** + * Flags for getConstantColorComponents. They are defined so that the bit order reflects the + * GrColor shift order. + */ + enum ValidComponentFlags { + kR_ValidComponentFlag = 1 << (GrColor_SHIFT_R / 8), + kG_ValidComponentFlag = 1 << (GrColor_SHIFT_G / 8), + kB_ValidComponentFlag = 1 << (GrColor_SHIFT_B / 8), + kA_ValidComponentFlag = 1 << (GrColor_SHIFT_A / 8), + + kAll_ValidComponentFlags = (kR_ValidComponentFlag | kG_ValidComponentFlag | + kB_ValidComponentFlag | kA_ValidComponentFlag) + }; + + /** + * This function is used to perform optimizations. When called the color and validFlags params + * indicate whether the input components to this effect in the FS will have known values. The + * function updates both params to indicate known values of its output. A component of the color + * param only has meaning if the corresponding bit in validFlags is set. + */ + virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const = 0; /** This object, besides creating back-end-specific helper objects, is used for run-time-type- identification. The factory should be an instance of templated class, |