bool GrAtlasManager::initAtlas(GrMaskFormat format) { int index = MaskFormatToAtlasIndex(format); if (fAtlases[index] == nullptr) { GrPixelConfig config = mask_format_to_pixel_config(format); SkISize atlasDimensions = fAtlasConfigs.atlasDimensions(format); SkISize numPlots = fAtlasConfigs.numPlots(format); fAtlases[index] = GrDrawOpAtlas::Make( fProxyProvider, config, atlasDimensions.width(), atlasDimensions.height(), numPlots.width(), numPlots.height(), fAllowMultitexturing, &GrGlyphCache::HandleEviction, fGlyphCache); if (!fAtlases[index]) { return false; } } return true; }
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; }
bool GrAtlasManager::initAtlas(GrMaskFormat format) { int index = MaskFormatToAtlasIndex(format); if (fAtlases[index] == nullptr) { GrColorType grColorType = mask_format_to_gr_color_type(format); SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format); SkISize plotDimensions = fAtlasConfig.plotDimensions(format); const GrBackendFormat format = fCaps->getBackendFormatFromGrColorType(grColorType, GrSRGBEncoded::kNo); fAtlases[index] = GrDrawOpAtlas::Make( fProxyProvider, format, grColorType, atlasDimensions.width(), atlasDimensions.height(), plotDimensions.width(), plotDimensions.height(), fAllowMultitexturing, &GrStrikeCache::HandleEviction, fGlyphCache); if (!fAtlases[index]) { return false; } } return true; }
GrTexture* GrBatchFontCache::getTexture(GrMaskFormat format) { int atlasIndex = MaskFormatToAtlasIndex(format); SkASSERT(fAtlases[atlasIndex]); return fAtlases[atlasIndex]->getTexture(); }
inline GrBatchAtlas* GrBatchFontCache::getAtlas(GrMaskFormat format) const { int atlasIndex = MaskFormatToAtlasIndex(format); SkASSERT(fAtlases[atlasIndex]); return fAtlases[atlasIndex]; }