aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-01-26 16:23:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-26 22:13:17 +0000
commitbbeb5730e7365d0952d3dbb5846001708b9517a3 (patch)
treed8206e1a4d2dfa81edcf8459732445d8df5f8bab /src
parent690dd5e3747cf36b42d37fcd460b357c8e2c6f92 (diff)
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 <fmalita@chromium.org> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkNormalMapSource.cpp11
-rw-r--r--src/core/SkShader.cpp11
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp3
3 files changed, 9 insertions, 16 deletions
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 {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 600a4fbb6b..3798a407ac 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -447,8 +447,7 @@ SkPerlinNoiseShader::PerlinNoiseShaderContext::PerlinNoiseShaderContext(
const SkPerlinNoiseShader& shader, const ContextRec& rec)
: INHERITED(shader, rec)
{
- SkMatrix newMatrix = *rec.fMatrix;
- newMatrix.preConcat(shader.getLocalMatrix());
+ SkMatrix newMatrix = SkMatrix::Concat(*rec.fMatrix, shader.getLocalMatrix());
if (rec.fLocalMatrix) {
newMatrix.preConcat(*rec.fLocalMatrix);
}