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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/SkFontHost_FreeType_common.cpp ('k') | src/ports/SkFontHost_mac.cpp » ('j') | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 FontConfigTypeface* cachedFCTypeface = static_cast<FontConfigTypeface*>(cach edTypeface); 81 FontConfigTypeface* cachedFCTypeface = static_cast<FontConfigTypeface*>(cach edTypeface);
82 FontIdentity* indentity = static_cast<FontIdentity*>(ctx); 82 FontIdentity* indentity = static_cast<FontIdentity*>(ctx);
83 83
84 return cachedFCTypeface->getIdentity() == *indentity; 84 return cachedFCTypeface->getIdentity() == *indentity;
85 } 85 }
86 86
87 SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[], 87 SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[],
88 SkTypeface::Style style) 88 SkTypeface::Style style)
89 { 89 {
90 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); 90 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
91 if (NULL == fci.get()) { 91 if (nullptr == fci.get()) {
92 return NULL; 92 return nullptr;
93 } 93 }
94 94
95 // Check if requested NameStyle is in the NameStyle cache. 95 // Check if requested NameStyle is in the NameStyle cache.
96 SkFontStyle requestedStyle(style); 96 SkFontStyle requestedStyle(style);
97 NameStyle nameStyle(familyName, requestedStyle); 97 NameStyle nameStyle(familyName, requestedStyle);
98 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_NameStyle, &nam eStyle); 98 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_NameStyle, &nam eStyle);
99 if (face) { 99 if (face) {
100 //SkDebugf("found cached face <%s> <%s> %p [%d]\n", 100 //SkDebugf("found cached face <%s> <%s> %p [%d]\n",
101 // familyName, ((FontConfigTypeface*)face)->getFamilyName(), 101 // familyName, ((FontConfigTypeface*)face)->getFamilyName(),
102 // face, face->getRefCnt()); 102 // face, face->getRefCnt());
103 return face; 103 return face;
104 } 104 }
105 105
106 SkFontConfigInterface::FontIdentity indentity; 106 SkFontConfigInterface::FontIdentity indentity;
107 SkString outFamilyName; 107 SkString outFamilyName;
108 SkTypeface::Style outStyle; 108 SkTypeface::Style outStyle;
109 if (!fci->matchFamilyName(familyName, style, &indentity, &outFamilyName, &ou tStyle)) { 109 if (!fci->matchFamilyName(familyName, style, &indentity, &outFamilyName, &ou tStyle)) {
110 return NULL; 110 return nullptr;
111 } 111 }
112 112
113 // Check if a typeface with this FontIdentity is already in the FontIdentity cache. 113 // Check if a typeface with this FontIdentity is already in the FontIdentity cache.
114 face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &indentity); 114 face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &indentity);
115 if (!face) { 115 if (!face) {
116 face = FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, outF amilyName); 116 face = FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, outF amilyName);
117 // Add this FontIdentity to the FontIdentity cache. 117 // Add this FontIdentity to the FontIdentity cache.
118 SkTypefaceCache::Add(face, requestedStyle); 118 SkTypefaceCache::Add(face, requestedStyle);
119 } 119 }
120 // TODO: Ensure requested NameStyle and resolved NameStyle are both in the N ameStyle cache. 120 // TODO: Ensure requested NameStyle and resolved NameStyle are both in the N ameStyle cache.
121 121
122 //SkDebugf("add face <%s> <%s> %p [%d]\n", 122 //SkDebugf("add face <%s> <%s> %p [%d]\n",
123 // familyName, outFamilyName.c_str(), 123 // familyName, outFamilyName.c_str(),
124 // face, face->getRefCnt()); 124 // face, face->getRefCnt());
125 return face; 125 return face;
126 } 126 }
127 127
128 /////////////////////////////////////////////////////////////////////////////// 128 ///////////////////////////////////////////////////////////////////////////////
129 129
130 SkStreamAsset* FontConfigTypeface::onOpenStream(int* ttcIndex) const { 130 SkStreamAsset* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
131 SkStreamAsset* stream = this->getLocalStream(); 131 SkStreamAsset* stream = this->getLocalStream();
132 if (stream) { 132 if (stream) {
133 // TODO: should have been provided by CreateFromStream() 133 // TODO: should have been provided by CreateFromStream()
134 *ttcIndex = 0; 134 *ttcIndex = 0;
135 return stream->duplicate(); 135 return stream->duplicate();
136 } 136 }
137 137
138 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); 138 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
139 if (NULL == fci.get()) { 139 if (nullptr == fci.get()) {
140 return NULL; 140 return nullptr;
141 } 141 }
142 142
143 *ttcIndex = this->getIdentity().fTTCIndex; 143 *ttcIndex = this->getIdentity().fTTCIndex;
144 return fci->openStream(this->getIdentity()); 144 return fci->openStream(this->getIdentity());
145 } 145 }
146 146
147 void FontConfigTypeface::onGetFamilyName(SkString* familyName) const { 147 void FontConfigTypeface::onGetFamilyName(SkString* familyName) const {
148 *familyName = fFamilyName; 148 *familyName = fFamilyName;
149 } 149 }
150 150
151 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 151 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
152 bool* isLocalStream) const { 152 bool* isLocalStream) const {
153 SkString name; 153 SkString name;
154 this->getFamilyName(&name); 154 this->getFamilyName(&name);
155 desc->setFamilyName(name.c_str()); 155 desc->setFamilyName(name.c_str());
156 *isLocalStream = SkToBool(this->getLocalStream()); 156 *isLocalStream = SkToBool(this->getLocalStream());
157 } 157 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.cpp ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698