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>
This commit is contained in:
Mike Reed 2017-03-02 15:45:15 -05:00 committed by Skia Commit-Bot
parent 108943d625
commit 9169d807b1

View File

@ -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;
}
}
}