Fix image data length computation (XCB doesn't do this part).

This commit is contained in:
Keith Packard 2004-06-16 18:16:04 +00:00
parent 1e72b87b93
commit 5230af4e5a
3 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2004-06-16 Keith Packard <keithp@keithp.com>
* src/cairo_xcb_surface.c: (bytes_per_line),
(_cairo_xcb_surface_set_image):
Fix image data length computation (XCB doesn't do this part).
2004-06-11 David Reveman <c99drn@cs.umu.se>
* configure.in: Require glitz 0.1.4.

View file

@ -315,7 +315,7 @@ static int
bytes_per_line(XCBConnection *c, int width, int bpp)
{
int bitmap_pad = XCBGetSetup(c)->bitmap_format_scanline_pad;
return (bpp * width + bitmap_pad - 1) & -bitmap_pad;
return ((bpp * width + bitmap_pad - 1) & -bitmap_pad) >> 3;
}
static cairo_image_surface_t *
@ -401,7 +401,7 @@ _cairo_xcb_surface_set_image (void *abstract_surface,
_cairo_xcb_surface_ensure_gc (surface);
bpp = bits_per_pixel(surface->dpy, image->depth);
data_len = bytes_per_line(surface->dpy, surface->width, bpp) * surface->height;
data_len = bytes_per_line(surface->dpy, image->width, bpp) * image->height;
XCBPutImage(surface->dpy, ZPixmap, surface->drawable, surface->gc,
image->width,
image->height,

View file

@ -315,7 +315,7 @@ static int
bytes_per_line(XCBConnection *c, int width, int bpp)
{
int bitmap_pad = XCBGetSetup(c)->bitmap_format_scanline_pad;
return (bpp * width + bitmap_pad - 1) & -bitmap_pad;
return ((bpp * width + bitmap_pad - 1) & -bitmap_pad) >> 3;
}
static cairo_image_surface_t *
@ -401,7 +401,7 @@ _cairo_xcb_surface_set_image (void *abstract_surface,
_cairo_xcb_surface_ensure_gc (surface);
bpp = bits_per_pixel(surface->dpy, image->depth);
data_len = bytes_per_line(surface->dpy, surface->width, bpp) * surface->height;
data_len = bytes_per_line(surface->dpy, image->width, bpp) * image->height;
XCBPutImage(surface->dpy, ZPixmap, surface->drawable, surface->gc,
image->width,
image->height,