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; |