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

Side by Side Diff: tools/bench_playback.cpp

Issue 234913004: use SkIntToScalar, fix windows build (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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 12 matching lines...) Expand all
23 DEFINE_bool(skr, false, "Play via SkRecord instead of SkPicture."); 23 DEFINE_bool(skr, false, "Play via SkRecord instead of SkPicture.");
24 DEFINE_int32(tile, 1000000000, "Simulated tile size."); 24 DEFINE_int32(tile, 1000000000, "Simulated tile size.");
25 25
26 static void bench(SkPMColor* scratch, SkPicture& src, const char* name) { 26 static void bench(SkPMColor* scratch, SkPicture& src, const char* name) {
27 SkRecord record; 27 SkRecord record;
28 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, src.width(), src.h eight()); 28 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, src.width(), src.h eight());
29 src.draw(&recorder); 29 src.draw(&recorder);
30 30
31 SkAutoTDelete<SkCanvas> canvas( 31 SkAutoTDelete<SkCanvas> canvas(
32 SkCanvas::NewRasterDirectN32(src.width(), src.height(), scratch, 0)); 32 SkCanvas::NewRasterDirectN32(src.width(), src.height(), scratch, 0));
33 canvas->clipRect(SkRect::MakeWH(FLAGS_tile, FLAGS_tile)); 33 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLA GS_tile)));
34 34
35 const SkMSec start = SkTime::GetMSecs(); 35 const SkMSec start = SkTime::GetMSecs();
36 for (int i = 0; i < FLAGS_loops; i++) { 36 for (int i = 0; i < FLAGS_loops; i++) {
37 if (FLAGS_skr) { 37 if (FLAGS_skr) {
38 SkRecordDraw(record, canvas.get()); 38 SkRecordDraw(record, canvas.get());
39 } else { 39 } else {
40 src.draw(canvas.get()); 40 src.draw(canvas.get());
41 } 41 }
42 } 42 }
43 43
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bench(scratch.get(), *src, filename.c_str()); 84 bench(scratch.get(), *src, filename.c_str());
85 } 85 }
86 return failed ? 1 : 0; 86 return failed ? 1 : 0;
87 } 87 }
88 88
89 #if !defined SK_BUILD_FOR_IOS 89 #if !defined SK_BUILD_FOR_IOS
90 int main(int argc, char * const argv[]) { 90 int main(int argc, char * const argv[]) {
91 return tool_main(argc, (char**) argv); 91 return tool_main(argc, (char**) argv);
92 } 92 }
93 #endif 93 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698