check for identity in translate
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2331943002
TBR=
NOTREECHECKS=True
NOTRY=True
Review-Url: https://codereview.chromium.org/2331943002
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 6e898fa..e53a104 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1457,14 +1457,16 @@
/////////////////////////////////////////////////////////////////////////////
void SkCanvas::translate(SkScalar dx, SkScalar dy) {
- this->checkForDeferredSave();
- fDeviceCMDirty = true;
- fMCRec->fMatrix.preTranslate(dx,dy);
+ if (dx || dy) {
+ this->checkForDeferredSave();
+ fDeviceCMDirty = true;
+ fMCRec->fMatrix.preTranslate(dx,dy);
- // Translate shouldn't affect the is-scale-translateness of the matrix.
- SkASSERT(fIsScaleTranslate == fMCRec->fMatrix.isScaleTranslate());
+ // Translate shouldn't affect the is-scale-translateness of the matrix.
+ SkASSERT(fIsScaleTranslate == fMCRec->fMatrix.isScaleTranslate());
- this->didTranslate(dx,dy);
+ this->didTranslate(dx,dy);
+ }
}
void SkCanvas::scale(SkScalar sx, SkScalar sy) {