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

Unified Diff: tools/pinspect.cpp

Issue 16034015: Use image decoding in pinspect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Use lazy decoder. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« gyp/tools.gyp ('K') | « gyp/tools.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pinspect.cpp
diff --git a/tools/pinspect.cpp b/tools/pinspect.cpp
index b5a6727e96ed51fd92b5836bf25c18ebc67f549f..f6304e6b40a2092527a1c97a194ffde689a7e054 100644
--- a/tools/pinspect.cpp
+++ b/tools/pinspect.cpp
@@ -5,14 +5,21 @@
* found in the LICENSE file.
*/
-
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkGraphics.h"
#include "SkOSFile.h"
+#include "SkImageDecoder.h"
scroggo 2013/06/12 16:10:05 I don't think this is needed now that you're not p
#include "SkPicture.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkDumpCanvas.h"
+#include "SkForceLinking.h"
+
+__SK_FORCE_IMAGE_DECODER_LINKING;
+
+// Defined in PictureRenderingFlags.cpp
+extern bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap* bitmap);
static SkPicture* inspect(const char path[]) {
SkFILEStream stream(path);
@@ -33,7 +40,12 @@ static SkPicture* inspect(const char path[]) {
}
stream.rewind();
- SkPicture* pic = SkNEW_ARGS(SkPicture, (&stream));
+ bool success = false;
+ SkPicture* pic = SkNEW_ARGS(SkPicture, (&stream, &success, &lazy_decode_bitmap));
+ if (!success) {
+ SkDebugf("Could not create SkPicture: %s\n", path);
+ return pic;
+ }
printf("picture size:[%d %d]\n", pic->width(), pic->height());
return pic;
}
@@ -50,6 +62,7 @@ static void dumpOps(SkPicture* pic) {
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
+ SkAutoGraphics ag;
if (argc < 2) {
printf("Usage: pinspect [--dump-ops] filename [filename ...]\n");
return 1;
« gyp/tools.gyp ('K') | « gyp/tools.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698