Home | History | Annotate | Download | only in core

Lines Matching refs:glyph

176         // this ID is based on the glyph index
187 SkGlyph* glyph = fGlyphHash[index];
189 if (NULL == glyph || glyph->fID != id) {
190 glyph = this->lookupMetrics(glyphID, kJustAdvance_MetricsType);
191 fGlyphHash[index] = glyph;
193 return *glyph;
207 // this ID is based on the glyph index
230 // this ID is based on the glyph index
247 SkGlyph* glyph = fGlyphHash[index];
249 if (NULL == glyph || glyph->fID != id) {
250 RecordHashCollisionIf(glyph != NULL);
251 glyph = this->lookupMetrics(glyphID, kFull_MetricsType);
252 fGlyphHash[index] = glyph;
255 if (glyph->isJustAdvance()) {
256 fScalerContext->getMetrics(glyph);
259 SkASSERT(glyph->isFullMetrics());
260 return *glyph;
268 SkGlyph* glyph = fGlyphHash[index];
270 if (NULL == glyph || glyph->fID != id) {
271 RecordHashCollisionIf(glyph != NULL);
272 glyph = this->lookupMetrics(id, kFull_MetricsType);
273 fGlyphHash[index] = glyph;
276 if (glyph->isJustAdvance()) {
277 fScalerContext->getMetrics(glyph);
280 SkASSERT(glyph->isFullMetrics());
281 return *glyph;
285 SkGlyph* glyph;
303 glyph = gptr[hi];
304 if (glyph->fID == id) {
305 if (kFull_MetricsType == mtype && glyph->isJustAdvance()) {
306 fScalerContext->getMetrics(glyph);
308 return glyph;
312 if (glyph->fID < id) {
317 // not found, but hi tells us where to inser the new glyph
320 glyph = (SkGlyph*)fGlyphAlloc.alloc(sizeof(SkGlyph),
322 glyph->init(id);
323 *fGlyphArray.insert(hi) = glyph;
326 fScalerContext->getAdvance(glyph);
329 fScalerContext->getMetrics(glyph);
332 return glyph;
335 const void* SkGlyphCache::findImage(const SkGlyph& glyph) {
336 if (glyph.fWidth > 0 && glyph.fWidth < kMaxGlyphWidth) {
337 if (NULL == glyph.fImage) {
338 size_t size = glyph.computeImageSize();
339 const_cast<SkGlyph&>(glyph).fImage = fGlyphAlloc.alloc(size,
342 if (NULL != glyph.fImage) {
343 fScalerContext->getImage(glyph);
352 return glyph.fImage;
355 const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
356 if (glyph.fWidth) {
357 if (glyph.fPath == NULL) {
358 const_cast<SkGlyph&>(glyph).fPath = SkNEW(SkPath);
359 fScalerContext->getPath(glyph, glyph.fPath);
361 glyph.fPath->countPoints() * sizeof(SkPoint);
364 return glyph.fPath;
367 const void* SkGlyphCache::findDistanceField(const SkGlyph& glyph) {
368 if (glyph.fWidth > 0 && glyph.fWidth < kMaxGlyphWidth) {
369 if (NULL == glyph.fDistanceField) {
370 size_t size = SkComputeDistanceFieldSize(glyph.fWidth, glyph.fHeight);
374 const void* image = this->findImage(glyph);
377 const_cast<SkGlyph&>(glyph).fDistanceField = fGlyphAlloc.alloc(size,
379 if (NULL != glyph.fDistanceField) {
380 SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
383 SkGenerateDistanceFieldFromA8Image((unsigned char*)glyph.fDistanceField,
384 (unsigned char*)glyph.fImage,
385 glyph.fWidth, glyph.fHeight,
386 glyph.rowBytes());
390 SkGenerateDistanceFieldFromBWImage((unsigned char*)glyph.fDistanceField,
391 (unsigned char*)glyph.fImage,
392 glyph.fWidth, glyph.fHeight,
393 glyph.rowBytes());
396 fGlyphAlloc.unalloc(glyph.fDistanceField);
397 const_cast<SkGlyph&>(glyph).fDistanceField = NULL;
403 return glyph.fDistanceField;
691 const SkGlyph* glyph = fGlyphArray[i];
692 SkASSERT(glyph);
693 SkASSERT(fGlyphAlloc.contains(glyph));
694 if (glyph->fImage) {
695 SkASSERT(fGlyphAlloc.contains(glyph->fImage));
697 if (glyph->fDistanceField) {
698 SkASSERT(fGlyphAlloc.contains(glyph->fDistanceField));