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

Side by Side Diff: tools/bench_playback.cpp

Issue 243243003: anticipate more optimizations by renaming some files and methods (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 | « tests/RecordDrawTest.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"
11 #include "SkOSFile.h" 11 #include "SkOSFile.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 #include "SkRecordDraw.h" 13 #include "SkRecordDraw.h"
14 #include "SkRecordOpts.h"
14 #include "SkRecorder.h" 15 #include "SkRecorder.h"
15 #include "SkStream.h" 16 #include "SkStream.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 #include "SkTime.h" 18 #include "SkTime.h"
18 19
19 __SK_FORCE_IMAGE_DECODER_LINKING; 20 __SK_FORCE_IMAGE_DECODER_LINKING;
20 21
21 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record ."); 22 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record .");
22 DEFINE_int32(loops, 10, "Number of times to play back each SKP."); 23 DEFINE_int32(loops, 10, "Number of times to play back each SKP.");
23 DEFINE_bool(skr, false, "Play via SkRecord instead of SkPicture."); 24 DEFINE_bool(skr, false, "Play via SkRecord instead of SkPicture.");
24 DEFINE_int32(tile, 1000000000, "Simulated tile size."); 25 DEFINE_int32(tile, 1000000000, "Simulated tile size.");
25 26
26 static void bench(SkPMColor* scratch, SkPicture& src, const char* name) { 27 static void bench(SkPMColor* scratch, SkPicture& src, const char* name) {
27 // We don't use the public SkRecording interface here because we need kWrite Only_Mode. 28 // We don't use the public SkRecording interface here because we need kWrite Only_Mode.
28 // (We don't want SkPicturePlayback to be able to optimize playing into our SkRecord.) 29 // (We don't want SkPicturePlayback to be able to optimize playing into our SkRecord.)
29 SkRecord record; 30 SkRecord record;
30 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, src.width(), src.h eight()); 31 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, src.width(), src.h eight());
31 src.draw(&recorder); 32 src.draw(&recorder);
32 33
34 SkRecordOptimize(&record);
35
33 SkAutoTDelete<SkCanvas> canvas(SkCanvas::NewRasterDirectN32(src.width(), 36 SkAutoTDelete<SkCanvas> canvas(SkCanvas::NewRasterDirectN32(src.width(),
34 src.height(), 37 src.height(),
35 scratch, 38 scratch,
36 src.width() * si zeof(SkPMColor))); 39 src.width() * si zeof(SkPMColor)));
37 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLA GS_tile))); 40 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLA GS_tile)));
38 41
39 const SkMSec start = SkTime::GetMSecs(); 42 const SkMSec start = SkTime::GetMSecs();
40 for (int i = 0; i < FLAGS_loops; i++) { 43 for (int i = 0; i < FLAGS_loops; i++) {
41 if (FLAGS_skr) { 44 if (FLAGS_skr) {
42 SkRecordDraw(record, canvas.get()); 45 SkRecordDraw(record, canvas.get());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bench(scratch.get(), *src, filename.c_str()); 91 bench(scratch.get(), *src, filename.c_str());
89 } 92 }
90 return failed ? 1 : 0; 93 return failed ? 1 : 0;
91 } 94 }
92 95
93 #if !defined SK_BUILD_FOR_IOS 96 #if !defined SK_BUILD_FOR_IOS
94 int main(int argc, char * const argv[]) { 97 int main(int argc, char * const argv[]) {
95 return tool_main(argc, (char**) argv); 98 return tool_main(argc, (char**) argv);
96 } 99 }
97 #endif 100 #endif
OLDNEW
« no previous file with comments | « tests/RecordDrawTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698