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

Side by Side Diff: tools/dump_record.cpp

Issue 1416913003: Clean up some dead code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: kill dump-record Created 5 years, 2 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 | « tools/chromium/chrome_changes ('k') | tools/flatten.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include <stdio.h>
9
10 #include "SkCommandLineFlags.h"
11 #include "SkGraphics.h"
12 #include "SkPicture.h"
13 #include "SkRecordOpts.h"
14 #include "SkRecorder.h"
15 #include "SkStream.h"
16
17 #include "DumpRecord.h"
18 #include "LazyDecodeBitmap.h"
19
20 #include <stdlib.h>
21
22 DEFINE_string2(skps, r, "", ".SKPs to dump.");
23 DEFINE_string(match, "", "The usual filters on file names to dump.");
24 DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
25 DEFINE_int32(tile, 1000000000, "Simulated tile size.");
26 DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else i n first column.");
27
28 static void dump(const char* name, int w, int h, const SkRecord& record) {
29 SkBitmap bitmap;
30 bitmap.allocN32Pixels(w, h);
31 SkCanvas canvas(bitmap);
32 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile),
33 SkIntToScalar(FLAGS_tile)));
34
35 printf("%s %s\n", FLAGS_optimize ? "optimized" : "not-optimized", name);
36
37 DumpRecord(record, &canvas, FLAGS_timeWithCommand);
38 }
39
40
41 int tool_main(int argc, char** argv);
42 int tool_main(int argc, char** argv) {
43 SkCommandLineFlags::Parse(argc, argv);
44 SkAutoGraphics ag;
45
46 for (int i = 0; i < FLAGS_skps.count(); i++) {
47 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, FLAGS_skps[i])) {
48 continue;
49 }
50
51 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(FLAGS_skps[i]));
52 if (!stream) {
53 SkDebugf("Could not read %s.\n", FLAGS_skps[i]);
54 exit(1);
55 }
56 SkAutoTUnref<SkPicture> src(
57 SkPicture::CreateFromStream(stream, sk_tools::LazyDecodeBitmap)) ;
58 if (!src) {
59 SkDebugf("Could not read %s as an SkPicture.\n", FLAGS_skps[i]);
60 exit(1);
61 }
62 const int w = SkScalarCeilToInt(src->cullRect().width());
63 const int h = SkScalarCeilToInt(src->cullRect().height());
64
65 SkRecord record;
66 SkRecorder canvas(&record, w, h);
67 src->playback(&canvas);
68
69 if (FLAGS_optimize) {
70 SkRecordOptimize(&record);
71 }
72
73 dump(FLAGS_skps[i], w, h, record);
74 }
75
76 return 0;
77 }
78
79 #if !defined SK_BUILD_FOR_IOS
80 int main(int argc, char * const argv[]) {
81 return tool_main(argc, (char**) argv);
82 }
83 #endif
OLDNEW
« no previous file with comments | « tools/chromium/chrome_changes ('k') | tools/flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698