Respect SkPictureRecorder::kPlaybackDrawPicture_RecordFlag for SkDrawables
Review URL: https://codereview.chromium.org/1452193002
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 0605d17..a3c9513 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -158,11 +158,16 @@
}
void SkRecorder::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
- if (!fDrawableList) {
- fDrawableList.reset(new SkDrawableList);
+ if (fDrawPictureMode == Record_DrawPictureMode) {
+ if (!fDrawableList) {
+ fDrawableList.reset(new SkDrawableList);
+ }
+ fDrawableList->append(drawable);
+ APPEND(DrawDrawable, this->copy(matrix), drawable->getBounds(), fDrawableList->count() - 1);
+ } else {
+ SkASSERT(fDrawPictureMode == Playback_DrawPictureMode);
+ drawable->draw(this, matrix);
}
- fDrawableList->append(drawable);
- APPEND(DrawDrawable, this->copy(matrix), drawable->getBounds(), fDrawableList->count() - 1);
}
void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {