| 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 "LazyDecodeBitmap.h" |
| 9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
| 10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (!inputStream.isValid()) { | 38 if (!inputStream.isValid()) { |
| 39 if (!FLAGS_quiet) { | 39 if (!FLAGS_quiet) { |
| 40 SkDebugf("Couldn't open file\n"); | 40 SkDebugf("Couldn't open file\n"); |
| 41 } | 41 } |
| 42 return kError; | 42 return kError; |
| 43 } | 43 } |
| 44 | 44 |
| 45 SkPicture::InstallPixelRefProc proc = &sk_tools::LazyDecodeBitmap; | 45 SkPicture::InstallPixelRefProc proc = &sk_tools::LazyDecodeBitmap; |
| 46 | 46 |
| 47 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 47 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
| 48 if (NULL == picture.get()) { | 48 if (nullptr == picture.get()) { |
| 49 if (!FLAGS_quiet) { | 49 if (!FLAGS_quiet) { |
| 50 SkDebugf("Could not read the SkPicture\n"); | 50 SkDebugf("Could not read the SkPicture\n"); |
| 51 } | 51 } |
| 52 return kError; | 52 return kError; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // The SkPicture tracking information is only generated during recording | 55 // The SkPicture tracking information is only generated during recording |
| 56 // 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. |
| 57 SkPictureRecorder recorder; | 57 SkPictureRecorder recorder; |
| 58 picture->playback(recorder.beginRecording(picture->cullRect().width(), | 58 picture->playback(recorder.beginRecording(picture->cullRect().width(), |
| 59 picture->cullRect().height(), | 59 picture->cullRect().height(), |
| 60 NULL, 0)); | 60 nullptr, 0)); |
| 61 SkAutoTUnref<SkPicture> recorded(recorder.endRecording()); | 61 SkAutoTUnref<SkPicture> recorded(recorder.endRecording()); |
| 62 | 62 |
| 63 if (recorded->suitableForGpuRasterization(NULL)) { | 63 if (recorded->suitableForGpuRasterization(nullptr)) { |
| 64 SkDebugf("suitable\n"); | 64 SkDebugf("suitable\n"); |
| 65 } else { | 65 } else { |
| 66 SkDebugf("unsuitable\n"); | 66 SkDebugf("unsuitable\n"); |
| 67 } | 67 } |
| 68 | 68 |
| 69 return kSuccess; | 69 return kSuccess; |
| 70 #else | 70 #else |
| 71 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); | 71 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n"); |
| 72 return kError; | 72 return kError; |
| 73 #endif | 73 #endif |
| 74 } | 74 } |
| 75 | 75 |
| 76 #if !defined SK_BUILD_FOR_IOS | 76 #if !defined SK_BUILD_FOR_IOS |
| 77 int main(int argc, char * const argv[]) { | 77 int main(int argc, char * const argv[]) { |
| 78 return tool_main(argc, (char**) argv); | 78 return tool_main(argc, (char**) argv); |
| 79 } | 79 } |
| 80 #endif | 80 #endif |
| OLD | NEW |