From 9eb1c7d80fb3a0b23c0f6a156424a381b4120d3c Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 3 Jul 2018 16:15:54 -0400 Subject: Revert "Revert "Remove gCreateTypefaceDelegate."" This reverts commit 58a1605d2b9bab077f53b6a223f9e7ce1891d3ea. Try to make glyph paths as immutable as possible. Change-Id: Ibef920c4417304e37ca4d4384515e9e7fc31aabf Reviewed-on: https://skia-review.googlesource.com/139172 Commit-Queue: Ben Wagner Reviewed-by: Mike Klein Reviewed-by: Herb Derby --- dm/DM.cpp | 15 --------------- src/core/SkGlyphCache.cpp | 2 ++ src/core/SkTypeface.cpp | 8 -------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/dm/DM.cpp b/dm/DM.cpp index 28369e9c08..4656381c13 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -1291,20 +1291,6 @@ static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions) /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -#define PORTABLE_FONT_PREFIX "Toy Liberation " - -static sk_sp create_from_name(const char familyName[], SkFontStyle style) { - if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX) - && !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) { - return sk_tool_utils::create_portable_typeface(familyName, style); - } - return nullptr; -} - -#undef PORTABLE_FONT_PREFIX - -extern sk_sp (*gCreateTypefaceDelegate)(const char [], SkFontStyle ); - int main(int argc, char** argv) { #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_HAS_HEIF_LIBRARY) android::ProcessState::self()->startThreadPool(); @@ -1357,7 +1343,6 @@ int main(int argc, char** argv) { JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. SkAutoGraphics ag; SkTaskGroup::Enabler enabled(FLAGS_threads); - gCreateTypefaceDelegate = &create_from_name; if (nullptr == GetResourceAsData("images/color_wheel.png")) { info("Some resources are missing. Do you need to set --resourcePath?\n"); diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 45e67f2c14..61e01af894 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -225,6 +225,8 @@ const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) { pathData->fIntercept = nullptr; SkPath* path = new SkPath; if (fScalerContext->getPath(glyph.getPackedID(), path)) { + path->updateBoundsCache(); + path->getGenerationID(); pathData->fPath = path; fMemoryUsed += compute_path_size(*path); } else { diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 6b1e3618c6..8e90f51a9b 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -29,8 +29,6 @@ extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* ); #define SK_TYPEFACE_DELEGATE nullptr #endif -sk_sp (*gCreateTypefaceDelegate)(const char[], SkFontStyle) = nullptr; - void (*gSerializeTypefaceDelegate)(const SkTypeface*, SkWStream* ) = SK_TYPEFACE_DELEGATE; sk_sp (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr; @@ -129,12 +127,6 @@ bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) { sk_sp SkTypeface::MakeFromName(const char name[], SkFontStyle fontStyle) { - if (gCreateTypefaceDelegate) { - sk_sp result = (*gCreateTypefaceDelegate)(name, fontStyle); - if (result) { - return result; - } - } if (nullptr == name && (fontStyle.slant() == SkFontStyle::kItalic_Slant || fontStyle.slant() == SkFontStyle::kUpright_Slant) && (fontStyle.weight() == SkFontStyle::kBold_Weight || -- cgit v1.2.3