Chromium Code Reviews| Index: src/core/SkRecordDraw.cpp |
| diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp |
| index e35e5a0a9d37d37e5c232067108a20680d03c511..79fb6cdc43f830d4e1659650f459da7f1779ba90 100644 |
| --- a/src/core/SkRecordDraw.cpp |
| +++ b/src/core/SkRecordDraw.cpp |
| @@ -11,6 +11,7 @@ |
| void SkRecordDraw(const SkRecord& record, |
| SkCanvas* canvas, |
| + SkPicture* const drawablePicts[], int drawableCount, |
| const SkBBoxHierarchy* bbh, |
| SkDrawPictureCallback* callback) { |
| SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
| @@ -29,7 +30,7 @@ void SkRecordDraw(const SkRecord& record, |
| SkTDArray<unsigned> ops; |
| bbh->search(query, &ops); |
| - SkRecords::Draw draw(canvas); |
| + SkRecords::Draw draw(canvas, drawablePicts, drawableCount); |
| for (int i = 0; i < ops.count(); i++) { |
| if (callback && callback->abortDrawing()) { |
| return; |
| @@ -41,7 +42,7 @@ void SkRecordDraw(const SkRecord& record, |
| } |
| } else { |
| // Draw all ops. |
| - SkRecords::Draw draw(canvas); |
| + SkRecords::Draw draw(canvas, drawablePicts, drawableCount); |
| for (unsigned i = 0; i < record.count(); i++) { |
| if (callback && callback->abortDrawing()) { |
| return; |
| @@ -56,13 +57,14 @@ void SkRecordDraw(const SkRecord& record, |
| void SkRecordPartialDraw(const SkRecord& record, |
| SkCanvas* canvas, |
|
robertphillips
2014/11/17 20:16:51
Why not just pass these in and use them?
mtklein
2014/11/17 20:23:21
I assume it's because the don't exist at the time
reed1
2014/11/17 20:35:59
I will need to update all the call-sites for the n
|
| +// SkPicture* const drawablePicts[], int drawableCount, |
| const SkRect& clearRect, |
| unsigned start, unsigned stop, |
| const SkMatrix& initialCTM) { |
| SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
| stop = SkTMin(stop, record.count()); |
| - SkRecords::PartialDraw draw(canvas, clearRect, initialCTM); |
| + SkRecords::PartialDraw draw(canvas, NULL, 0, clearRect, initialCTM); |
| for (unsigned i = start; i < stop; i++) { |
| record.visit<void>(i, draw); |
| } |
| @@ -123,6 +125,12 @@ DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co |
| DRAW(DrawData, drawData(r.data, r.length)); |
| #undef DRAW |
| +template <> void Draw::draw(const DrawDrawable& r) { |
| + SkASSERT(r.index >= 0); |
| + SkASSERT(r.index < fDrawableCount); |
| + fCanvas->drawPicture(fDrawablePicts[r.index]); |
| +} |
| + |
| // This is an SkRecord visitor that fills an SkBBoxHierarchy. |
| // |
| // The interesting part here is how to calculate bounds for ops which don't |
| @@ -501,6 +509,10 @@ private: |
| return this->adjustAndMap(dst, &op.paint); |
| } |
| + Bounds bounds(const DrawDrawable& op) const { |
| + return this->adjustAndMap(op.worstCaseBounds, NULL); |
| + } |
| + |
| static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { |
| #ifdef SK_DEBUG |
| SkRect correct = *rect; |