| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
| 9 #include "SkPicture.h" | 9 #include "SkPicture.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| 11 #include "SkStream.h" | 11 #include "SkStream.h" |
| 12 #include "SkFontDescriptor.h" |
| 12 | 13 |
| 13 DEFINE_string2(input, i, "", "skp on which to report"); | 14 DEFINE_string2(input, i, "", "skp on which to report"); |
| 14 DEFINE_bool2(version, v, true, "version"); | 15 DEFINE_bool2(version, v, true, "version"); |
| 15 DEFINE_bool2(cullRect, c, true, "cullRect"); | 16 DEFINE_bool2(cullRect, c, true, "cullRect"); |
| 16 DEFINE_bool2(flags, f, true, "flags"); | 17 DEFINE_bool2(flags, f, true, "flags"); |
| 17 DEFINE_bool2(tags, t, true, "tags"); | 18 DEFINE_bool2(tags, t, true, "tags"); |
| 18 DEFINE_bool2(quiet, q, false, "quiet"); | 19 DEFINE_bool2(quiet, q, false, "quiet"); |
| 19 | 20 |
| 20 // This tool can print simple information about an SKP but its main use | 21 // This tool can print simple information about an SKP but its main use |
| 21 // is just to check if an SKP has been truncated during the recording | 22 // is just to check if an SKP has been truncated during the recording |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 case SK_PICT_READER_TAG: | 101 case SK_PICT_READER_TAG: |
| 101 if (FLAGS_tags && !FLAGS_quiet) { | 102 if (FLAGS_tags && !FLAGS_quiet) { |
| 102 SkDebugf("SK_PICT_READER_TAG %d\n", chunkSize); | 103 SkDebugf("SK_PICT_READER_TAG %d\n", chunkSize); |
| 103 } | 104 } |
| 104 break; | 105 break; |
| 105 case SK_PICT_FACTORY_TAG: | 106 case SK_PICT_FACTORY_TAG: |
| 106 if (FLAGS_tags && !FLAGS_quiet) { | 107 if (FLAGS_tags && !FLAGS_quiet) { |
| 107 SkDebugf("SK_PICT_FACTORY_TAG %d\n", chunkSize); | 108 SkDebugf("SK_PICT_FACTORY_TAG %d\n", chunkSize); |
| 108 } | 109 } |
| 109 break; | 110 break; |
| 110 case SK_PICT_TYPEFACE_TAG: | 111 case SK_PICT_TYPEFACE_TAG: { |
| 111 if (FLAGS_tags && !FLAGS_quiet) { | 112 if (FLAGS_tags && !FLAGS_quiet) { |
| 112 SkDebugf("SK_PICT_TYPEFACE_TAG %d\n", chunkSize); | 113 SkDebugf("SK_PICT_TYPEFACE_TAG %d\n", chunkSize); |
| 113 SkDebugf("Exiting early due to format limitations\n"); | |
| 114 } | 114 } |
| 115 return kSuccess; // TODO: need to store size in bytes | 115 |
| 116 const int count = SkToInt(chunkSize); |
| 117 for (int i = 0; i < count; i++) { |
| 118 SkFontDescriptor desc; |
| 119 if (!SkFontDescriptor::Deserialize(&stream, &desc)) { |
| 120 if (!FLAGS_quiet) { |
| 121 SkDebugf("File corruption in SkFontDescriptor\n"); |
| 122 } |
| 123 return kInvalidTag; |
| 124 } |
| 125 } |
| 126 |
| 127 // clear this since we've consumed all the typefaces |
| 128 chunkSize = 0; |
| 116 break; | 129 break; |
| 130 } |
| 117 case SK_PICT_PICTURE_TAG: | 131 case SK_PICT_PICTURE_TAG: |
| 118 if (FLAGS_tags && !FLAGS_quiet) { | 132 if (FLAGS_tags && !FLAGS_quiet) { |
| 119 SkDebugf("SK_PICT_PICTURE_TAG %d\n", chunkSize); | 133 SkDebugf("SK_PICT_PICTURE_TAG %d\n", chunkSize); |
| 120 SkDebugf("Exiting early due to format limitations\n"); | 134 SkDebugf("Exiting early due to format limitations\n"); |
| 121 } | 135 } |
| 122 return kSuccess; // TODO: need to store size in bytes | 136 return kSuccess; // TODO: need to store size in bytes |
| 123 break; | 137 break; |
| 124 case SK_PICT_BUFFER_SIZE_TAG: | 138 case SK_PICT_BUFFER_SIZE_TAG: |
| 125 if (FLAGS_tags && !FLAGS_quiet) { | 139 if (FLAGS_tags && !FLAGS_quiet) { |
| 126 SkDebugf("SK_PICT_BUFFER_SIZE_TAG %d\n", chunkSize); | 140 SkDebugf("SK_PICT_BUFFER_SIZE_TAG %d\n", chunkSize); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 142 } | 156 } |
| 143 | 157 |
| 144 return kSuccess; | 158 return kSuccess; |
| 145 } | 159 } |
| 146 | 160 |
| 147 #if !defined SK_BUILD_FOR_IOS | 161 #if !defined SK_BUILD_FOR_IOS |
| 148 int main(int argc, char * const argv[]) { | 162 int main(int argc, char * const argv[]) { |
| 149 return tool_main(argc, (char**) argv); | 163 return tool_main(argc, (char**) argv); |
| 150 } | 164 } |
| 151 #endif | 165 #endif |
| OLD | NEW |