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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 468193003: Start tracking the CTM while filling the BBH in SkRecordDraw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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 | « src/core/SkCanvas.cpp ('k') | src/core/SkRecorder.h » ('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 688d0b695ead0da67ca3928f4e07ac2f718fa312..c9e029b8db67f11a59c9844a3128f5042931dedf 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -117,6 +117,7 @@ public:
FillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) : fBounds(record.count()) {
// Calculate bounds for all ops. This won't go quite in order, so we'll need
// to store the bounds separately then feed them in to the BBH later in order.
+ fCTM.setIdentity();
for (fCurrentOp = 0; fCurrentOp < record.count(); fCurrentOp++) {
record.visit<void>(fCurrentOp, *this);
}
@@ -143,6 +144,7 @@ public:
}
template <typename T> void operator()(const T& r) {
+ this->updateCTM(r);
this->trackBounds(r);
}
@@ -152,6 +154,11 @@ private:
SkIRect bounds; // Bounds of everything in the block.
};
+ template <typename T> void updateCTM(const T&) { /* most ops don't change the CTM */ }
+ void updateCTM(const Restore& r) { fCTM = r.matrix; }
+ void updateCTM(const SetMatrix& r) { fCTM = r.matrix; }
+ void updateCTM(const Concat& r) { fCTM.preConcat(r.matrix); }
+
// The bounds of these ops must be calculated when we hit the Restore
// from the bounds of the ops in the same Save block.
void trackBounds(const Save&) { this->pushSaveBlock(); }
@@ -219,6 +226,7 @@ private:
SkIRect bounds(const NoOp&) { return SkIRect::MakeEmpty(); } // NoOps don't draw anywhere.
SkAutoTMalloc<SkIRect> fBounds; // One for each op in the record.
+ SkMatrix fCTM;
unsigned fCurrentOp;
SkTDArray<SaveBounds> fSaveStack;
SkTDArray<unsigned> fControlIndices;
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698