From bbeb5730e7365d0952d3dbb5846001708b9517a3 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Thu, 26 Jan 2017 16:23:06 -0500 Subject: Simplify SkShader::ContextRec::fLocalMatrix handling Minor cleanup. R=robertphillips@google.com,reed@google.com Change-Id: I1a27af61e3e3bb5e895c9a3265da6b0408234165 Reviewed-on: https://skia-review.googlesource.com/7632 Commit-Queue: Florin Malita Reviewed-by: Robert Phillips --- src/core/SkNormalMapSource.cpp | 11 ++++------- src/core/SkShader.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'src/core') diff --git a/src/core/SkNormalMapSource.cpp b/src/core/SkNormalMapSource.cpp index 5da9467ff7..71e5565ac8 100644 --- a/src/core/SkNormalMapSource.cpp +++ b/src/core/SkNormalMapSource.cpp @@ -174,15 +174,12 @@ size_t SkNormalMapSourceImpl::providerSize(const SkShader::ContextRec& rec) cons bool SkNormalMapSourceImpl::computeNormTotalInverse(const SkShader::ContextRec& rec, SkMatrix* normTotalInverse) const { - SkMatrix total; - total.setConcat(*rec.fMatrix, fMapShader->getLocalMatrix()); - - const SkMatrix* m = &total; + SkMatrix total = SkMatrix::Concat(*rec.fMatrix, fMapShader->getLocalMatrix()); if (rec.fLocalMatrix) { - total.setConcat(*m, *rec.fLocalMatrix); - m = &total; + total.preConcat(*rec.fLocalMatrix); } - return m->invert(normTotalInverse); + + return total.invert(normTotalInverse); } #define BUFFER_MAX 16 diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 3a2ec7b912..cbe2f5dc89 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -66,15 +66,12 @@ void SkShader::flatten(SkWriteBuffer& buffer) const { } bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse) const { - SkMatrix total; - total.setConcat(*rec.fMatrix, fLocalMatrix); - - const SkMatrix* m = &total; + SkMatrix total = SkMatrix::Concat(*rec.fMatrix, fLocalMatrix); if (rec.fLocalMatrix) { - total.setConcat(*m, *rec.fLocalMatrix); - m = &total; + total.preConcat(*rec.fLocalMatrix); } - return m->invert(totalInverse); + + return total.invert(totalInverse); } bool SkShader::asLuminanceColor(SkColor* colorPtr) const { -- cgit v1.2.3