bool GrAtlasGlyphCache::initAtlas(GrMaskFormat format) { int index = MaskFormatToAtlasIndex(format); if (!fAtlases[index]) { GrPixelConfig config = MaskFormatToPixelConfig(format, *fContext->caps()); int width = fAtlasConfigs[index].fWidth; int height = fAtlasConfigs[index].fHeight; int numPlotsX = fAtlasConfigs[index].numPlotsX(); int numPlotsY = fAtlasConfigs[index].numPlotsY(); fAtlases[index] = GrDrawOpAtlas::Make( fContext, config, width, height, numPlotsX, numPlotsY, &GrAtlasGlyphCache::HandleEviction, (void*)this); if (!fAtlases[index]) { return false; } } return true; }
bool GrBatchFontCache::initAtlas(GrMaskFormat format) { int index = MaskFormatToAtlasIndex(format); if (!fAtlases[index]) { GrPixelConfig config = MaskFormatToPixelConfig(format); int width = fAtlasConfigs[index].fWidth; int height = fAtlasConfigs[index].fHeight; int numPlotsX = fAtlasConfigs[index].numPlotsX(); int numPlotsY = fAtlasConfigs[index].numPlotsY(); fAtlases[index] = fContext->resourceProvider()->createAtlas(config, width, height, numPlotsX, numPlotsY, &GrBatchFontCache::HandleEviction, (void*)this); if (!fAtlases[index]) { return false; } } return true; }