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 "DumpRecord.h" | 8 #include "DumpRecord.h" |
| 9 #include "LazyDecodeBitmap.h" |
9 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
10 #include "SkPicture.h" | 11 #include "SkPicture.h" |
11 #include "SkPictureRecorder.h" | 12 #include "SkPictureRecorder.h" |
12 #include "SkRecordDraw.h" | 13 #include "SkRecordDraw.h" |
13 #include "SkRecordOpts.h" | 14 #include "SkRecordOpts.h" |
14 #include "SkRecorder.h" | 15 #include "SkRecorder.h" |
15 #include "SkStream.h" | 16 #include "SkStream.h" |
16 #include <stdio.h> | 17 #include <stdio.h> |
17 | 18 |
18 DEFINE_string2(skps, r, "", ".SKPs to dump."); | 19 DEFINE_string2(skps, r, "", ".SKPs to dump."); |
(...skipping 23 matching lines...) Expand all Loading... |
42 for (int i = 0; i < FLAGS_skps.count(); i++) { | 43 for (int i = 0; i < FLAGS_skps.count(); i++) { |
43 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, FLAGS_skps[i])) { | 44 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, FLAGS_skps[i])) { |
44 continue; | 45 continue; |
45 } | 46 } |
46 | 47 |
47 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(FLAGS_skps[i])); | 48 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(FLAGS_skps[i])); |
48 if (!stream) { | 49 if (!stream) { |
49 SkDebugf("Could not read %s.\n", FLAGS_skps[i]); | 50 SkDebugf("Could not read %s.\n", FLAGS_skps[i]); |
50 return 1; | 51 return 1; |
51 } | 52 } |
52 SkAutoTUnref<SkPicture> src(SkPicture::CreateFromStream(stream)); | 53 SkAutoTUnref<SkPicture> src( |
| 54 SkPicture::CreateFromStream(stream, sk_tools::LazyDecodeBitmap))
; |
53 if (!src) { | 55 if (!src) { |
54 SkDebugf("Could not read %s as an SkPicture.\n", FLAGS_skps[i]); | 56 SkDebugf("Could not read %s as an SkPicture.\n", FLAGS_skps[i]); |
55 return 1; | 57 return 1; |
56 } | 58 } |
57 const int w = SkScalarCeilToInt(src->cullRect().width()); | 59 const int w = SkScalarCeilToInt(src->cullRect().width()); |
58 const int h = SkScalarCeilToInt(src->cullRect().height()); | 60 const int h = SkScalarCeilToInt(src->cullRect().height()); |
59 | 61 |
60 SkRecord record; | 62 SkRecord record; |
61 SkRecorder canvas(&record, w, h); | 63 SkRecorder canvas(&record, w, h); |
62 src->playback(&canvas); | 64 src->playback(&canvas); |
(...skipping 23 matching lines...) Expand all Loading... |
86 } | 88 } |
87 | 89 |
88 return 0; | 90 return 0; |
89 } | 91 } |
90 | 92 |
91 #if !defined SK_BUILD_FOR_IOS | 93 #if !defined SK_BUILD_FOR_IOS |
92 int main(int argc, char * const argv[]) { | 94 int main(int argc, char * const argv[]) { |
93 return tool_main(argc, (char**) argv); | 95 return tool_main(argc, (char**) argv); |
94 } | 96 } |
95 #endif | 97 #endif |
OLD | NEW |