aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMatrix.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-02 15:45:15 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-02 21:30:11 +0000
commit9169d807b134fe131ade5e9201f2945a753c6edb (patch)
tree1de845af5ba003f8f0694af4250713ef234eabef /src/core/SkMatrix.cpp
parent108943d6253315f22580ddb1c60d6d8adbbc5a6a (diff)
Don't mark the matrix-type as dirty just be cause we translate it.
This speeds up simple mods to canvas, e.g. save() translate(...) ... restore() BUG=skia: Change-Id: I4b872e7d3102fad21d9c17a275006f5576827d41 Reviewed-on: https://skia-review.googlesource.com/9169 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkMatrix.cpp')
-rw-r--r--src/core/SkMatrix.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index dc1ae09242..2c571e0ef6 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -302,7 +302,11 @@ void SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
} else {
fMat[kMTransX] += sdot(fMat[kMScaleX], dx, fMat[kMSkewX], dy);
fMat[kMTransY] += sdot(fMat[kMSkewY], dx, fMat[kMScaleY], dy);
- this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
+ if (fMat[kMTransX] || fMat[kMTransY]) {
+ fTypeMask |= kTranslate_Mask;
+ } else {
+ fTypeMask &= ~kTranslate_Mask;
+ }
}
}
@@ -318,7 +322,11 @@ void SkMatrix::postTranslate(SkScalar dx, SkScalar dy) {
} else {
fMat[kMTransX] += dx;
fMat[kMTransY] += dy;
- this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
+ if (fMat[kMTransX] || fMat[kMTransY]) {
+ fTypeMask |= kTranslate_Mask;
+ } else {
+ fTypeMask &= ~kTranslate_Mask;
+ }
}
}