aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-05-26 09:32:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-26 18:19:37 +0000
commit98b7a6a95529c2047bc94319c5276d26b7df7cb2 (patch)
tree6332d230a5f7e6e4b88998b3cbe23930eb7795cd
parentf485cf9f186f017b2be68fb3c336faa0c9f79b5c (diff)
rasterpipeline:
+ only dither if the paint asks for it - don't special case if the shader is a gradient guard: SK_SUPPORT_LEGACY_RASTERPIPELINE Bug: skia: Change-Id: I7f0c101049e5cb32a80306dcfff3bc21bcf318be Reviewed-on: https://skia-review.googlesource.com/17931 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Florin Malita <fmalita@chromium.org>
-rw-r--r--gn/android_framework_defines.gni1
-rw-r--r--src/core/SkRasterPipelineBlitter.cpp9
2 files changed, 7 insertions, 3 deletions
diff --git a/gn/android_framework_defines.gni b/gn/android_framework_defines.gni
index 76b877661f..f9ed28d07c 100644
--- a/gn/android_framework_defines.gni
+++ b/gn/android_framework_defines.gni
@@ -14,4 +14,5 @@ android_framework_defines = [
"SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
"SK_SUPPORT_DEPRECATED_CLIPOPS",
"SK_LEGACY_SWEEP_GRADIENT",
+ "SK_SUPPORT_LEGACY_RASTERPIPELINE",
]
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index a9e0e712f2..a34609ff80 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -93,14 +93,18 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
SkColorSpace* dstCS = dst.colorSpace();
auto paintColor = alloc->make<SkPM4f>(SkPM4f_from_SkColor(paint.getColor(), dstCS));
auto shader = as_SB(paint.getShader());
+ bool wants_dither = paint.isDither();
+
+#ifdef SK_SUPPORT_LEGACY_RASTERPIPELINE
+ wants_dither = shader && shader->asAGradient(nullptr) >= SkShader::kLinear_GradientType;
+#endif
SkRasterPipeline_<256> shaderPipeline;
if (!shader) {
// Having no shader makes things nice and easy... just use the paint color.
shaderPipeline.append(SkRasterPipeline::constant_color, paintColor);
bool is_opaque = paintColor->a() == 1.0f,
- is_constant = true,
- wants_dither = false;
+ is_constant = true;
return SkRasterPipelineBlitter::Create(dst, paint, alloc,
shaderPipeline, nullptr,
is_opaque, is_constant, wants_dither);
@@ -108,7 +112,6 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap& dst,
bool is_opaque = shader->isOpaque() && paintColor->a() == 1.0f;
bool is_constant = shader->isConstant();
- bool wants_dither = shader->asAGradient(nullptr) >= SkShader::kLinear_GradientType;
// See if the shader can express itself by appending pipeline stages.
if (shader->appendStages(&shaderPipeline, dstCS, alloc, ctm, paint)) {