aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrFontScaler.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-07-30 07:59:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-30 07:59:20 -0700
commit4f19ca325e8d0122e0a04345272d17e674460806 (patch)
treeb2cdf5d2b5b0e02a0b974832bcf85146ae4e7602 /src/gpu/GrFontScaler.cpp
parentef004e1b49ce6ad488ea4444c0eb896ef37c1242 (diff)
Dont try to draw glyphs with unexpected mask formats
Diffstat (limited to 'src/gpu/GrFontScaler.cpp')
-rw-r--r--src/gpu/GrFontScaler.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp
index 84fd58133c..a9d5abff4e 100644
--- a/src/gpu/GrFontScaler.cpp
+++ b/src/gpu/GrFontScaler.cpp
@@ -103,7 +103,7 @@ void expand_bits(INT_TYPE* dst,
}
bool GrFontScaler::getPackedGlyphImage(const SkGlyph& glyph, int width, int height, int dstRB,
- void* dst) {
+ GrMaskFormat expectedMaskFormat, void* dst) {
SkASSERT(glyph.fWidth == width);
SkASSERT(glyph.fHeight == height);
const void* src = fStrike->findImage(glyph);
@@ -111,6 +111,18 @@ bool GrFontScaler::getPackedGlyphImage(const SkGlyph& glyph, int width, int heig
return false;
}
+ // 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.
+ if (getPackedGlyphMaskFormat(glyph) != expectedMaskFormat) {
+ const int bpp = GrMaskFormatBytesPerPixel(expectedMaskFormat);
+ for (int y = 0; y < height; y++) {
+ sk_bzero(dst, width * bpp);
+ dst = (char*)dst + dstRB;
+ }
+ return true;
+ }
+
int srcRB = glyph.rowBytes();
// The windows font host sometimes has BW glyphs in a non-BW strike. So it is important here to
// check the glyph's format, not the strike's format, and to be able to convert to any of the