aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-06-07 14:23:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-07 19:11:01 +0000
commita924dd3b7ec550791224a0f1b9cf55e8b5a1ab64 (patch)
tree8b929adcf34fef7d6c4dd07025c2ce759d02b37d /src/shaders
parent46983b7dd88603bb2a9a3c3e1ce3e147f5615f2f (diff)
Use burst mode for linear gradients w/ > 2 stops
Change-Id: I4c2778ca9a004ae8b45362e11cb15ac7703c18ac Reviewed-on: https://skia-review.googlesource.com/19022 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/shaders')
-rw-r--r--src/shaders/gradients/SkLinearGradient.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index 52f380b3d3..2bce02e782 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -86,11 +86,9 @@ SkShaderBase::Context* SkLinearGradient::onMakeContext(
SkShaderBase::Context* SkLinearGradient::onMakeBurstPipelineContext(
const ContextRec& rec, SkArenaAlloc* alloc) const {
- // TODO: refine heuristic.
- if (fColorCount <= 8) {
- return nullptr;
- }
- return CheckedMakeContext<LinearGradient4fContext>(alloc, *this, rec);
+ // Raster pipeline has a 2-stop specialization faster than our burst.
+ return fColorCount > 2 ? CheckedMakeContext<LinearGradient4fContext>(alloc, *this, rec)
+ : nullptr;
}
bool SkLinearGradient::adjustMatrixAndAppendStages(SkArenaAlloc* alloc,