aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkShader.cpp')
-rw-r--r--src/core/SkShader.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index f6865d9a31..203209799f 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -70,10 +70,12 @@ void SkShader::flatten(SkWriteBuffer& buffer) const {
}
}
-bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse) const {
- SkMatrix total = SkMatrix::Concat(*rec.fMatrix, fLocalMatrix);
- if (rec.fLocalMatrix) {
- total.preConcat(*rec.fLocalMatrix);
+bool SkShader::computeTotalInverse(const SkMatrix& ctm,
+ const SkMatrix* outerLocalMatrix,
+ SkMatrix* totalInverse) const {
+ SkMatrix total = SkMatrix::Concat(ctm, fLocalMatrix);
+ if (outerLocalMatrix) {
+ total.preConcat(*outerLocalMatrix);
}
return total.invert(totalInverse);
@@ -92,7 +94,7 @@ bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
}
SkShader::Context* SkShader::makeContext(const ContextRec& rec, SkArenaAlloc* alloc) const {
- if (!this->computeTotalInverse(rec, nullptr)) {
+ if (!this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, nullptr)) {
return nullptr;
}
return this->onMakeContext(rec, alloc);
@@ -103,7 +105,7 @@ SkShader::Context::Context(const SkShader& shader, const ContextRec& rec)
{
// Because the context parameters must be valid at this point, we know that the matrix is
// invertible.
- SkAssertResult(fShader.computeTotalInverse(rec, &fTotalInverse));
+ SkAssertResult(fShader.computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, &fTotalInverse));
fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse);
fPaintAlpha = rec.fPaint->getAlpha();