aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureRecorder.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-11-18 11:08:05 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-18 11:08:05 -0800
commit6be2aa9a251bf6022570a03140f956655b3ef1da (patch)
tree52ccd2b4fd1fde02617f08ee03d30faee917c38f /src/core/SkPictureRecorder.cpp
parentad3a8846f8963e03faa6de647502e1c553161ecb (diff)
wip for drawables
Idea: 1. in its mutable recording state, keep a table of drawables on the side, and store an index in the record list. 2. In "immediate-mode" draw, just call the clients drawable directly (need access to our private list to turn the stored index into a proc) 3. when we "snap", we replace the list of drawables with a list of (sub) pictures, and then during playback of the snapped picture, we invoke a private drawable which just calls "drawPicture" on the index'd subpicture. Review URL: https://codereview.chromium.org/727363003
Diffstat (limited to 'src/core/SkPictureRecorder.cpp')
-rw-r--r--src/core/SkPictureRecorder.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 3441a0dfeb..bc8bffb9b3 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkData.h"
#include "SkLayerInfo.h"
#include "SkPictureRecorder.h"
#include "SkRecord.h"
@@ -60,7 +61,12 @@ SkPicture* SkPictureRecorder::endRecording() {
}
}
- SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, fRecord.detach(), fBBH.get()));
+ // TODO: we should remember these from our caller
+ SkBBHFactory* factory = NULL;
+ uint32_t recordFlags = 0;
+ SkAutoDataUnref drawablePicts(fRecorder->newDrawableSnapshot(factory, recordFlags));
+ SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, fRecord.detach(),
+ drawablePicts, fBBH.get()));
if (saveLayerData) {
pict->EXPERIMENTAL_addAccelData(saveLayerData);
@@ -73,5 +79,7 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
if (NULL == canvas) {
return;
}
- SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
+
+ int drawableCount = 0;
+ SkRecordDraw(*fRecord, canvas, NULL, drawableCount, NULL/*bbh*/, NULL/*callback*/);
}