GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { SkIRect bounds; if (fUseDistanceField) { if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { return NULL; } } else { if (!scaler->getPackedGlyphBounds(packed, &bounds)) { return NULL; } } GrGlyph* glyph = fPool.alloc(); glyph->init(packed, bounds); fCache.add(glyph); return glyph; }
GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, GrFontScaler* scaler) { SkIRect bounds; if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { return NULL; } } else { if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) { return NULL; } } GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph); GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW); glyph->init(packed, bounds, format); fCache.add(glyph); return glyph; }
GrGlyph* GrAtlasTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, SkGlyphCache* cache) { SkIRect bounds; if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { if (!get_packed_glyph_df_bounds(cache, skGlyph, &bounds)) { return nullptr; } } else { if (!get_packed_glyph_bounds(cache, skGlyph, &bounds)) { return nullptr; } } GrMaskFormat format = get_packed_glyph_mask_format(skGlyph); GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph)); glyph->init(packed, bounds, format); fCache.add(glyph); return glyph; }
GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { SkIRect bounds; if (fUseDistanceField) { if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { return NULL; } } else { if (!scaler->getPackedGlyphBounds(packed, &bounds)) { return NULL; } } GrMaskFormat format = scaler->getPackedGlyphMaskFormat(packed); GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW); glyph->init(packed, bounds, format); fCache.add(glyph); return glyph; }