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

Unified Diff: src/ports/SkFontConfigTypeface.h

Issue 227693003: Factory methods for heap-allocated SkTypeface objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 6 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/fonts/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontConfigTypeface.h
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index dc92f1dffb640dd0a415934c4e0310329ba34bf4..b6f8797eb7c932c615a59348cdd4965e461194e4 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -18,19 +18,14 @@ class FontConfigTypeface : public SkTypeface_FreeType {
SkStream* fLocalStream;
public:
- FontConfigTypeface(Style style,
- const SkFontConfigInterface::FontIdentity& fi,
- const SkString& familyName)
- : INHERITED(style, SkTypefaceCache::NewFontID(), false)
- , fIdentity(fi)
- , fFamilyName(familyName)
- , fLocalStream(NULL) {}
+ static FontConfigTypeface* Create(Style style,
+ const SkFontConfigInterface::FontIdentity& fi,
+ const SkString& familyName) {
+ return SkNEW_ARGS(FontConfigTypeface, (style, fi, familyName));
+ }
- FontConfigTypeface(Style style, bool fixedWidth, SkStream* localStream)
- : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) {
- // we default to empty fFamilyName and fIdentity
- fLocalStream = localStream;
- SkSafeRef(localStream);
+ static FontConfigTypeface* Create(Style style, bool fixedWidth, SkStream* localStream) {
+ return SkNEW_ARGS(FontConfigTypeface, (style, fixedWidth, localStream));
}
virtual ~FontConfigTypeface() {
@@ -55,6 +50,21 @@ public:
protected:
friend class SkFontHost; // hack until we can make public versions
+ FontConfigTypeface(Style style,
+ const SkFontConfigInterface::FontIdentity& fi,
+ const SkString& familyName)
+ : INHERITED(style, SkTypefaceCache::NewFontID(), false)
+ , fIdentity(fi)
+ , fFamilyName(familyName)
+ , fLocalStream(NULL) {}
+
+ FontConfigTypeface(Style style, bool fixedWidth, SkStream* localStream)
+ : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) {
+ // we default to empty fFamilyName and fIdentity
+ fLocalStream = localStream;
+ SkSafeRef(localStream);
+ }
+
virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE;
virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE;
« no previous file with comments | « src/fonts/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698