// 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,
};
}
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) {