diff options
author | Florin Malita <fmalita@chromium.org> | 2017-07-05 10:59:12 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-05 17:14:14 +0000 |
commit | 8b9566a257312f1cbd447f0cfdbb2cfb349f3c26 (patch) | |
tree | 000ad7f8bd283c4f3f19b2ac871ce7a86526cf24 /src/shaders | |
parent | 7aad8cc2ff7a580bd5852d57289ace8c8dced6f5 (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')
-rw-r--r-- | src/shaders/SkShader.cpp | 11 |
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) |