summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2013-07-05 15:22:18 -0600
committerBehdad Esfahbod <behdad@behdad.org>2013-07-05 15:59:45 -0600
commite738079302a968b7b1fb9101cd4d92a8887bedce (patch)
tree0a5e3d2683b292883c036cf3e0f956d154b0cd13
parenta0f556f37fb7016aa304b7cf0e811c0d38f0b969 (diff)
[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.
-rw-r--r--src/cairo-ft-font.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 3bba59e47..3d2ff2700 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -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;