| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2015 Google Inc. | 2  * Copyright 2015 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 "SkChecksum.h" | 8 #include "SkChecksum.h" | 
| 9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" | 
| 10 #include "SkStream.h" | 10 #include "SkStream.h" | 
| 11 #include "SkString.h" | 11 #include "SkString.h" | 
| 12 #include "SkTypeface.h" | 12 #include "SkTypeface.h" | 
| 13 #include "SkUtils.h" | 13 #include "SkUtils.h" | 
| 14 #include "../sfnt/SkOTUtils.h" | 14 #include "../sfnt/SkOTUtils.h" | 
| 15 | 15 | 
| 16 #include "SkWhitelistChecksums.cpp" | 16 #include "SkWhitelistChecksums.inc" | 
| 17 | 17 | 
| 18 #define WHITELIST_DEBUG 0 | 18 #define WHITELIST_DEBUG 0 | 
| 19 | 19 | 
| 20 extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* ); | 20 extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* ); | 
| 21 sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* ); | 21 sk_sp<SkTypeface> WhitelistDeserializeTypeface(SkStream* ); | 
| 22 extern bool CheckChecksums(); | 22 extern bool CheckChecksums(); | 
| 23 extern bool GenerateChecksums(); | 23 extern bool GenerateChecksums(); | 
| 24 | 24 | 
| 25 #if WHITELIST_DEBUG | 25 #if WHITELIST_DEBUG | 
| 26 static bool timesNewRomanSerializedNameOnly = false; | 26 static bool timesNewRomanSerializedNameOnly = false; | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 209         const char* fontName = whitelist[i].fFontName; | 209         const char* fontName = whitelist[i].fFontName; | 
| 210         sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle())); | 210         sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle())); | 
| 211         uint32_t checksum = compute_checksum(tf.get()); | 211         uint32_t checksum = compute_checksum(tf.get()); | 
| 212         if (whitelist[i].fChecksum != checksum) { | 212         if (whitelist[i].fChecksum != checksum) { | 
| 213             return false; | 213             return false; | 
| 214         } | 214         } | 
| 215     } | 215     } | 
| 216     return true; | 216     return true; | 
| 217 } | 217 } | 
| 218 | 218 | 
| 219 const char checksumFileName[] = "SkWhitelistChecksums.cpp"; | 219 const char checksumFileName[] = "SkWhitelistChecksums.inc"; | 
| 220 | 220 | 
| 221 const char checksumHeader[] = | 221 const char checksumHeader[] = | 
| 222 "/*"                                                                        "\n" | 222 "/*"                                                                        "\n" | 
| 223 " * Copyright 2015 Google Inc."                                             "\n" | 223 " * Copyright 2015 Google Inc."                                             "\n" | 
| 224 " *"                                                                        "\n" | 224 " *"                                                                        "\n" | 
| 225 " * Use of this source code is governed by a BSD-style license that can be" "\n" | 225 " * Use of this source code is governed by a BSD-style license that can be" "\n" | 
| 226 " * found in the LICENSE file."                                             "\n" | 226 " * found in the LICENSE file."                                             "\n" | 
| 227 " *"                                                                        "\n" | 227 " *"                                                                        "\n" | 
| 228 " * %s() in %s generated %s."                                               "\n" | 228 " * %s() in %s generated %s."                                               "\n" | 
| 229 " * Run 'whitelist_typefaces --generate' to create anew."                   "\n" | 229 " * Run 'whitelist_typefaces --generate' to create anew."                   "\n" | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 264         const char* fontName = whitelist[i].fFontName; | 264         const char* fontName = whitelist[i].fFontName; | 
| 265         sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle())); | 265         sk_sp<SkTypeface> tf(SkTypeface::MakeFromName(fontName, SkFontStyle())); | 
| 266         uint32_t checksum = compute_checksum(tf.get()); | 266         uint32_t checksum = compute_checksum(tf.get()); | 
| 267         line.printf(checksumEntry, fontName, checksum); | 267         line.printf(checksumEntry, fontName, checksum); | 
| 268         sk_fwrite(line.c_str(), line.size(), file); | 268         sk_fwrite(line.c_str(), line.size(), file); | 
| 269     } | 269     } | 
| 270     sk_fwrite(checksumTrailer, sizeof(checksumTrailer) - 1, file); | 270     sk_fwrite(checksumTrailer, sizeof(checksumTrailer) - 1, file); | 
| 271     sk_fclose(file); | 271     sk_fclose(file); | 
| 272     return true; | 272     return true; | 
| 273 } | 273 } | 
| OLD | NEW | 
|---|