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