Index: src/gpu/GrRecordReplaceDraw.cpp |
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp |
index dacc939e62693cb4d64f4f93b2347a74b090c590..6f05206dcc69b7cea899bd4a066aa62d86393c67 100644 |
--- a/src/gpu/GrRecordReplaceDraw.cpp |
+++ b/src/gpu/GrRecordReplaceDraw.cpp |
@@ -8,6 +8,7 @@ |
#include "GrContext.h" |
#include "GrLayerCache.h" |
#include "GrRecordReplaceDraw.h" |
+#include "SkBigPicture.h" |
#include "SkCanvasPriv.h" |
#include "SkGrPixelRef.h" |
#include "SkImage.h" |
@@ -45,7 +46,7 @@ static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canva |
canvas->drawBitmapRectToRect(bm, &src, dst, layer->paint()); |
canvas->restore(); |
} else { |
- canvas->drawSprite(bm, |
+ canvas->drawSprite(bm, |
layer->srcIR().fLeft + layer->offset().fX, |
layer->srcIR().fTop + layer->offset().fY, |
layer->paint()); |
@@ -59,7 +60,7 @@ public: |
ReplaceDraw(SkCanvas* canvas, GrLayerCache* layerCache, |
SkPicture const* const drawablePicts[], int drawableCount, |
const SkPicture* topLevelPicture, |
- const SkPicture* picture, |
+ const SkBigPicture* picture, |
const SkMatrix& initialMatrix, |
SkPicture::AbortCallback* callback, |
const unsigned* opIndices, int numIndices) |
@@ -76,8 +77,8 @@ public: |
} |
int draw() { |
- const SkBBoxHierarchy* bbh = fPicture->fBBH.get(); |
- const SkRecord* record = fPicture->fRecord.get(); |
+ const SkBBoxHierarchy* bbh = fPicture->bbh(); |
+ const SkRecord* record = fPicture->record(); |
if (NULL == record) { |
return 0; |
} |
@@ -135,13 +136,17 @@ public: |
SkAutoCanvasMatrixPaint acmp(fCanvas, &dp.matrix, dp.paint, dp.picture->cullRect()); |
- // Draw sub-pictures with the same replacement list but a different picture |
- ReplaceDraw draw(fCanvas, fLayerCache, |
- this->drawablePicts(), this->drawableCount(), |
- fTopLevelPicture, dp.picture, fInitialMatrix, fCallback, |
- fOpIndexStack.begin(), fOpIndexStack.count()); |
- |
- fNumReplaced += draw.draw(); |
+ if (const SkBigPicture* bp = dp.picture->asSkBigPicture()) { |
+ // Draw sub-pictures with the same replacement list but a different picture |
+ ReplaceDraw draw(fCanvas, fLayerCache, |
+ this->drawablePicts(), this->drawableCount(), |
+ fTopLevelPicture, bp, fInitialMatrix, fCallback, |
+ fOpIndexStack.begin(), fOpIndexStack.count()); |
+ fNumReplaced += draw.draw(); |
+ } else { |
+ // TODO: can we assume / assert this doesn't happen? |
+ dp.picture->playback(fCanvas, fCallback); |
+ } |
fOpIndexStack.pop(); |
} |
@@ -168,7 +173,7 @@ public: |
draw_replacement_bitmap(layer, fCanvas); |
- if (fPicture->fBBH.get()) { |
+ if (fPicture->bbh()) { |
while (fOps[fIndex] < layer->stop()) { |
++fIndex; |
} |
@@ -190,7 +195,7 @@ private: |
SkCanvas* fCanvas; |
GrLayerCache* fLayerCache; |
const SkPicture* fTopLevelPicture; |
- const SkPicture* fPicture; |
+ const SkBigPicture* fPicture; |
const SkMatrix fInitialMatrix; |
SkPicture::AbortCallback* fCallback; |
@@ -211,9 +216,15 @@ int GrRecordReplaceDraw(const SkPicture* picture, |
SkPicture::AbortCallback* callback) { |
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
- // TODO: drawablePicts? |
- ReplaceDraw draw(canvas, layerCache, NULL, 0, |
- picture, picture, |
- initialMatrix, callback, NULL, 0); |
- return draw.draw(); |
+ if (const SkBigPicture* bp = picture->asSkBigPicture()) { |
+ // TODO: drawablePicts? |
+ ReplaceDraw draw(canvas, layerCache, NULL, 0, |
+ bp, bp, |
+ initialMatrix, callback, NULL, 0); |
+ return draw.draw(); |
+ } else { |
+ // TODO: can we assume / assert this doesn't happen? |
+ picture->playback(canvas, callback); |
+ return 0; |
+ } |
} |