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

Side by Side Diff: src/ports/SkFontHost_fontconfig.cpp

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 unified diff | Download patch
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 Google Inc. 2 * Copyright 2008 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // check if we, in fact, already have this. perhaps fontconfig aliased the 112 // check if we, in fact, already have this. perhaps fontconfig aliased the
113 // requested name to some other name we actually have... 113 // requested name to some other name we actually have...
114 rec.fFamilyName = outFamilyName.c_str(); 114 rec.fFamilyName = outFamilyName.c_str();
115 rec.fStyle = outStyle; 115 rec.fStyle = outStyle;
116 face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec); 116 face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec);
117 if (face) { 117 if (face) {
118 return face; 118 return face;
119 } 119 }
120 120
121 face = SkNEW_ARGS(FontConfigTypeface, (outStyle, indentity, outFamilyName)); 121 face = FontConfigTypeface::Create(outStyle, indentity, outFamilyName);
122 SkTypefaceCache::Add(face, style); 122 SkTypefaceCache::Add(face, style);
123 // SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str() , face, face->getRefCnt()); 123 // SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str() , face, face->getRefCnt());
124 return face; 124 return face;
125 } 125 }
126 126
127 #ifdef SK_FONTHOST_DOES_NOT_USE_FONTMGR 127 #ifdef SK_FONTHOST_DOES_NOT_USE_FONTMGR
128 128
129 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, 129 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
130 const char familyName[], 130 const char familyName[],
131 SkTypeface::Style style) { 131 SkTypeface::Style style) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 *ttcIndex = this->getIdentity().fTTCIndex; 203 *ttcIndex = this->getIdentity().fTTCIndex;
204 } 204 }
205 return stream; 205 return stream;
206 } 206 }
207 207
208 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 208 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
209 bool* isLocalStream) const { 209 bool* isLocalStream) const {
210 desc->setFamilyName(this->getFamilyName()); 210 desc->setFamilyName(this->getFamilyName());
211 *isLocalStream = SkToBool(this->getLocalStream()); 211 *isLocalStream = SkToBool(this->getLocalStream());
212 } 212 }
OLDNEW
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698