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 "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
10 #include "SkDeferredCanvas.h" | 10 #include "SkDeferredCanvas.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 int tool_main(int argc, char** argv); | 40 int tool_main(int argc, char** argv); |
41 int tool_main(int argc, char** argv) { | 41 int tool_main(int argc, char** argv) { |
42 SkCommandLineFlags::Parse(argc, argv); | 42 SkCommandLineFlags::Parse(argc, argv); |
43 | 43 |
44 for (int i = 0; i < FLAGS_skps.count(); i++) { | 44 for (int i = 0; i < FLAGS_skps.count(); i++) { |
45 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, FLAGS_skps[i])) { | 45 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, FLAGS_skps[i])) { |
46 continue; | 46 continue; |
47 } | 47 } |
48 | 48 |
49 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(FLAGS_skps[i])); | 49 std::unique_ptr<SkStream> stream = SkStream::MakeFromFile(FLAGS_skps[i])
; |
50 if (!stream) { | 50 if (!stream) { |
51 SkDebugf("Could not read %s.\n", FLAGS_skps[i]); | 51 SkDebugf("Could not read %s.\n", FLAGS_skps[i]); |
52 return 1; | 52 return 1; |
53 } | 53 } |
54 sk_sp<SkPicture> src(SkPicture::MakeFromStream(stream)); | 54 sk_sp<SkPicture> src(SkPicture::MakeFromStream(stream.get())); |
55 if (!src) { | 55 if (!src) { |
56 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]); |
57 return 1; | 57 return 1; |
58 } | 58 } |
59 if (FLAGS_defer) { | 59 if (FLAGS_defer) { |
60 SkPictureRecorder recorder; | 60 SkPictureRecorder recorder; |
61 SkDeferredCanvas deferred(recorder.beginRecording(src->cullRect())); | 61 SkDeferredCanvas deferred(recorder.beginRecording(src->cullRect())); |
62 src->playback(&deferred); | 62 src->playback(&deferred); |
63 src = recorder.finishRecordingAsPicture(); | 63 src = recorder.finishRecordingAsPicture(); |
64 } | 64 } |
(...skipping 29 matching lines...) Expand all Loading... |
94 } | 94 } |
95 | 95 |
96 return 0; | 96 return 0; |
97 } | 97 } |
98 | 98 |
99 #if !defined SK_BUILD_FOR_IOS | 99 #if !defined SK_BUILD_FOR_IOS |
100 int main(int argc, char * const argv[]) { | 100 int main(int argc, char * const argv[]) { |
101 return tool_main(argc, (char**) argv); | 101 return tool_main(argc, (char**) argv); |
102 } | 102 } |
103 #endif | 103 #endif |
OLD | NEW |