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

Unified Diff: src/core/SkCanvas.cpp

Issue 203203004: Consolidate SkCanvas matrix virtuals. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated per review. Created 6 years, 9 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 | « src/core/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkPictureRecord.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 787d89d184a3a87ddf88be1a7aa1b6556f7aa313..45f5e074a9fb2abb9ba949cf5ba960c53193586d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1325,52 +1325,28 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
}
/////////////////////////////////////////////////////////////////////////////
-void SkCanvas::didTranslate(SkScalar, SkScalar) {
- // Do nothing. Subclasses may do something.
-}
-
void SkCanvas::translate(SkScalar dx, SkScalar dy) {
- fDeviceCMDirty = true;
- fCachedLocalClipBoundsDirty = true;
- fMCRec->fMatrix->preTranslate(dx, dy);
-
- this->didTranslate(dx, dy);
-}
-
-void SkCanvas::didScale(SkScalar, SkScalar) {
- // Do nothing. Subclasses may do something.
+ SkMatrix m;
+ m.setTranslate(dx, dy);
+ this->concat(m);
}
void SkCanvas::scale(SkScalar sx, SkScalar sy) {
- fDeviceCMDirty = true;
- fCachedLocalClipBoundsDirty = true;
- fMCRec->fMatrix->preScale(sx, sy);
-
- this->didScale(sx, sy);
-}
-
-void SkCanvas::didRotate(SkScalar) {
- // Do nothing. Subclasses may do something.
+ SkMatrix m;
+ m.setScale(sx, sy);
+ this->concat(m);
}
void SkCanvas::rotate(SkScalar degrees) {
- fDeviceCMDirty = true;
- fCachedLocalClipBoundsDirty = true;
- fMCRec->fMatrix->preRotate(degrees);
-
- this->didRotate(degrees);
-}
-
-void SkCanvas::didSkew(SkScalar, SkScalar) {
- // Do nothing. Subclasses may do something.
+ SkMatrix m;
+ m.setRotate(degrees);
+ this->concat(m);
}
void SkCanvas::skew(SkScalar sx, SkScalar sy) {
- fDeviceCMDirty = true;
- fCachedLocalClipBoundsDirty = true;
- fMCRec->fMatrix->preSkew(sx, sy);
-
- this->didSkew(sx, sy);
+ SkMatrix m;
+ m.setSkew(sx, sy);
+ this->concat(m);
}
void SkCanvas::didConcat(const SkMatrix&) {
@@ -1378,6 +1354,10 @@ void SkCanvas::didConcat(const SkMatrix&) {
}
void SkCanvas::concat(const SkMatrix& matrix) {
+ if (matrix.isIdentity()) {
+ return;
+ }
+
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;
fMCRec->fMatrix->preConcat(matrix);
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698