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>
This commit is contained in:
Florin Malita 2017-07-05 10:59:12 -04:00 committed by Skia Commit-Bot
parent 7aad8cc2ff
commit 8b9566a257

View File

@ -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)