Chromium Code Reviews| Index: src/core/SkRecordDraw.cpp |
| diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp |
| index ad1327016b82de3351ba410b4c4238a34218f452..95bad046e34d76ab001efa5dd92c798cc554e814 100644 |
| --- a/src/core/SkRecordDraw.cpp |
| +++ b/src/core/SkRecordDraw.cpp |
| @@ -144,11 +144,12 @@ static const SkRect kUnbounded = { -2e9f, -2e9f, 2e9f, 2e9f }; |
| // in for all the control ops we stashed away. |
| class FillBounds : SkNoncopyable { |
| public: |
| - FillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) : fBounds(record.count()) { |
| + FillBounds(const SkRect& cullRect, 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 = &SkMatrix::I(); |
| - fCurrentClipBounds = kUnbounded; |
| + fCurrentClipBounds = cullRect; |
|
mtklein
2014/10/31 18:21:01
This seems an orthogonal change. Might stick to k
|
| for (fCurrentOp = 0; fCurrentOp < record.count(); fCurrentOp++) { |
| record.visit<void>(fCurrentOp, *this); |
| } |
| @@ -253,7 +254,14 @@ private: |
| void pushSaveBlock(const SkPaint* paint) { |
| // Starting a new Save block. Push a new entry to represent that. |
| - SaveBounds sb = { 0, Bounds::MakeEmpty(), paint }; |
| + SaveBounds sb; |
| + sb.controlOps = 0; |
| + // If the paint affects transparent black, the bound shouldn't be smaller |
| + // then the current clip bounds. |
| + sb.bounds = |
| + PaintMayAffectTransparentBlack(paint) ? fCurrentClipBounds : Bounds::MakeEmpty(); |
| + sb.paint = paint; |
| + |
| fSaveStack.push(sb); |
| this->pushControl(); |
| } |
| @@ -303,19 +311,15 @@ private: |
| SaveBounds sb; |
| fSaveStack.pop(&sb); |
| - // If the paint affects transparent black, we can't trust any of our calculated bounds. |
| - const Bounds& bounds = |
| - PaintMayAffectTransparentBlack(sb.paint) ? fCurrentClipBounds : sb.bounds; |
| - |
| while (sb.controlOps --> 0) { |
| - this->popControl(bounds); |
| + this->popControl(sb.bounds); |
| } |
| // This whole Save block may be part another Save block. |
| - this->updateSaveBounds(bounds); |
| + this->updateSaveBounds(sb.bounds); |
| // If called from a real Restore (not a phony one for balance), it'll need the bounds. |
| - return bounds; |
| + return sb.bounds; |
| } |
| void pushControl() { |
| @@ -554,6 +558,6 @@ private: |
| } // namespace SkRecords |
| -void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
| - SkRecords::FillBounds(record, bbh); |
| +void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkBBoxHierarchy* bbh) { |
| + SkRecords::FillBounds(cullRect, record, bbh); |
| } |