Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: src/core/SkCanvasDrawable.cpp

Issue 727363003: wip for drawables (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make the pictures in the array also const (the array already was const) Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvasDrawable.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvasDrawable.cpp
diff --git a/src/core/SkCanvasDrawable.cpp b/src/core/SkCanvasDrawable.cpp
index 7c01738dd60d74b0a4a8c41b544688a5b9614af6..0065d430f900b5be411a167e1ee572185bcc66c5 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();
+}
« no previous file with comments | « src/core/SkCanvasDrawable.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698