aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/SkShader.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-07-05 10:59:12 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-05 17:14:14 +0000
commit8b9566a257312f1cbd447f0cfdbb2cfb349f3c26 (patch)
tree000ad7f8bd283c4f3f19b2ac871ce7a86526cf24 /src/shaders/SkShader.cpp
parent7aad8cc2ff7a580bd5852d57289ace8c8dced6f5 (diff)
Disallow burst context instantiation for non-invertible CTMs
Similar to SkShaderBase::makeContext(), catch this condition and bail early. BUG=chromium:738682 Change-Id: I4c7a2036bed8ab8699023c4f8f3bc2161de0c41d Reviewed-on: https://skia-review.googlesource.com/21521 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/shaders/SkShader.cpp')
-rw-r--r--src/shaders/SkShader.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shaders/SkShader.cpp b/src/shaders/SkShader.cpp
index 07ddc6d006..bd202c1aed 100644
--- a/src/shaders/SkShader.cpp
+++ b/src/shaders/SkShader.cpp
@@ -91,10 +91,9 @@ bool SkShaderBase::asLuminanceColor(SkColor* colorPtr) const {
}
SkShaderBase::Context* SkShaderBase::makeContext(const ContextRec& rec, SkArenaAlloc* alloc) const {
- if (!this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, nullptr)) {
- return nullptr;
- }
- return this->onMakeContext(rec, alloc);
+ return this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, nullptr)
+ ? this->onMakeContext(rec, alloc)
+ : nullptr;
}
SkShaderBase::Context* SkShaderBase::makeBurstPipelineContext(const ContextRec& rec,
@@ -102,7 +101,9 @@ SkShaderBase::Context* SkShaderBase::makeBurstPipelineContext(const ContextRec&
SkASSERT(rec.fPreferredDstType == ContextRec::kPM4f_DstType);
- return this->onMakeBurstPipelineContext(rec, alloc);
+ return this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, nullptr)
+ ? this->onMakeBurstPipelineContext(rec, alloc)
+ : nullptr;
}
SkShaderBase::Context::Context(const SkShaderBase& shader, const ContextRec& rec)