Respect SkPictureRecorder::kPlaybackDrawPicture_RecordFlag for SkDrawables

Review URL: https://codereview.chromium.org/1452193002
This commit is contained in:
djsollen 2015-11-17 06:18:31 -08:00 committed by Commit bot
parent 1970358b6d
commit aa6f739c99
2 changed files with 11 additions and 6 deletions

View File

@ -35,8 +35,8 @@ public:
// information should also be extracted at the same time.
kComputeSaveLayerInfo_RecordFlag = 0x01,
// If you call drawPicture() on the recording canvas, this flag forces
// that to use SkPicture::playback() immediately rather than (e.g.) reffing the picture.
// If you call drawPicture() or drawDrawable() on the recording canvas, this flag forces
// that object to playback its contents immediately rather than reffing the object.
kPlaybackDrawPicture_RecordFlag = 0x02,
};

View File

@ -158,11 +158,16 @@ void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const
}
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) {