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

Unified Diff: src/core/SkPictureRecord.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/SkPictureRecord.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index ce21d955dda95ffb33ab1b1d2d079f8332cc8bad..997b974802733dba287e2f7d9a46036d66dc0077 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -664,62 +664,26 @@ void SkPictureRecord::recordRestore(bool fillInSkips) {
this->validate(initialOffset, size);
}
-void SkPictureRecord::didTranslate(SkScalar dx, SkScalar dy) {
-#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
- fMCMgr.translate(dx, dy);
-#else
+void SkPictureRecord::recordTranslate(const SkMatrix& m) {
+ SkASSERT(SkMatrix::kTranslate_Mask == m.getType());
+
// op + dx + dy
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(TRANSLATE, &size);
- this->addScalar(dx);
- this->addScalar(dy);
+ this->addScalar(m.getTranslateX());
+ this->addScalar(m.getTranslateY());
this->validate(initialOffset, size);
-#endif
- this->INHERITED::didTranslate(dx, dy);
}
-void SkPictureRecord::didScale(SkScalar sx, SkScalar sy) {
+void SkPictureRecord::recordScale(const SkMatrix& m) {
+ SkASSERT(SkMatrix::kScale_Mask == m.getType());
-#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
- fMCMgr.scale(sx, sy);
-#else
// op + sx + sy
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(SCALE, &size);
- this->addScalar(sx);
- this->addScalar(sy);
+ this->addScalar(m.getScaleX());
+ this->addScalar(m.getScaleY());
this->validate(initialOffset, size);
-#endif
- this->INHERITED::didScale(sx, sy);
-}
-
-void SkPictureRecord::didRotate(SkScalar degrees) {
-
-#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
- fMCMgr.rotate(degrees);
-#else
- // op + degrees
- uint32_t size = 1 * kUInt32Size + sizeof(SkScalar);
- size_t initialOffset = this->addDraw(ROTATE, &size);
- this->addScalar(degrees);
- this->validate(initialOffset, size);
-#endif
- this->INHERITED::didRotate(degrees);
-}
-
-void SkPictureRecord::didSkew(SkScalar sx, SkScalar sy) {
-
-#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
- fMCMgr.skew(sx, sy);
-#else
- // op + sx + sy
- uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
- size_t initialOffset = this->addDraw(SKEW, &size);
- this->addScalar(sx);
- this->addScalar(sy);
- this->validate(initialOffset, size);
-#endif
- this->INHERITED::didSkew(sx, sy);
}
void SkPictureRecord::didConcat(const SkMatrix& matrix) {
@@ -727,7 +691,17 @@ void SkPictureRecord::didConcat(const SkMatrix& matrix) {
#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
fMCMgr.concat(matrix);
#else
- this->recordConcat(matrix);
+ switch (matrix.getType()) {
+ case SkMatrix::kTranslate_Mask:
+ this->recordTranslate(matrix);
+ break;
+ case SkMatrix::kScale_Mask:
+ this->recordScale(matrix);
+ break;
+ default:
+ this->recordConcat(matrix);
+ break;
+ }
#endif
this->INHERITED::didConcat(matrix);
}
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698