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

Unified Diff: src/core/SkPictureRecorder.cpp

Issue 454123003: Plumbing for using a BBH in SkRecordDraw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clang says asserts are always true Created 6 years, 4 months 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/SkPicture.cpp ('k') | src/core/SkRecordDraw.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecorder.cpp
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 7985145001793fae95227a36f487410d351ceb9e..7d24caf6fce880f9e32a2dec6c7de0e11c8e7d8a 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -26,9 +26,11 @@ SkCanvas* SkPictureRecorder::beginRecording(int width, int height,
const SkISize size = SkISize::Make(width, height);
if (NULL != bbhFactory) {
- SkAutoTUnref<SkBBoxHierarchy> tree((*bbhFactory)(width, height));
- SkASSERT(NULL != tree);
- fPictureRecord.reset(SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordFlags, tree.get())));
+ // We don't need to hold a ref on the BBH ourselves, but might as well for
+ // consistency with EXPERIMENTAL_beginRecording(), which does need to.
+ fBBH.reset((*bbhFactory)(width, height));
+ SkASSERT(NULL != fBBH.get());
+ fPictureRecord.reset(SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordFlags, fBBH.get())));
} else {
fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (size, recordFlags)));
}
@@ -42,7 +44,11 @@ SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(int width, int height,
fWidth = width;
fHeight = height;
- // TODO: plumb bbhFactory through
+ if (NULL != bbhFactory) {
+ fBBH.reset((*bbhFactory)(width, height));
+ SkASSERT(NULL != fBBH.get());
+ }
+
fRecord.reset(SkNEW(SkRecord));
fRecorder.reset(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height)));
return this->getRecordingCanvas();
@@ -59,7 +65,7 @@ SkPicture* SkPictureRecorder::endRecording() {
SkPicture* picture = NULL;
if (NULL != fRecord.get()) {
- picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, fRecord.detach()));
+ picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, fRecord.detach(), fBBH.get()));
}
if (NULL != fPictureRecord.get()) {
@@ -83,7 +89,7 @@ void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
}
if (NULL != fRecord.get()) {
- SkRecordDraw(*fRecord, canvas);
+ SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
}
if (NULL != fPictureRecord.get()) {
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/core/SkRecordDraw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698