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 "LazyDecodeBitmap.h" |
8 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
9 #include "SkPicture.h" | 10 #include "SkPicture.h" |
10 #include "SkPictureRecorder.h" | 11 #include "SkPictureRecorder.h" |
11 #include "SkStream.h" | 12 #include "SkStream.h" |
12 | 13 |
13 DEFINE_string2(readFile, r, "", "skp file to process."); | 14 DEFINE_string2(readFile, r, "", "skp file to process."); |
14 DEFINE_bool2(quiet, q, false, "quiet"); | 15 DEFINE_bool2(quiet, q, false, "quiet"); |
15 | 16 |
16 // This tool just loads a single skp, replays into a new SkPicture (to | 17 // This tool just loads a single skp, replays into a new SkPicture (to |
17 // regenerate the GPU-specific tracking information) and reports | 18 // regenerate the GPU-specific tracking information) and reports |
(...skipping 16 matching lines...) Expand all Loading... |
34 } | 35 } |
35 | 36 |
36 SkFILEStream inputStream(FLAGS_readFile[0]); | 37 SkFILEStream inputStream(FLAGS_readFile[0]); |
37 if (!inputStream.isValid()) { | 38 if (!inputStream.isValid()) { |
38 if (!FLAGS_quiet) { | 39 if (!FLAGS_quiet) { |
39 SkDebugf("Couldn't open file\n"); | 40 SkDebugf("Couldn't open file\n"); |
40 } | 41 } |
41 return kError; | 42 return kError; |
42 } | 43 } |
43 | 44 |
44 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream)); | 45 SkPicture::InstallPixelRefProc proc = &sk_tools::LazyDecodeBitmap; |
| 46 |
| 47 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
45 if (nullptr == picture.get()) { | 48 if (nullptr == picture.get()) { |
46 if (!FLAGS_quiet) { | 49 if (!FLAGS_quiet) { |
47 SkDebugf("Could not read the SkPicture\n"); | 50 SkDebugf("Could not read the SkPicture\n"); |
48 } | 51 } |
49 return kError; | 52 return kError; |
50 } | 53 } |
51 | 54 |
52 // The SkPicture tracking information is only generated during recording | 55 // The SkPicture tracking information is only generated during recording |
53 // an isn't serialized. Replay the picture to regenerated the tracking data. | 56 // an isn't serialized. Replay the picture to regenerated the tracking data. |
54 SkPictureRecorder recorder; | 57 SkPictureRecorder recorder; |
(...skipping 13 matching lines...) Expand all Loading... |
68 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); | 71 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); |
69 return kError; | 72 return kError; |
70 #endif | 73 #endif |
71 } | 74 } |
72 | 75 |
73 #if !defined SK_BUILD_FOR_IOS | 76 #if !defined SK_BUILD_FOR_IOS |
74 int main(int argc, char * const argv[]) { | 77 int main(int argc, char * const argv[]) { |
75 return tool_main(argc, (char**) argv); | 78 return tool_main(argc, (char**) argv); |
76 } | 79 } |
77 #endif | 80 #endif |
OLD | NEW |