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

Unified Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. Created 4 years, 8 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/ports/SkFontConfigTypeface.h ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_fontconfig.cpp
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index e42929a264496ce216f72e5b3a453c18af8f95e0..207aa7232309d0a0da35cee6b1a27e8ae6d01eb1 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -166,9 +166,16 @@ public:
}
};
+#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
SkTypeface::Style requestedOldStyle)
{
+ SkFontStyle requestedStyle = SkFontStyle::FromOldStyle(requestedOldStyle);
+#else
+SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
+ SkFontStyle requestedStyle)
+{
+#endif
SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
if (nullptr == fci.get()) {
return nullptr;
@@ -176,7 +183,6 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN
// Check if this request is already in the request cache.
using Request = SkFontHostRequestCache::Request;
- SkFontStyle requestedStyle(requestedOldStyle);
SkAutoTDelete<Request> request(Request::Create(requestedFamilyName, requestedStyle));
SkTypeface* face = SkFontHostRequestCache::FindAndRef(request);
if (face) {
@@ -185,9 +191,14 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN
SkFontConfigInterface::FontIdentity identity;
SkString outFamilyName;
- SkTypeface::Style outOldStyle;
+#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
+ SkTypeface::Style outStyle;
if (!fci->matchFamilyName(requestedFamilyName, requestedOldStyle,
- &identity, &outFamilyName, &outOldStyle))
+#else
+ SkFontStyle outStyle;
+ if (!fci->matchFamilyName(requestedFamilyName, requestedStyle,
+#endif
+ &identity, &outFamilyName, &outStyle))
{
return nullptr;
}
@@ -195,9 +206,15 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN
// Check if a typeface with this FontIdentity is already in the FontIdentity cache.
face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &identity);
if (!face) {
- face = FontConfigTypeface::Create(SkFontStyle(outOldStyle), identity, outFamilyName);
+#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
+ face = FontConfigTypeface::Create(SkFontStyle::FromOldStyle(outStyle), identity, outFamilyName);
+ // Add this FontIdentity to the FontIdentity cache.
+ SkTypefaceCache::Add(face, SkFontStyle::FromOldStyle(outStyle));
+#else
+ face = FontConfigTypeface::Create(outStyle, identity, outFamilyName);
// Add this FontIdentity to the FontIdentity cache.
- SkTypefaceCache::Add(face, SkFontStyle(outOldStyle));
+ SkTypefaceCache::Add(face, outStyle);
+#endif
}
// Add this request to the request cache.
SkFontHostRequestCache::Add(face, request.release());
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698