From 3552ba18ee41e135d6fc52228adae37794fc15ff Mon Sep 17 00:00:00 2001 From: robertphillips Date: Thu, 25 Feb 2016 10:58:49 -0800 Subject: Make skpinfo able to inspect SK_PICT_TYPEFACE_TAG blocks GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1732263003 BUG=skia:4691 Review URL: https://codereview.chromium.org/1732263003 --- tools/skpinfo.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'tools/skpinfo.cpp') diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp index c7fd8c8708..4b65cb8a8c 100644 --- a/tools/skpinfo.cpp +++ b/tools/skpinfo.cpp @@ -9,6 +9,7 @@ #include "SkPicture.h" #include "SkPictureData.h" #include "SkStream.h" +#include "SkFontDescriptor.h" DEFINE_string2(input, i, "", "skp on which to report"); DEFINE_bool2(version, v, true, "version"); @@ -107,13 +108,26 @@ int tool_main(int argc, char** argv) { SkDebugf("SK_PICT_FACTORY_TAG %d\n", chunkSize); } break; - case SK_PICT_TYPEFACE_TAG: + case SK_PICT_TYPEFACE_TAG: { if (FLAGS_tags && !FLAGS_quiet) { SkDebugf("SK_PICT_TYPEFACE_TAG %d\n", chunkSize); - SkDebugf("Exiting early due to format limitations\n"); } - return kSuccess; // TODO: need to store size in bytes + + const int count = SkToInt(chunkSize); + for (int i = 0; i < count; i++) { + SkFontDescriptor desc; + if (!SkFontDescriptor::Deserialize(&stream, &desc)) { + if (!FLAGS_quiet) { + SkDebugf("File corruption in SkFontDescriptor\n"); + } + return kInvalidTag; + } + } + + // clear this since we've consumed all the typefaces + chunkSize = 0; break; + } case SK_PICT_PICTURE_TAG: if (FLAGS_tags && !FLAGS_quiet) { SkDebugf("SK_PICT_PICTURE_TAG %d\n", chunkSize); -- cgit v1.2.3