aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-12 18:28:36 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-12 18:28:36 +0000
commit826ec81dbc5f651fc6cd77ddbbb80ad59b83f4c5 (patch)
treeafae1200d36fb78a3503b2a0af13ebd4dd133801
parent7de1e3fe3e8207692cba84296e3692d02dde9706 (diff)
Small change that eliminates Parse Errors with encoded skps.
R=reed@google.com, caryclark@google.com, scroggo@google.com Author: sglez@google.com Review URL: https://chromiumcodereview.appspot.com/16034015 git-svn-id: http://skia.googlecode.com/svn/trunk@9538 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gyp/tools.gyp1
-rw-r--r--tools/pinspect.cpp17
2 files changed, 16 insertions, 2 deletions
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 67ea8b4740..552dfc8b6f 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -274,6 +274,7 @@
],
'dependencies': [
'skia_lib.gyp:skia_lib',
+ 'tools.gyp:picture_renderer',
],
},
{
diff --git a/tools/pinspect.cpp b/tools/pinspect.cpp
index b5a6727e96..f6304e6b40 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"
#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;