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

Side by Side Diff: tools/bench_record.cpp

Issue 231653002: SkRecordDraw: skip draw ops when the clip is empty (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pop cull unconditionally 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
« no previous file with comments | « tests/RecorderTest.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 static void bench_record(SkPicture* src, const char* name, PictureFactory pictur eFactory) { 74 static void bench_record(SkPicture* src, const char* name, PictureFactory pictur eFactory) {
75 const SkMSec start = SkTime::GetMSecs(); 75 const SkMSec start = SkTime::GetMSecs();
76 const int width = src ? src->width() : FLAGS_nullSize; 76 const int width = src ? src->width() : FLAGS_nullSize;
77 const int height = src ? src->height() : FLAGS_nullSize; 77 const int height = src ? src->height() : FLAGS_nullSize;
78 78
79 for (int i = 0; i < FLAGS_loops; i++) { 79 for (int i = 0; i < FLAGS_loops; i++) {
80 if (FLAGS_skr) { 80 if (FLAGS_skr) {
81 SkRecord record; 81 SkRecord record;
82 SkRecorder canvas(&record, width, height); 82 SkRecorder canvas(SkRecorder::kWriteOnly_Mode, &record, width, heigh t);
83 if (NULL != src) { 83 if (NULL != src) {
84 src->draw(&canvas); 84 src->draw(&canvas);
85 } 85 }
86 } else { 86 } else {
87 int recordingFlags = FLAGS_flags; 87 int recordingFlags = FLAGS_flags;
88 SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recording Flags)); 88 SkAutoTUnref<SkPicture> dst(pictureFactory(width, height, &recording Flags));
89 SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags ); 89 SkCanvas* canvas = dst->beginRecording(width, height, recordingFlags );
90 if (NULL != src) { 90 if (NULL != src) {
91 src->draw(canvas); 91 src->draw(canvas);
92 } 92 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 bench_record(src, filename.c_str(), pictureFactory); 137 bench_record(src, filename.c_str(), pictureFactory);
138 } 138 }
139 return failed ? 1 : 0; 139 return failed ? 1 : 0;
140 } 140 }
141 141
142 #if !defined SK_BUILD_FOR_IOS 142 #if !defined SK_BUILD_FOR_IOS
143 int main(int argc, char * const argv[]) { 143 int main(int argc, char * const argv[]) {
144 return tool_main(argc, (char**) argv); 144 return tool_main(argc, (char**) argv);
145 } 145 }
146 #endif 146 #endif
OLDNEW
« no previous file with comments | « tests/RecorderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698