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

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 414483002: SkFontMgr for Android. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScalerContext.h" 10 #include "SkScalerContext.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 newRec->fFontID = newFontID; 164 newRec->fFontID = newFontID;
165 desc->computeChecksum(); 165 desc->computeChecksum();
166 166
167 return newFace->createScalerContext(desc); 167 return newFace->createScalerContext(desc);
168 #else 168 #else
169 return NULL; 169 return NULL;
170 #endif 170 #endif
171 } 171 }
172 172
173 /* Return the next context, creating it if its not already created, but return 173 /* Return the next context.
djsollen 2014/07/22 18:18:29 add this back!
bungeman-skia 2014/07/22 18:48:16 Done.
174 NULL if the fonthost says there are no more fonts to fallback to. 174 When we supported fallback fonts on Android, this is where we might create n ew contexts.
175 */ 175 */
176 SkScalerContext* SkScalerContext::getNextContext() { 176 SkScalerContext* SkScalerContext::getNextContext() {
177 SkScalerContext* next = fNextContext; 177 return fNextContext;
178 // if next is null, then either it isn't cached yet, or we're at the
179 // end of our possible chain
180 if (NULL == next) {
181 next = this->allocNextContext();
182 if (NULL == next) {
183 return NULL;
184 }
185 // next's base is our base + our local count
186 next->setBaseGlyphCount(fBaseGlyphCount + this->getGlyphCount());
187 // cache the answer
188 fNextContext = next;
189 }
190 return next;
191 } 178 }
192 179
193 SkScalerContext* SkScalerContext::getGlyphContext(const SkGlyph& glyph) { 180 SkScalerContext* SkScalerContext::getGlyphContext(const SkGlyph& glyph) {
194 unsigned glyphID = glyph.getGlyphID(); 181 unsigned glyphID = glyph.getGlyphID();
195 SkScalerContext* ctx = this; 182 SkScalerContext* ctx = this;
196 for (;;) { 183 for (;;) {
197 unsigned count = ctx->getGlyphCount(); 184 unsigned count = ctx->getGlyphCount();
198 if (glyphID < count) { 185 if (glyphID < count) {
199 break; 186 break;
200 } 187 }
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 954 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
968 bool allowFailure) const { 955 bool allowFailure) const {
969 SkScalerContext* c = this->onCreateScalerContext(desc); 956 SkScalerContext* c = this->onCreateScalerContext(desc);
970 957
971 if (!c && !allowFailure) { 958 if (!c && !allowFailure) {
972 c = SkNEW_ARGS(SkScalerContext_Empty, 959 c = SkNEW_ARGS(SkScalerContext_Empty,
973 (const_cast<SkTypeface*>(this), desc)); 960 (const_cast<SkTypeface*>(this), desc));
974 } 961 }
975 return c; 962 return c;
976 } 963 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698