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

Unified Diff: src/core/SkTypeface.cpp

Issue 586473002: Restore old behavior of SkTypeface::CreateFromTypeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove extra newline. Created 6 years, 3 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 | « no previous file | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTypeface.cpp
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index d7da131d13b2db7786efafc33221133eb927aa6d..f9487870ccc537ad13e669083ab9022f554b6151 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -132,10 +132,15 @@ SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
}
SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
- if (family && family->style() == s) {
+ if (!family) {
+ return SkTypeface::RefDefault(s);
+ }
+
+ if (family->style() == s) {
family->ref();
return const_cast<SkTypeface*>(family);
}
+
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
bool bold = s & SkTypeface::kBold;
bool italic = s & SkTypeface::kItalic;
@@ -143,7 +148,7 @@ SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
: SkFontStyle::kNormal_Weight,
SkFontStyle::kNormal_Width,
italic ? SkFontStyle::kItalic_Slant
- : SkFontStyle::kUpright_Slant);
+ : SkFontStyle::kUpright_Slant);
return fm->matchFaceStyle(family, newStyle);
}
« no previous file with comments | « no previous file | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698