Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9eb1c7d

Browse files
Ben WagnerSkia Commit-Bot
authored andcommitted
Revert "Revert "Remove gCreateTypefaceDelegate.""
This reverts commit 58a1605. Try to make glyph paths as immutable as possible. Change-Id: Ibef920c4417304e37ca4d4384515e9e7fc31aabf Reviewed-on: https://skia-review.googlesource.com/139172 Commit-Queue: Ben Wagner <[email protected]> Reviewed-by: Mike Klein <[email protected]> Reviewed-by: Herb Derby <[email protected]>
1 parent 44bad2e commit 9eb1c7d

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

dm/DM.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,20 +1291,6 @@ static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions)
12911291

12921292
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
12931293

1294-
#define PORTABLE_FONT_PREFIX "Toy Liberation "
1295-
1296-
static sk_sp<SkTypeface> create_from_name(const char familyName[], SkFontStyle style) {
1297-
if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX)
1298-
&& !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FONT_PREFIX) - 1)) {
1299-
return sk_tool_utils::create_portable_typeface(familyName, style);
1300-
}
1301-
return nullptr;
1302-
}
1303-
1304-
#undef PORTABLE_FONT_PREFIX
1305-
1306-
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
1307-
13081294
int main(int argc, char** argv) {
13091295
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && defined(SK_HAS_HEIF_LIBRARY)
13101296
android::ProcessState::self()->startThreadPool();
@@ -1357,7 +1343,6 @@ int main(int argc, char** argv) {
13571343
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
13581344
SkAutoGraphics ag;
13591345
SkTaskGroup::Enabler enabled(FLAGS_threads);
1360-
gCreateTypefaceDelegate = &create_from_name;
13611346

13621347
if (nullptr == GetResourceAsData("images/color_wheel.png")) {
13631348
info("Some resources are missing. Do you need to set --resourcePath?\n");

src/core/SkGlyphCache.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
225225
pathData->fIntercept = nullptr;
226226
SkPath* path = new SkPath;
227227
if (fScalerContext->getPath(glyph.getPackedID(), path)) {
228+
path->updateBoundsCache();
229+
path->getGenerationID();
228230
pathData->fPath = path;
229231
fMemoryUsed += compute_path_size(*path);
230232
} else {

src/core/SkTypeface.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ extern void WhitelistSerializeTypeface(const SkTypeface*, SkWStream* );
2929
#define SK_TYPEFACE_DELEGATE nullptr
3030
#endif
3131

32-
sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char[], SkFontStyle) = nullptr;
33-
3432
void (*gSerializeTypefaceDelegate)(const SkTypeface*, SkWStream* ) = SK_TYPEFACE_DELEGATE;
3533
sk_sp<SkTypeface> (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr;
3634

@@ -129,12 +127,6 @@ bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) {
129127

130128
sk_sp<SkTypeface> SkTypeface::MakeFromName(const char name[],
131129
SkFontStyle fontStyle) {
132-
if (gCreateTypefaceDelegate) {
133-
sk_sp<SkTypeface> result = (*gCreateTypefaceDelegate)(name, fontStyle);
134-
if (result) {
135-
return result;
136-
}
137-
}
138130
if (nullptr == name && (fontStyle.slant() == SkFontStyle::kItalic_Slant ||
139131
fontStyle.slant() == SkFontStyle::kUpright_Slant) &&
140132
(fontStyle.weight() == SkFontStyle::kBold_Weight ||

0 commit comments

Comments
 (0)