diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2013-08-04 20:08:46 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2013-08-04 20:12:06 -0400 |
commit | 46d9db96d460fea72f0420102e8a90c6a7231f79 (patch) | |
tree | d8eb158b1f827b95462f73aaf3bb2b0c110c9194 | |
parent | 34a747e7bdeba1cfe17318f80fbe6720d47bc023 (diff) |
[ft] Ensure alignment of bitmaps received from FreeType
-rw-r--r-- | src/cairo-ft-font.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 975f9d226..0dfe9bea6 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -1189,6 +1189,14 @@ _get_bitmap_surface (FT_Bitmap *bitmap, bitmap->pixel_mode == FT_PIXEL_MODE_GRAY) { stride = bitmap->pitch; + + /* We don't support stride not multiple of 4. */ + if (stride & 3) + { + assert (!own_buffer); + goto convert; + } + if (own_buffer) { data = bitmap->buffer; } else { @@ -1224,6 +1232,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, #endif case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: + convert: if (!own_buffer && library) { /* This is pretty much the only case that we can get in here. */ |