[cairo-commit] cairo/src cairo-ft-font.c,1.77,1.78
Owen Taylor
commit at pdx.freedesktop.org
Wed Jul 27 04:07:48 PDT 2005
Committed by: otaylor
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv27081/src
Modified Files:
cairo-ft-font.c
Log Message:
2005-07-27 Owen Taylor <otaylor at redhat.com>
* src/cairo-ft-font.c (_get_bitmap_surface): FreeType bitmaps may
only be padded out to 8-bit boundaries, not 32-bit boundaries.
(_render_glyph_bitmap): Fix sign error in using glyphslot->bitmap_left
Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- cairo-ft-font.c 25 Jul 2005 23:23:05 -0000 1.77
+++ cairo-ft-font.c 27 Jul 2005 11:07:46 -0000 1.78
@@ -640,11 +640,28 @@
stride = (((width + 31) & ~31) >> 3);
if (own_buffer) {
data = bitmap->buffer;
+ assert (stride == bitmap->pitch);
} else {
data = malloc (stride * height);
if (!data)
return CAIRO_STATUS_NO_MEMORY;
- memcpy (data, bitmap->buffer, stride * height);
+
+ if (stride == bitmap->pitch) {
+ memcpy (data, bitmap->buffer, stride * height);
+ } else {
+ int i;
+ unsigned char *source, *dest;
+
+ source = bitmap->buffer;
+ dest = data;
+ for (i = height; i; i--) {
+ memcpy (dest, source, bitmap->pitch);
+ memset (dest + bitmap->pitch, '\0', stride - bitmap->pitch);
+
+ source += bitmap->pitch;
+ dest += stride;
+ }
+ }
}
if (_native_byte_order_lsb())
@@ -964,7 +981,7 @@
_get_bitmap_surface (val, &glyphslot->bitmap, FALSE, FC_RGBA_NONE);
- val->size.x = - glyphslot->bitmap_left;
+ val->size.x = glyphslot->bitmap_left;
val->size.y = - glyphslot->bitmap_top;
return status;
More information about the cairo-commit
mailing list