aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrFragmentProcessor.cpp10
-rw-r--r--src/gpu/GrFragmentProcessor.h13
-rw-r--r--src/gpu/SkGpuDevice.cpp2
-rw-r--r--src/gpu/SkGr.cpp2
4 files changed, 22 insertions, 5 deletions
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 0c7c06fd6a..187a17701d 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -103,7 +103,7 @@ bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
return true;
}
-std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputAlpha(
+std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulChildByInputAlpha(
std::unique_ptr<GrFragmentProcessor> fp) {
if (!fp) {
return nullptr;
@@ -111,6 +111,14 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputAlpha(
return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(fp), SkBlendMode::kDstIn);
}
+std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulInputByChildAlpha(
+ std::unique_ptr<GrFragmentProcessor> fp) {
+ if (!fp) {
+ return nullptr;
+ }
+ return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(fp), SkBlendMode::kSrcIn);
+}
+
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::PremulInput(
std::unique_ptr<GrFragmentProcessor> fp) {
if (!fp) {
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 4ec92627ad..fa674d5d80 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -33,8 +33,17 @@ public:
* does so by returning a parent FP that multiplies the passed in FPs output by the parent's
* input alpha. The passed in FP will not receive an input color.
*/
- static std::unique_ptr<GrFragmentProcessor> MulOutputByInputAlpha(
- std::unique_ptr<GrFragmentProcessor>);
+ static std::unique_ptr<GrFragmentProcessor> MulChildByInputAlpha(
+ std::unique_ptr<GrFragmentProcessor> child);
+
+ /**
+ * Like MulChildByInputAlpha(), but reverses the sense of src and dst. In this case, return
+ * the input modulated by the child's alpha. The passed in FP will not receive an input color.
+ *
+ * output = input * child.a
+ */
+ static std::unique_ptr<GrFragmentProcessor> MulInputByChildAlpha(
+ std::unique_ptr<GrFragmentProcessor> child);
/**
* This assumes that the input color to the returned processor will be unpremul and that the
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 080d993c68..73e5f11e4a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1094,7 +1094,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, int left, int top, const
if (GrPixelConfigIsAlphaOnly(config)) {
fp = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));
} else {
- fp = GrFragmentProcessor::MulOutputByInputAlpha(std::move(fp));
+ fp = GrFragmentProcessor::MulChildByInputAlpha(std::move(fp));
}
GrPaint grPaint;
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index a702d06395..af0579a098 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -576,7 +576,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
shaderFP = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));
}
} else {
- shaderFP = GrFragmentProcessor::MulOutputByInputAlpha(std::move(fp));
+ shaderFP = GrFragmentProcessor::MulChildByInputAlpha(std::move(fp));
}
return SkPaintToGrPaintReplaceShader(context, colorSpaceInfo, paint, std::move(shaderFP),