short-circuit if the requested typeface matches what we've been given.

git-svn-id: http://skia.googlecode.com/svn/trunk@7954 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-03-04 14:39:47 +00:00
parent b12dc38964
commit 4969044d0b

View File

@ -67,6 +67,10 @@ SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
}
SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
if (family && family->style() == s) {
family->ref();
return const_cast<SkTypeface*>(family);
}
return SkFontHost::CreateTypeface(family, NULL, s);
}