Plumbing for using a BBH in SkRecordDraw.
For now this only creates a degenerate bounding box hierarchy where all ops
just have maximal bounds. I will flesh out FillBounds in future CL(s).
Not quite sure why QuadTree and TileGrid aren't drawing right---haven't even
looked at the diffs yet---so I've disabled those test modes for now. RTree
seems fine, so that'll at least get us coverage for all this new plumbing.
BUG=skia:
R=robertphillips@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/454123003
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index b402297..8b2bdab 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -14,7 +14,6 @@
#include "SkPictureRecorder.h"
#include "SkPictureStateTree.h"
-#include "SkBBHFactory.h"
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkChunkAlloc.h"
@@ -139,7 +138,7 @@
// This for compatibility with serialization code only. This is not cheap.
static SkPicture* backport(const SkRecord& src, int width, int height) {
SkPictureRecorder recorder;
- SkRecordDraw(src, recorder.beginRecording(width, height));
+ SkRecordDraw(src, recorder.beginRecording(width, height), NULL/*bbh*/, NULL/*callback*/);
return recorder.endRecording();
}
@@ -267,7 +266,7 @@
playback.draw(canvas, callback);
}
if (NULL != fRecord.get()) {
- SkRecordDraw(*fRecord, canvas, callback);
+ SkRecordDraw(*fRecord, canvas, fBBH.get(), callback);
}
}
@@ -490,11 +489,16 @@
}
// fRecord OK
-SkPicture::SkPicture(int width, int height, SkRecord* record)
+SkPicture::SkPicture(int width, int height, SkRecord* record, SkBBoxHierarchy* bbh)
: fWidth(width)
, fHeight(height)
, fRecord(record)
+ , fBBH(SkSafeRef(bbh))
, fRecordWillPlayBackBitmaps(SkRecordWillPlaybackBitmaps(*record)) {
+ // TODO: delay as much of this work until just before first playback?
+ if (fBBH.get()) {
+ SkRecordFillBounds(*record, fBBH.get());
+ }
this->needsNewGenID();
}