diff options
author | robertphillips <robertphillips@google.com> | 2016-02-25 10:58:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 10:58:49 -0800 |
commit | 3552ba18ee41e135d6fc52228adae37794fc15ff (patch) | |
tree | 8fd975a1a4159055abbdb42ca54a82c577ce67e9 /tools | |
parent | 4dcbe431244c2f1abef8416b95ebf2921708fa63 (diff) |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/skpinfo.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
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); |