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

Unified Diff: trunk/src/core/SkTypeface.cpp

Issue 12915003: call onGetUPEM to subclasses can optimize it, and place default behavior (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 | « trunk/include/core/SkFontHost.h ('k') | trunk/src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/core/SkTypeface.cpp
===================================================================
--- trunk/src/core/SkTypeface.cpp (revision 8293)
+++ trunk/src/core/SkTypeface.cpp (working copy)
@@ -132,32 +132,33 @@
}
int SkTypeface::getUnitsPerEm() const {
+ // should we try to cache this in the base-class?
+ return this->onGetUPEM();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+#include "SkFontDescriptor.h"
+
+int SkTypeface::onGetUPEM() const {
int upem = 0;
-#ifdef SK_BUILD_FOR_ANDROID
- upem = SkFontHost::GetUnitsPerEm(fUniqueID);
-#else
SkAdvancedTypefaceMetrics* metrics;
metrics = this->getAdvancedTypefaceMetrics(
- SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo,
- NULL, 0);
+ SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo,
+ NULL, 0);
if (metrics) {
upem = metrics->fEmSize;
metrics->unref();
}
-#endif
return upem;
}
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-#include "SkFontDescriptor.h"
-
-int SkTypeface::onGetUPEM() const { return 0; }
int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const { return 0; }
size_t SkTypeface::onGetTableData(SkFontTableTag, size_t offset,
size_t length, void* data) const { return 0; }
void SkTypeface::onGetFontDescriptor(SkFontDescriptor* desc) const {
desc->setStyle(this->style());
}
+
« no previous file with comments | « trunk/include/core/SkFontHost.h ('k') | trunk/src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698