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>
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index 52f380b..2bce02e 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -86,11 +86,9 @@
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,