OLD | NEW |
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 "SkPicture.h" | 9 #include "SkPicture.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
11 #include "SkStream.h" | 11 #include "SkStream.h" |
12 | 12 |
13 DEFINE_string2(input, i, "", "skp on which to report"); | 13 DEFINE_string2(input, i, "", "skp on which to report"); |
14 DEFINE_bool2(version, v, true, "version"); | 14 DEFINE_bool2(version, v, true, "version"); |
15 DEFINE_bool2(width, w, true, "width"); | 15 DEFINE_bool2(cullRect, c, true, "cullRect"); |
16 DEFINE_bool2(height, h, true, "height"); | |
17 DEFINE_bool2(flags, f, true, "flags"); | 16 DEFINE_bool2(flags, f, true, "flags"); |
18 DEFINE_bool2(tags, t, true, "tags"); | 17 DEFINE_bool2(tags, t, true, "tags"); |
19 DEFINE_bool2(quiet, q, false, "quiet"); | 18 DEFINE_bool2(quiet, q, false, "quiet"); |
20 | 19 |
21 // This tool can print simple information about an SKP but its main use | 20 // This tool can print simple information about an SKP but its main use |
22 // is just to check if an SKP has been truncated during the recording | 21 // is just to check if an SKP has been truncated during the recording |
23 // process. | 22 // process. |
24 // return codes: | 23 // return codes: |
25 static const int kSuccess = 0; | 24 static const int kSuccess = 0; |
26 static const int kTruncatedFile = 1; | 25 static const int kTruncatedFile = 1; |
(...skipping 25 matching lines...) Expand all Loading... |
52 size_t totStreamSize = stream.getLength(); | 51 size_t totStreamSize = stream.getLength(); |
53 | 52 |
54 SkPictInfo info; | 53 SkPictInfo info; |
55 if (!SkPicture::InternalOnly_StreamIsSKP(&stream, &info)) { | 54 if (!SkPicture::InternalOnly_StreamIsSKP(&stream, &info)) { |
56 return kNotAnSKP; | 55 return kNotAnSKP; |
57 } | 56 } |
58 | 57 |
59 if (FLAGS_version && !FLAGS_quiet) { | 58 if (FLAGS_version && !FLAGS_quiet) { |
60 SkDebugf("Version: %d\n", info.fVersion); | 59 SkDebugf("Version: %d\n", info.fVersion); |
61 } | 60 } |
62 if (FLAGS_width && !FLAGS_quiet) { | 61 if (FLAGS_cullRect && !FLAGS_quiet) { |
63 SkDebugf("Width: %d\n", info.fWidth); | 62 SkDebugf("Cull Rect: %f,%f,%f,%f\n", |
64 } | 63 info.fCullRect.fLeft, info.fCullRect.fTop, |
65 if (FLAGS_height && !FLAGS_quiet) { | 64 info.fCullRect.fRight, info.fCullRect.fBottom); |
66 SkDebugf("Height: %d\n", info.fHeight); | |
67 } | 65 } |
68 if (FLAGS_flags && !FLAGS_quiet) { | 66 if (FLAGS_flags && !FLAGS_quiet) { |
69 SkDebugf("Flags: 0x%x\n", info.fFlags); | 67 SkDebugf("Flags: 0x%x\n", info.fFlags); |
70 } | 68 } |
71 | 69 |
72 if (!stream.readBool()) { | 70 if (!stream.readBool()) { |
73 // If we read true there's a picture playback object flattened | 71 // If we read true there's a picture playback object flattened |
74 // in the file; if false, there isn't a playback, so we're done | 72 // in the file; if false, there isn't a playback, so we're done |
75 // reading the file. | 73 // reading the file. |
76 return kSuccess; | 74 return kSuccess; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 151 } |
154 | 152 |
155 return kSuccess; | 153 return kSuccess; |
156 } | 154 } |
157 | 155 |
158 #if !defined SK_BUILD_FOR_IOS | 156 #if !defined SK_BUILD_FOR_IOS |
159 int main(int argc, char * const argv[]) { | 157 int main(int argc, char * const argv[]) { |
160 return tool_main(argc, (char**) argv); | 158 return tool_main(argc, (char**) argv); |
161 } | 159 } |
162 #endif | 160 #endif |
OLD | NEW |