Change where layer hoisting data is gathered
This CL:
1) removes the EXPERIMENTAL_optimize on SkCanvas & SkDevice
2) moves the saveLayer gathering step to endRecording
3) Replaces GPUOptimize with SkRecordComputeLayers
4) Update bench_pictures & render_pictures to provide the new flag
#2 also necessitated moving the BBH computation (and record optimization) out of SkPicture's ctor (and into endRecording)
Review URL: https://codereview.chromium.org/718443002
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index 8ce3deb..250c28a 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -55,9 +55,12 @@
stroke.setStrokeWidth(3);
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
- SkIntToScalar(kPicHeight));
+ SkIntToScalar(kPicHeight),
+ &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
SkScalar xPos, yPos = 0;
@@ -102,9 +105,11 @@
stroke.setStrokeWidth(3);
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
static const SkScalar kBig = 10000.0f;
- SkCanvas* canvas = recorder.beginRecording(kBig, kBig);
+ SkCanvas* canvas = recorder.beginRecording(kBig, kBig, &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
canvas->saveLayer(NULL, NULL);
@@ -156,9 +161,12 @@
stroke.setStrokeWidth(3);
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
- SkIntToScalar(kPicHeight));
+ SkIntToScalar(kPicHeight),
+ &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
SkRect r = tri.getBounds();
r.outset(2.0f, 2.0f); // outset for stroke
canvas->clipRect(r);
@@ -173,9 +181,12 @@
static const SkPicture* make_sub_picture(const SkPicture* tri) {
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
- SkIntToScalar(kPicHeight));
+ SkIntToScalar(kPicHeight),
+ &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
canvas->scale(1.0f/2.0f, 1.0f/2.0f);
@@ -205,9 +216,12 @@
SkAutoTUnref<const SkPicture> pic(make_tri_picture());
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
- SkIntToScalar(kPicHeight));
+ SkIntToScalar(kPicHeight),
+ &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
static const int kNumLevels = 4;
for (int i = 0; i < kNumLevels; ++i) {
@@ -343,9 +357,12 @@
{
SkPictureRecorder recorder;
+ SkRTreeFactory bbhFactory;
SkCanvas* pictureCanvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
- SkIntToScalar(kPicHeight));
+ SkIntToScalar(kPicHeight),
+ &bbhFactory,
+ SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
(*pfGen)(pictureCanvas, pictures);