From 81f71b6630a9b7398bf983689436cccdd8dd3ff7 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 11 Nov 2014 04:54:49 -0800 Subject: 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 --- gm/multipicturedraw.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'gm/multipicturedraw.cpp') diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp index 8ce3deb763..250c28a8d9 100644 --- a/gm/multipicturedraw.cpp +++ b/gm/multipicturedraw.cpp @@ -55,9 +55,12 @@ static const SkPicture* make_hex_plane_picture(SkColor fillColor) { 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 @@ static const SkPicture* make_single_layer_hex_plane_picture() { 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 @@ static const SkPicture* make_tri_picture() { 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_tri_picture() { 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 @@ static const SkPicture* make_sierpinski_picture() { SkAutoTUnref 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 @@ static void create_content(SkMultiPictureDraw* mpd, PFContentMtd pfGen, { SkPictureRecorder recorder; + SkRTreeFactory bbhFactory; SkCanvas* pictureCanvas = recorder.beginRecording(SkIntToScalar(kPicWidth), - SkIntToScalar(kPicHeight)); + SkIntToScalar(kPicHeight), + &bbhFactory, + SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag); (*pfGen)(pictureCanvas, pictures); -- cgit v1.2.3