Banish SkShaderBase::isRasterPipelineOnly()
Keeping related heuristics in sync with actual shader capabilities is somewhat tricky,
and overall fragile.
So how about this: instead of an explicit opt-in mechanism, try to instantiate a legacy
shader context and fall back to raster pipeline on failure (null Context => implicit
opt-in for raster pipeline). Shaders can still choose not to draw by returning both a
null Context and failing appendStages().
BUG=skia:7772
Change-Id: I2e76f51af7064853a6cb851b4c30c82eba3ee828
Reviewed-on: https://skia-review.googlesource.com/118383
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index 7398221..21338b8 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -55,7 +55,9 @@
SkShaderBase::Context* SkLinearGradient::onMakeContext(
const ContextRec& rec, SkArenaAlloc* alloc) const
{
- return CheckedMakeContext<LinearGradient4fContext>(alloc, *this, rec);
+ return fTileMode != kDecal_TileMode
+ ? CheckedMakeContext<LinearGradient4fContext>(alloc, *this, rec)
+ : nullptr;
}
SkShaderBase::Context* SkLinearGradient::onMakeBurstPipelineContext(