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 "SkPictureAnalyzer.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 |
18 // the value of the suitableForGpuRasterization method. | 19 // the value of the suitableForGpuRasterization method. |
19 // Return codes: | 20 // Return codes: |
(...skipping 30 matching lines...) Expand all Loading... |
50 } | 51 } |
51 | 52 |
52 // The SkPicture tracking information is only generated during recording | 53 // The SkPicture tracking information is only generated during recording |
53 // an isn't serialized. Replay the picture to regenerated the tracking data. | 54 // an isn't serialized. Replay the picture to regenerated the tracking data. |
54 SkPictureRecorder recorder; | 55 SkPictureRecorder recorder; |
55 picture->playback(recorder.beginRecording(picture->cullRect().width(), | 56 picture->playback(recorder.beginRecording(picture->cullRect().width(), |
56 picture->cullRect().height(), | 57 picture->cullRect().height(), |
57 nullptr, 0)); | 58 nullptr, 0)); |
58 sk_sp<SkPicture> recorded(recorder.finishRecordingAsPicture()); | 59 sk_sp<SkPicture> recorded(recorder.finishRecordingAsPicture()); |
59 | 60 |
60 if (recorded->suitableForGpuRasterization(nullptr)) { | 61 if (SkPictureGpuAnalyzer(recorded).suitableForGpuRasterization(nullptr)) { |
61 SkDebugf("suitable\n"); | 62 SkDebugf("suitable\n"); |
62 } else { | 63 } else { |
63 SkDebugf("unsuitable\n"); | 64 SkDebugf("unsuitable\n"); |
64 } | 65 } |
65 | 66 |
66 return kSuccess; | 67 return kSuccess; |
67 #else | 68 #else |
68 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); | 69 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); |
69 return kError; | 70 return kError; |
70 #endif | 71 #endif |
71 } | 72 } |
72 | 73 |
73 #if !defined SK_BUILD_FOR_IOS | 74 #if !defined SK_BUILD_FOR_IOS |
74 int main(int argc, char * const argv[]) { | 75 int main(int argc, char * const argv[]) { |
75 return tool_main(argc, (char**) argv); | 76 return tool_main(argc, (char**) argv); |
76 } | 77 } |
77 #endif | 78 #endif |
OLD | NEW |