Add new method for calculating text atlas sizes
Uses a fixed quantized table to compute the ARGB texture dimensions,
and compute the A8 dimensions from that. Plot sizes are computed
based on the respective atlas's dimensions.
Bug: skia:
Change-Id: I28c56557094efa49d1a011a1d6145ef3a79b7cac
Reviewed-on: https://skia-review.googlesource.com/c/177068
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index faf9223..33f906c 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -17,7 +17,7 @@
, fProxyProvider{proxyProvider}
, fCaps{fProxyProvider->refCaps()}
, fGlyphCache{glyphCache}
- , fAtlasConfigs{fCaps->maxTextureSize(), maxTextureBytes} { }
+ , fAtlasConfig{fCaps->maxTextureSize(), maxTextureBytes} { }
GrAtlasManager::~GrAtlasManager() = default;
@@ -170,7 +170,7 @@
}
// Set all the atlas sizes to 1x1 plot each.
- new (&fAtlasConfigs) GrDrawOpAtlasConfig{};
+ new (&fAtlasConfig) GrDrawOpAtlasConfig{};
}
bool GrAtlasManager::initAtlas(GrMaskFormat format) {
@@ -178,14 +178,14 @@
if (fAtlases[index] == nullptr) {
GrPixelConfig config = mask_format_to_pixel_config(format);
SkColorType colorType = mask_format_to_color_type(format);
- SkISize atlasDimensions = fAtlasConfigs.atlasDimensions(format);
- SkISize numPlots = fAtlasConfigs.numPlots(format);
+ SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format);
+ SkISize plotDimensions = fAtlasConfig.plotDimensions(format);
const GrBackendFormat format = fCaps->getBackendFormatFromColorType(colorType);
fAtlases[index] = GrDrawOpAtlas::Make(
fProxyProvider, format, config, atlasDimensions.width(), atlasDimensions.height(),
- numPlots.width(), numPlots.height(), fAllowMultitexturing,
+ plotDimensions.width(), plotDimensions.height(), fAllowMultitexturing,
&GrGlyphCache::HandleEviction, fGlyphCache);
if (!fAtlases[index]) {
return false;