| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
| 12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
| 13 #include "SkImageDecoder.h" | 13 #include "SkImageDecoder.h" |
| 14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 #include "SkStream.h" | 15 #include "SkStream.h" |
| 16 #include "SkString.h" | 16 #include "SkString.h" |
| 17 #include "SkDumpCanvas.h" | 17 #include "SkDumpCanvas.h" |
| 18 | 18 |
| 19 static SkPicture* inspect(const char path[]) { | 19 static SkPicture* inspect(const char path[]) { |
| 20 SkFILEStream stream(path); | 20 SkFILEStream stream(path); |
| 21 if (!stream.isValid()) { | 21 if (!stream.isValid()) { |
| 22 printf("-- Can't open '%s'\n", path); | 22 printf("-- Can't open '%s'\n", path); |
| 23 return NULL; | 23 return nullptr; |
| 24 } | 24 } |
| 25 | 25 |
| 26 printf("Opening '%s'...\n", path); | 26 printf("Opening '%s'...\n", path); |
| 27 | 27 |
| 28 { | 28 { |
| 29 int32_t header[3]; | 29 int32_t header[3]; |
| 30 if (stream.read(header, sizeof(header)) != sizeof(header)) { | 30 if (stream.read(header, sizeof(header)) != sizeof(header)) { |
| 31 printf("-- Failed to read header (12 bytes)\n"); | 31 printf("-- Failed to read header (12 bytes)\n"); |
| 32 return NULL; | 32 return nullptr; |
| 33 } | 33 } |
| 34 printf("version:%d width:%d height:%d\n", header[0], header[1], header[2
]); | 34 printf("version:%d width:%d height:%d\n", header[0], header[1], header[2
]); |
| 35 } | 35 } |
| 36 | 36 |
| 37 stream.rewind(); | 37 stream.rewind(); |
| 38 SkPicture* pic = SkPicture::CreateFromStream(&stream, &sk_tools::LazyDecodeB
itmap); | 38 SkPicture* pic = SkPicture::CreateFromStream(&stream, &sk_tools::LazyDecodeB
itmap); |
| 39 if (NULL == pic) { | 39 if (nullptr == pic) { |
| 40 SkDebugf("Could not create SkPicture: %s\n", path); | 40 SkDebugf("Could not create SkPicture: %s\n", path); |
| 41 return NULL; | 41 return nullptr; |
| 42 } | 42 } |
| 43 printf("picture cullRect: [%f %f %f %f]\n", | 43 printf("picture cullRect: [%f %f %f %f]\n", |
| 44 pic->cullRect().fLeft, pic->cullRect().fTop, | 44 pic->cullRect().fLeft, pic->cullRect().fTop, |
| 45 pic->cullRect().fRight, pic->cullRect().fBottom); | 45 pic->cullRect().fRight, pic->cullRect().fBottom); |
| 46 return pic; | 46 return pic; |
| 47 } | 47 } |
| 48 | 48 |
| 49 static void dumpOps(SkPicture* pic) { | 49 static void dumpOps(SkPicture* pic) { |
| 50 #ifdef SK_DEVELOPER | 50 #ifdef SK_DEVELOPER |
| 51 SkDebugfDumper dumper; | 51 SkDebugfDumper dumper; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 return 0; | 84 return 0; |
| 85 } | 85 } |
| 86 | 86 |
| 87 #if !defined SK_BUILD_FOR_IOS | 87 #if !defined SK_BUILD_FOR_IOS |
| 88 int main(int argc, char * const argv[]) { | 88 int main(int argc, char * const argv[]) { |
| 89 return tool_main(argc, (char**) argv); | 89 return tool_main(argc, (char**) argv); |
| 90 } | 90 } |
| 91 #endif | 91 #endif |
| OLD | NEW |