aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvasDrawable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkCanvasDrawable.cpp')
-rw-r--r--src/core/SkCanvasDrawable.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/SkCanvasDrawable.cpp b/src/core/SkCanvasDrawable.cpp
index 7c01738dd6..0065d430f9 100644
--- a/src/core/SkCanvasDrawable.cpp
+++ b/src/core/SkCanvasDrawable.cpp
@@ -28,6 +28,10 @@ void SkCanvasDrawable::draw(SkCanvas* canvas) {
this->onDraw(canvas);
}
+SkPicture* SkCanvasDrawable::newPictureSnapshot(SkBBHFactory* bbhFactory, uint32_t recordFlags) {
+ return this->onNewPictureSnapshot(bbhFactory, recordFlags);
+}
+
uint32_t SkCanvasDrawable::getGenerationID() {
if (0 == fGenerationID) {
fGenerationID = next_generation_id();
@@ -35,16 +39,21 @@ uint32_t SkCanvasDrawable::getGenerationID() {
return fGenerationID;
}
-bool SkCanvasDrawable::getBounds(SkRect* boundsPtr) {
- SkRect bounds;
- if (!boundsPtr) {
- boundsPtr = &bounds;
- }
- return this->onGetBounds(boundsPtr);
+SkRect SkCanvasDrawable::getBounds() {
+ return this->onGetBounds();
}
void SkCanvasDrawable::notifyDrawingChanged() {
fGenerationID = 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+#include "SkPictureRecorder.h"
+
+SkPicture* SkCanvasDrawable::onNewPictureSnapshot(SkBBHFactory* bbhFactory, uint32_t recordFlags) {
+ const SkRect bounds = this->getBounds();
+ SkPictureRecorder recorder;
+ this->draw(recorder.beginRecording(bounds.width(), bounds.height(), bbhFactory, recordFlags));
+ return recorder.endRecording();
+}