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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 1462983002: Record concat as Concat. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix test Created 5 years, 1 month 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/SkRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordDraw.cpp
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index ab0cb71407d5290e1764605ad0fec87dca6f3320..4847273f52a826f4eb2510abb75b4e7860cc82d2 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -80,6 +80,7 @@ DRAW(Restore, restore());
DRAW(Save, save());
DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags));
DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix)));
+DRAW(Concat, concat(r.matrix));
DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa));
DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa));
@@ -154,7 +155,7 @@ public:
: fNumRecords(record.count())
, fCullRect(cullRect)
, fBounds(bounds) {
- fCTM = &SkMatrix::I();
+ fCTM = SkMatrix::I();
fCurrentClipBounds = fCullRect;
}
@@ -184,7 +185,7 @@ public:
typedef SkRect Bounds;
int currentOp() const { return fCurrentOp; }
- const SkMatrix& ctm() const { return *fCTM; }
+ const SkMatrix& ctm() const { return fCTM; }
const Bounds& getBounds(int index) const { return fBounds[index]; }
// Adjust rect for all paints that may affect its geometry, then map it to identity space.
@@ -205,7 +206,7 @@ public:
}
// Map the rect back to identity space.
- fCTM->mapRect(&rect);
+ fCTM.mapRect(&rect);
// Nothing can draw outside the current clip.
if (!rect.intersect(fCurrentClipBounds)) {
@@ -222,10 +223,11 @@ private:
const SkPaint* paint; // Unowned. If set, adjusts the bounds of all ops in this block.
};
- // Only Restore and SetMatrix change the CTM.
+ // Only Restore, SetMatrix, and Concat change the CTM.
template <typename T> void updateCTM(const T&) {}
- void updateCTM(const Restore& op) { fCTM = &op.matrix; }
- void updateCTM(const SetMatrix& op) { fCTM = &op.matrix; }
+ void updateCTM(const Restore& op) { fCTM = op.matrix; }
+ void updateCTM(const SetMatrix& op) { fCTM = op.matrix; }
+ void updateCTM(const Concat& op) { fCTM.preConcat(op.matrix); }
// Most ops don't change the clip.
template <typename T> void updateClipBounds(const T&) {}
@@ -278,6 +280,7 @@ private:
void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(); }
void trackBounds(const SetMatrix&) { this->pushControl(); }
+ void trackBounds(const Concat&) { this->pushControl(); }
void trackBounds(const ClipRect&) { this->pushControl(); }
void trackBounds(const ClipRRect&) { this->pushControl(); }
void trackBounds(const ClipPath&) { this->pushControl(); }
@@ -579,7 +582,7 @@ private:
// and updateClipBounds() to maintain the exact CTM (fCTM) and conservative
// identity-space bounds of the current clip (fCurrentClipBounds).
int fCurrentOp;
- const SkMatrix* fCTM;
+ SkMatrix fCTM;
Bounds fCurrentClipBounds;
// Used to track the bounds of Save/Restore blocks and the control ops inside them.
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698