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