aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrFragmentProcessor.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-07-26 19:07:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-26 23:31:30 +0000
commit6cd51b51d6603a3100b147c45f38697f2f199fc6 (patch)
tree55d6bebf39125e0cdb0cd30c4fb6f8489428931a /src/gpu/GrFragmentProcessor.h
parent7f97f49a840c92e26058034c631e8d76a54897bd (diff)
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>
Diffstat (limited to 'src/gpu/GrFragmentProcessor.h')
-rw-r--r--src/gpu/GrFragmentProcessor.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 02ed0c7e68..78319c7a7a 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -249,6 +249,21 @@ protected:
};
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);
}