Remove unnecessary check when unpacking glyphs.

There is a very old bug (http://crbug.com/510931) that was fixed back
then via a special check when unpacking glyphs. However, it was noted in
another CL that it doesn't seem this should still be possible. The only
case where expectedMaskFormat != maskFormat is when we have a 565 glyph
but a RGBA8 texture due to lack of 565 support. Otherwise they should be
the same. There is no access of the glyph cache that should change the
maskFormat.

Change-Id: I4a6ea11e5095f47f4ce5cc095db8bee084dd8a31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549846
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2022-06-14 15:01:39 -04:00 committed by SkCQ
parent 79aaa7c4d2
commit 70b01b9f4f

View File

@ -132,22 +132,11 @@ static void get_packed_glyph_image(
}
}
} else {
// crbug:510931
// Retrieving the image from the cache can actually change the mask format. This case is
// very uncommon so for now we just draw a clear box for these glyphs.
const int bpp = MaskFormatBytesPerPixel(expectedMaskFormat);
for (int y = 0; y < height; y++) {
sk_bzero(dst, width * bpp);
dst = (char*)dst + dstRB;
}
SkUNREACHABLE;
}
}
// returns true if glyph successfully added to texture atlas, false otherwise. If the glyph's
// mask format has changed, then addGlyphToAtlas will draw a clear box. This will almost never
// happen.
// TODO we can handle some of these cases if we really want to, but the long term solution is to
// get the actual glyph image itself when we get the glyph metrics.
// returns true if glyph successfully added to texture atlas, false otherwise.
GrDrawOpAtlas::ErrorCode GrAtlasManager::addGlyphToAtlas(const SkGlyph& skGlyph,
Glyph* glyph,
int srcPadding,