Index: src/gpu/GrFontCache.cpp |
diff --git a/src/gpu/GrFontCache.cpp b/src/gpu/GrFontCache.cpp |
index 2bc5567c19c5d74ea333b1a64b4b397f7268a8a3..f5c1c22a3da9cd87e2a081ddc1fb4b88a376947b 100644 |
--- a/src/gpu/GrFontCache.cpp |
+++ b/src/gpu/GrFontCache.cpp |
@@ -113,13 +113,23 @@ GrPlot* GrFontCache::addToAtlas(GrMaskFormat format, GrAtlas::ClientPlotUsage* u |
GrPixelConfig config = mask_format_to_pixel_config(format); |
int atlasIndex = mask_format_to_atlas_index(format); |
if (NULL == fAtlases[atlasIndex]) { |
- SkISize textureSize = SkISize::Make(GR_FONT_ATLAS_TEXTURE_WIDTH, |
- GR_FONT_ATLAS_TEXTURE_HEIGHT); |
- fAtlases[atlasIndex] = SkNEW_ARGS(GrAtlas, (fGpu, config, kNone_GrSurfaceFlags, |
- textureSize, |
- GR_FONT_ATLAS_NUM_PLOTS_X, |
- GR_FONT_ATLAS_NUM_PLOTS_Y, |
- true)); |
+ if (kA8_GrMaskFormat == format) { |
+ SkISize textureSize = SkISize::Make(GR_FONT_ATLAS_A8_TEXTURE_WIDTH, |
+ GR_FONT_ATLAS_TEXTURE_HEIGHT); |
+ fAtlases[atlasIndex] = SkNEW_ARGS(GrAtlas, (fGpu, config, kNone_GrSurfaceFlags, |
+ textureSize, |
+ GR_FONT_ATLAS_A8_NUM_PLOTS_X, |
+ GR_FONT_ATLAS_NUM_PLOTS_Y, |
+ true)); |
+ } else { |
+ SkISize textureSize = SkISize::Make(GR_FONT_ATLAS_TEXTURE_WIDTH, |
+ GR_FONT_ATLAS_TEXTURE_HEIGHT); |
+ fAtlases[atlasIndex] = SkNEW_ARGS(GrAtlas, (fGpu, config, kNone_GrSurfaceFlags, |
+ textureSize, |
+ GR_FONT_ATLAS_NUM_PLOTS_X, |
+ GR_FONT_ATLAS_NUM_PLOTS_Y, |
+ true)); |
+ } |
} |
return fAtlases[atlasIndex]->addToAtlas(usage, width, height, image, loc); |
} |
@@ -281,7 +291,9 @@ bool GrTextStrike::glyphTooLargeForAtlas(GrGlyph* glyph) { |
int width = glyph->fBounds.width(); |
int height = glyph->fBounds.height(); |
int pad = fUseDistanceField ? 2 * SK_DistanceFieldPad : 0; |
- if (width + pad > GR_FONT_ATLAS_PLOT_WIDTH) { |
+ int plotWidth = (kA8_GrMaskFormat == glyph->fMaskFormat) ? GR_FONT_ATLAS_A8_PLOT_WIDTH |
+ : GR_FONT_ATLAS_PLOT_WIDTH; |
+ if (width + pad > plotWidth) { |
return true; |
} |
if (height + pad > GR_FONT_ATLAS_PLOT_HEIGHT) { |