Extend GetAlphaTextureBounds workaround.

On large glyphs GetAlphaTextureBounds returns empty bounds but no error
when the glyph does, in fact, have non empty bounds. An existing work
around exists to fall back to aliased bounds which are more likely to
give correct results. This workaround was added specifically for falling
back to aliased bounds in the case cleartype bounds were not available,
but this is now also possible with the new grayscale bounds. Extend the
workaround to grayscale bounds as well.

Bug: chromium:926885
Change-Id: Ib7b2028b48a3cb0268f2af8eebbe7b0889391dae
Reviewed-on: https://skia-review.googlesource.com/c/189300
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2019-02-04 13:13:17 -05:00 committed by Skia Commit-Bot
parent 0b46a39820
commit 79ac5081d5

View File

@ -710,9 +710,11 @@ void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) {
}
// GetAlphaTextureBounds succeeds but returns an empty RECT if there are no
// glyphs of the specified texture type. When this happens, try with the
// alternate texture type.
if (DWRITE_TEXTURE_CLEARTYPE_3x1 == fTextureType) {
// glyphs of the specified texture type or it is too big for smoothing.
// When this happens, try with the alternate texture type.
if (DWRITE_TEXTURE_ALIASED_1x1 != fTextureType ||
DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE == fAntiAliasMode)
{
HRVM(this->getBoundingBox(glyph,
DWRITE_RENDERING_MODE_ALIASED,
DWRITE_TEXTURE_ALIASED_1x1,