[cairo-ft-font] Early detection of a zero sized bitmap.

Under rare circumstances we may need to extract a surface that
represents a bitmap with width==0 and rows==0. Detect this case at the
start and simply return a zero-sized surface.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12284.
(cherry picked from commit d62f886168)
This commit is contained in:
Chris Wilson 2007-09-05 08:07:41 +01:00 committed by Carl Worth
parent 9b0a093547
commit 7092924195

View file

@ -736,6 +736,12 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
width = bitmap->width;
height = bitmap->rows;
if (width == 0 || height == 0) {
*surface = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
return (*surface)->base.status;
}
switch (bitmap->pixel_mode) {
case FT_PIXEL_MODE_MONO:
stride = (((width + 31) & ~31) >> 3);