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

Side by Side Diff: tools/bench_record.cpp

Issue 248033002: Rearrange SkRecord public API to fit better with cc/resources/picture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add forgetRecord() Created 6 years, 8 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 unified diff | Download patch
« include/record/SkRecording.h ('K') | « tests/RecordingTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkForceLinking.h" 9 #include "SkForceLinking.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return NULL; 55 return NULL;
56 } 56 }
57 57
58 static void bench_record(SkPicture* src, const char* name, SkBBHFactory* bbhFact ory) { 58 static void bench_record(SkPicture* src, const char* name, SkBBHFactory* bbhFact ory) {
59 const SkMSec start = SkTime::GetMSecs(); 59 const SkMSec start = SkTime::GetMSecs();
60 const int width = src ? src->width() : FLAGS_nullSize; 60 const int width = src ? src->width() : FLAGS_nullSize;
61 const int height = src ? src->height() : FLAGS_nullSize; 61 const int height = src ? src->height() : FLAGS_nullSize;
62 62
63 for (int i = 0; i < FLAGS_loops; i++) { 63 for (int i = 0; i < FLAGS_loops; i++) {
64 if (FLAGS_skr) { 64 if (FLAGS_skr) {
65 using EXPERIMENTAL::SkRecording; 65 EXPERIMENTAL::SkRecording recording(width, height);
66 SkRecording* recording = SkRecording::Create(width, height);
67 if (NULL != src) { 66 if (NULL != src) {
68 src->draw(recording->canvas()); 67 src->draw(recording.canvas());
69 } 68 }
70 SkDELETE(SkRecording::Delete(recording)); // delete the SkPlayback* . 69 // Release and delete the SkPlayback so that recording optimizes its SkRecord.
70 SkDELETE(recording.releasePlayback());
71 } else { 71 } else {
72 SkPictureRecorder recorder; 72 SkPictureRecorder recorder;
73 SkCanvas* canvas = recorder.beginRecording(width, height, bbhFactory , FLAGS_flags); 73 SkCanvas* canvas = recorder.beginRecording(width, height, bbhFactory , FLAGS_flags);
74 if (NULL != src) { 74 if (NULL != src) {
75 src->draw(canvas); 75 src->draw(canvas);
76 } 76 }
77 if (FLAGS_endRecording) { 77 if (FLAGS_endRecording) {
78 SkAutoTUnref<SkPicture> dst(recorder.endRecording()); 78 SkAutoTUnref<SkPicture> dst(recorder.endRecording());
79 } 79 }
80 } 80 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 bench_record(src, filename.c_str(), bbhFactory.get()); 127 bench_record(src, filename.c_str(), bbhFactory.get());
128 } 128 }
129 return failed ? 1 : 0; 129 return failed ? 1 : 0;
130 } 130 }
131 131
132 #if !defined SK_BUILD_FOR_IOS 132 #if !defined SK_BUILD_FOR_IOS
133 int main(int argc, char * const argv[]) { 133 int main(int argc, char * const argv[]) {
134 return tool_main(argc, (char**) argv); 134 return tool_main(argc, (char**) argv);
135 } 135 }
136 #endif 136 #endif
OLDNEW
« include/record/SkRecording.h ('K') | « tests/RecordingTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698