Index: tools/get_images_from_skps.cpp |
diff --git a/tools/get_images_from_skps.cpp b/tools/get_images_from_skps.cpp |
index e6bb6e2012190698ebda8359826f7d36be275861..fecce4e067df8c5969473325cbfe89125aabd456 100644 |
--- a/tools/get_images_from_skps.cpp |
+++ b/tools/get_images_from_skps.cpp |
@@ -17,6 +17,7 @@ |
DEFINE_string2(skps, s, "skps", "A path to a directory of skps."); |
DEFINE_string2(out, o, "img-out", "A path to an output directory."); |
+DEFINE_bool(test, false, "Indicates if we want to test that the images decode successfully."); |
static int gKnown; |
static int gUnknown; |
@@ -56,6 +57,17 @@ struct Sniffer : public SkPixelSerializer { |
default: gUnknown++; return; |
} |
+ if (FLAGS_test) { |
+ SkBitmap bitmap; |
+ SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType); |
+ bitmap.allocPixels(info); |
+ if (SkCodec::kSuccess != codec->getPixels(info, bitmap.getPixels(), bitmap.rowBytes())) |
+ { |
+ gUnknown++; |
+ return; |
+ } |
+ } |
+ |
SkString path; |
path.appendf("%s/%d.%s", gOutputDir, gKnown++, ext.c_str()); |