aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/GrAlphaThresholdFragmentProcessor.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-27 10:59:27 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-27 16:43:38 +0000
commit587e08f361ee3e775a6bbc6dca761dbba82e422c (patch)
tree9f64e10d50fab820419d29dea30a6c978c86c8c9 /src/effects/GrAlphaThresholdFragmentProcessor.cpp
parent4d3adb6b0dea1c9f74fc00b007dfb1af425fc727 (diff)
Revert "Revert "Start of rewrite of GrFragmentProcessor optimizations.""
This reverts commit 052fd5158f7f85e478a9f87c45fecaacf7d0f5f3. Disables the test (of unused code) until platform-specific issues are addressed. Change-Id: I7aa23a07954fccf382aa07d28afcbffb0bebcd6d Reviewed-on: https://skia-review.googlesource.com/7656 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/effects/GrAlphaThresholdFragmentProcessor.cpp')
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index a259607444..8f9e45dc2b 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -32,6 +32,14 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::Make(
bounds));
}
+inline GrFragmentProcessor::OptimizationFlags GrAlphaThresholdFragmentProcessor::OptFlags(float outerThreshold) {
+ if (outerThreshold >= 1.f) {
+ return kPreservesOpaqueInput_OptimizationFlag | kModulatesInput_OptimizationFlag;
+ } else {
+ return kModulatesInput_OptimizationFlag;
+ }
+}
+
GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
@@ -39,16 +47,17 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
float innerThreshold,
float outerThreshold,
const SkIRect& bounds)
- : fInnerThreshold(innerThreshold)
- , fOuterThreshold(outerThreshold)
- , fImageCoordTransform(SkMatrix::I(), texture, GrSamplerParams::kNone_FilterMode)
- , fImageTextureSampler(texture)
- , fColorSpaceXform(std::move(colorSpaceXform))
- , fMaskCoordTransform(SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()),
- SkIntToScalar(-bounds.y())),
- maskTexture,
- GrSamplerParams::kNone_FilterMode)
- , fMaskTextureSampler(maskTexture) {
+ : INHERITED(OptFlags(outerThreshold))
+ , fInnerThreshold(innerThreshold)
+ , fOuterThreshold(outerThreshold)
+ , fImageCoordTransform(SkMatrix::I(), texture, GrSamplerParams::kNone_FilterMode)
+ , fImageTextureSampler(texture)
+ , fColorSpaceXform(std::move(colorSpaceXform))
+ , fMaskCoordTransform(
+ SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
+ maskTexture,
+ GrSamplerParams::kNone_FilterMode)
+ , fMaskTextureSampler(maskTexture) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
this->addTextureSampler(&fImageTextureSampler);