Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: tools/pinspect.cpp

Issue 1685963004: Revert of Make SkPicture/SkImageGenerator default to SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/lua/lua_pictures.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkBitmap.h" 9 #include "SkBitmap.h"
9 #include "SkCanvas.h" 10 #include "SkCanvas.h"
10 #include "SkGraphics.h" 11 #include "SkGraphics.h"
11 #include "SkOSFile.h" 12 #include "SkOSFile.h"
12 #include "SkImageDecoder.h" 13 #include "SkImageDecoder.h"
13 #include "SkPicture.h" 14 #include "SkPicture.h"
14 #include "SkStream.h" 15 #include "SkStream.h"
15 #include "SkString.h" 16 #include "SkString.h"
16 #include "SkDumpCanvas.h" 17 #include "SkDumpCanvas.h"
17 18
18 static SkPicture* inspect(const char path[]) { 19 static SkPicture* inspect(const char path[]) {
19 SkFILEStream stream(path); 20 SkFILEStream stream(path);
20 if (!stream.isValid()) { 21 if (!stream.isValid()) {
21 printf("-- Can't open '%s'\n", path); 22 printf("-- Can't open '%s'\n", path);
22 return nullptr; 23 return nullptr;
23 } 24 }
24 25
25 printf("Opening '%s'...\n", path); 26 printf("Opening '%s'...\n", path);
26 27
27 { 28 {
28 int32_t header[3]; 29 int32_t header[3];
29 if (stream.read(header, sizeof(header)) != sizeof(header)) { 30 if (stream.read(header, sizeof(header)) != sizeof(header)) {
30 printf("-- Failed to read header (12 bytes)\n"); 31 printf("-- Failed to read header (12 bytes)\n");
31 return nullptr; 32 return nullptr;
32 } 33 }
33 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 ]);
34 } 35 }
35 36
36 stream.rewind(); 37 stream.rewind();
37 SkPicture* pic = SkPicture::CreateFromStream(&stream); 38 SkPicture* pic = SkPicture::CreateFromStream(&stream, &sk_tools::LazyDecodeB itmap);
38 if (nullptr == pic) { 39 if (nullptr == pic) {
39 SkDebugf("Could not create SkPicture: %s\n", path); 40 SkDebugf("Could not create SkPicture: %s\n", path);
40 return nullptr; 41 return nullptr;
41 } 42 }
42 printf("picture cullRect: [%f %f %f %f]\n", 43 printf("picture cullRect: [%f %f %f %f]\n",
43 pic->cullRect().fLeft, pic->cullRect().fTop, 44 pic->cullRect().fLeft, pic->cullRect().fTop,
44 pic->cullRect().fRight, pic->cullRect().fBottom); 45 pic->cullRect().fRight, pic->cullRect().fBottom);
45 return pic; 46 return pic;
46 } 47 }
47 48
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 82 }
82 } 83 }
83 return 0; 84 return 0;
84 } 85 }
85 86
86 #if !defined SK_BUILD_FOR_IOS 87 #if !defined SK_BUILD_FOR_IOS
87 int main(int argc, char * const argv[]) { 88 int main(int argc, char * const argv[]) {
88 return tool_main(argc, (char**) argv); 89 return tool_main(argc, (char**) argv);
89 } 90 }
90 #endif 91 #endif
OLDNEW
« no previous file with comments | « tools/lua/lua_pictures.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698