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>
diff --git a/src/shaders/SkShaderBase.h b/src/shaders/SkShaderBase.h
index 8dc9354..d469442 100644
--- a/src/shaders/SkShaderBase.h
+++ b/src/shaders/SkShaderBase.h
@@ -211,7 +211,10 @@
return this->onMakeColorSpace(xformer);
}
- virtual bool isRasterPipelineOnly() const { return false; }
+ bool isRasterPipelineOnly() const {
+ // We always use RP when perspective is present.
+ return fLocalMatrix.hasPerspective() || this->onIsRasterPipelineOnly();
+ }
// If this returns false, then we draw nothing (do not fall back to shader context)
bool appendStages(SkRasterPipeline*, SkColorSpace* dstCS, SkArenaAlloc*,
@@ -268,6 +271,8 @@
virtual bool onAppendStages(SkRasterPipeline*, SkColorSpace* dstCS, SkArenaAlloc*,
const SkMatrix&, const SkPaint&, const SkMatrix* localM) const;
+ virtual bool onIsRasterPipelineOnly() const { return false; }
+
private:
// This is essentially const, but not officially so it can be modified in constructors.
SkMatrix fLocalMatrix;