aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-04 14:39:47 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-04 14:39:47 +0000
commit4969044d0b86c6ef76aed2dad77f180ad45c91bb (patch)
tree944ce4268cb29588aceaf388cc59004200e58552
parentb12dc38964c4b4b530e83b29331cb11739472b64 (diff)
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
-rw-r--r--src/core/SkTypeface.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index ce1892702c..7699470727 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -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);
}