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

Unified Diff: tools/skpinfo.cpp

Issue 1732263003: Make skpinfo able to inspect SK_PICT_TYPEFACE_TAG blocks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues Created 4 years, 10 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
« no previous file with comments | « src/utils/SkWhitelistTypefaces.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpinfo.cpp
diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp
index c7fd8c870885a6a56ac59a7c4f288b51edaaf4ee..4b65cb8a8c692aacc9fa6f2dbb04a9223925dedb 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);
« no previous file with comments | « src/utils/SkWhitelistTypefaces.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698