Remove GrSingleTextureEffect
Change-Id: I510cc0657f9433b206dc2ab643fa557667263294
Reviewed-on: https://skia-review.googlesource.com/27180
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 02ed0c7..78319c7 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -249,6 +249,21 @@
};
GR_DECL_BITFIELD_OPS_FRIENDS(OptimizationFlags)
+ /**
+ * Can be used as a helper to decide which fragment processor OptimizationFlags should be set.
+ * This assumes that the subclass output color will be a modulation of the input color with a
+ * value read from a texture of the passed config and that the texture contains premultiplied
+ * color or alpha values that are in range.
+ */
+ static OptimizationFlags ModulateByConfigOptimizationFlags(GrPixelConfig config) {
+ if (GrPixelConfigIsOpaque(config)) {
+ return kCompatibleWithCoverageAsAlpha_OptimizationFlag |
+ kPreservesOpaqueInput_OptimizationFlag;
+ } else {
+ return kCompatibleWithCoverageAsAlpha_OptimizationFlag;
+ }
+ }
+
GrFragmentProcessor(OptimizationFlags optimizationFlags) : fFlags(optimizationFlags) {
SkASSERT((fFlags & ~kAll_OptimizationFlags) == 0);
}