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

Side by Side Diff: tools/dump_record.cpp

Issue 1462973002: add SkRecordOptimize2 and an experimental API for more aggressive opts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
« src/core/SkRecordOpts.cpp ('K') | « src/core/SkRecordOpts.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 "DumpRecord.h" 8 #include "DumpRecord.h"
9 #include "LazyDecodeBitmap.h" 9 #include "LazyDecodeBitmap.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
11 #include "SkPicture.h" 11 #include "SkPicture.h"
12 #include "SkRecordOpts.h" 12 #include "SkRecordOpts.h"
13 #include "SkRecorder.h" 13 #include "SkRecorder.h"
14 #include "SkStream.h" 14 #include "SkStream.h"
15 #include <stdio.h> 15 #include <stdio.h>
16 16
17 DEFINE_string2(skps, r, "", ".SKPs to dump."); 17 DEFINE_string2(skps, r, "", ".SKPs to dump.");
18 DEFINE_string(match, "", "The usual filters on file names to dump."); 18 DEFINE_string(match, "", "The usual filters on file names to dump.");
19 DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping."); 19 DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
20 DEFINE_bool(optimize2, false, "Run SkRecordOptimize2 before dumping.");
20 DEFINE_int32(tile, 1000000000, "Simulated tile size."); 21 DEFINE_int32(tile, 1000000000, "Simulated tile size.");
21 DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else i n first column."); 22 DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else i n first column.");
22 23
23 static void dump(const char* name, int w, int h, const SkRecord& record) { 24 static void dump(const char* name, int w, int h, const SkRecord& record) {
24 SkBitmap bitmap; 25 SkBitmap bitmap;
25 bitmap.allocN32Pixels(w, h); 26 bitmap.allocN32Pixels(w, h);
26 SkCanvas canvas(bitmap); 27 SkCanvas canvas(bitmap);
27 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), 28 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile),
28 SkIntToScalar(FLAGS_tile))); 29 SkIntToScalar(FLAGS_tile)));
29 30
(...skipping 26 matching lines...) Expand all
56 const int w = SkScalarCeilToInt(src->cullRect().width()); 57 const int w = SkScalarCeilToInt(src->cullRect().width());
57 const int h = SkScalarCeilToInt(src->cullRect().height()); 58 const int h = SkScalarCeilToInt(src->cullRect().height());
58 59
59 SkRecord record; 60 SkRecord record;
60 SkRecorder canvas(&record, w, h); 61 SkRecorder canvas(&record, w, h);
61 src->playback(&canvas); 62 src->playback(&canvas);
62 63
63 if (FLAGS_optimize) { 64 if (FLAGS_optimize) {
64 SkRecordOptimize(&record); 65 SkRecordOptimize(&record);
65 } 66 }
67 if (FLAGS_optimize2) {
68 SkRecordOptimize2(&record);
69 }
66 70
67 dump(FLAGS_skps[i], w, h, record); 71 dump(FLAGS_skps[i], w, h, record);
68 } 72 }
69 73
70 return 0; 74 return 0;
71 } 75 }
72 76
73 #if !defined SK_BUILD_FOR_IOS 77 #if !defined SK_BUILD_FOR_IOS
74 int main(int argc, char * const argv[]) { 78 int main(int argc, char * const argv[]) {
75 return tool_main(argc, (char**) argv); 79 return tool_main(argc, (char**) argv);
76 } 80 }
77 #endif 81 #endif
OLDNEW
« src/core/SkRecordOpts.cpp ('K') | « src/core/SkRecordOpts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698