Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: src/core/SkCanvas.cpp

Issue 2255283002: Fast path translate() in SkCanvas and SkLiteDL. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: plumb translate() through to SkRecord too Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkLiteDL.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 6fbc4fe709c327f21c1c70dc8f6ac27990576bb5..ca0bf3ccaf8afb4e1f6f8bf5a049b69e33a2d109 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1444,9 +1444,14 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, const SkPa
/////////////////////////////////////////////////////////////////////////////
void SkCanvas::translate(SkScalar dx, SkScalar dy) {
- SkMatrix m;
- m.setTranslate(dx, dy);
- this->concat(m);
+ 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());
+
+ this->didTranslate(dx,dy);
}
void SkCanvas::scale(SkScalar sx, SkScalar sy) {
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkLiteDL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698