aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/gradients
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-07-12 13:31:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-12 20:36:45 +0000
commit5769dd2c9ad9443b8cf2d62748d5747e547c7ad5 (patch)
tree912ab12f89b385392d5db0da9700e40968fa69f7 /src/shaders/gradients
parentd4b2c537d058ad4cb890ba116d00aa86c3416c08 (diff)
Add some raster pipeline perspective asserts
I meant to add these when removing the guard, but since we landed without a guard, might as well do it now. A couple of things exposed by these asserts: 1) we need to also catch perspective in local matrices 2) we need to disallow burst mode with perspective Also tweak the predicate to hasPerspective() instead of explicit mask check. Change-Id: I099e5125fca52dccffca77c60fc800bbdf539b53 Reviewed-on: https://skia-review.googlesource.com/22483 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/shaders/gradients')
-rw-r--r--src/shaders/gradients/SkGradientShader.cpp3
-rw-r--r--src/shaders/gradients/SkSweepGradient.cpp2
-rw-r--r--src/shaders/gradients/SkSweepGradient.h6
-rw-r--r--src/shaders/gradients/SkTwoPointConicalGradient.h2
4 files changed, 8 insertions, 5 deletions
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 27b986ca50..0619ef0546 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -538,6 +538,9 @@ SkGradientShaderBase::GradientShaderBaseContext::GradientShaderBaseContext(
fDstToIndexProc = fDstToIndex.getMapXYProc();
fDstToIndexClass = (uint8_t)SkShaderBase::Context::ComputeMatrixClass(fDstToIndex);
+ // TODO: remove all perspective-related gradient code
+ SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
+
// now convert our colors in to PMColors
unsigned paintAlpha = this->getPaintAlpha();
diff --git a/src/shaders/gradients/SkSweepGradient.cpp b/src/shaders/gradients/SkSweepGradient.cpp
index 40cfe68087..61ddf5c39b 100644
--- a/src/shaders/gradients/SkSweepGradient.cpp
+++ b/src/shaders/gradients/SkSweepGradient.cpp
@@ -62,7 +62,7 @@ SkSweepGradient::SweepGradientContext::SweepGradientContext(
const SkSweepGradient& shader, const ContextRec& rec)
: INHERITED(shader, rec) {}
-bool SkSweepGradient::isRasterPipelineOnly() const {
+bool SkSweepGradient::onIsRasterPipelineOnly() const {
#ifdef SK_LEGACY_SWEEP_GRADIENT
return false;
#else
diff --git a/src/shaders/gradients/SkSweepGradient.h b/src/shaders/gradients/SkSweepGradient.h
index 599b833868..f3932d53b0 100644
--- a/src/shaders/gradients/SkSweepGradient.h
+++ b/src/shaders/gradients/SkSweepGradient.h
@@ -10,7 +10,7 @@
#include "SkGradientShaderPriv.h"
-class SkSweepGradient : public SkGradientShaderBase {
+class SkSweepGradient final : public SkGradientShaderBase {
public:
SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&);
@@ -41,9 +41,9 @@ protected:
bool adjustMatrixAndAppendStages(SkArenaAlloc* alloc,
SkMatrix* matrix,
SkRasterPipeline* tPipeline,
- SkRasterPipeline* postPipeline) const final;
+ SkRasterPipeline* postPipeline) const override;
- bool isRasterPipelineOnly() const final;
+ bool onIsRasterPipelineOnly() const override;
private:
const SkPoint fCenter;
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.h b/src/shaders/gradients/SkTwoPointConicalGradient.h
index 3e48a4b4df..41909c900d 100644
--- a/src/shaders/gradients/SkTwoPointConicalGradient.h
+++ b/src/shaders/gradients/SkTwoPointConicalGradient.h
@@ -44,7 +44,7 @@ protected:
SkRasterPipeline* tPipeline,
SkRasterPipeline* postPipeline) const override;
- bool isRasterPipelineOnly() const override { return true; }
+ bool onIsRasterPipelineOnly() const override { return true; }
private:
SkPoint fCenter1;