[ft] Fix wrong assumptions

If subpixel rendering is enabled, but FT returns a 8bit gray bitmap
(perhaps because the font has 8bit embedded bitmaps) we were hitting
the assertions because the assumptions made were wrong.  Fix up.
This commit is contained in:
Behdad Esfahbod 2013-07-05 15:22:18 -06:00
parent a0f556f37f
commit e738079302

View file

@ -1182,7 +1182,9 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
case FT_PIXEL_MODE_GRAY:
if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL ||
bitmap->pixel_mode == FT_PIXEL_MODE_GRAY)
{
stride = bitmap->pitch;
if (own_buffer) {
data = bitmap->buffer;
@ -1196,12 +1198,6 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
format = CAIRO_FORMAT_A8;
} else {
/* if we get there, the data from the source bitmap
* really comes from _fill_xrender_bitmap, and is
* made of 32-bit ARGB or ABGR values */
assert (own_buffer != 0);
assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
data = bitmap->buffer;
stride = bitmap->pitch;
format = CAIRO_FORMAT_ARGB32;