From fd995bf401fa5f0b2d2578ee35c61a277a17a39b Mon Sep 17 00:00:00 2001 From: David Reveman Date: Wed, 15 Feb 2006 15:15:20 +0000 Subject: Fix y-inverted pixel transfers --- ChangeLog | 6 ++++++ src/glitz_pixel.c | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a741471..e1c707b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-15 David Reveman + + * src/glitz_pixel.c (glitz_get_pixels): Flip clip box if output + scanline order is bottom up. + (_glitz_pixel_transform): y_src should always be added. + 2006-02-14 David Reveman * src/glx/glitz_glx_extension.c: GLX 1.3 or later includes fbconfig and diff --git a/src/glitz_pixel.c b/src/glitz_pixel.c index 4384970..4a3dd40 100644 --- a/src/glitz_pixel.c +++ b/src/glitz_pixel.c @@ -598,8 +598,10 @@ _glitz_pixel_transform (unsigned long transform, for (y = 0; y < height; y++) { if (src->format->scanline_order != dst->format->scanline_order) - src_op.line = &src->data[(src->height - (y + y_src) - 1) * + { + src_op.line = &src->data[(src->height + y_src - y - 1) * src_stride]; + } else src_op.line = &src->data[(y + y_src) * src_stride]; @@ -609,12 +611,12 @@ _glitz_pixel_transform (unsigned long transform, { src_op.line2 = &src->data[src_planeoffset + - (((src->height - (y + y_src) - 1) >> 1)) + (((src->height + y_src - y - 1) >> 1)) * (src_stride >> 1)]; src_op.line3 = &src->data[src_planeoffset + (src_planeoffset >> 2) + - (((src->height - (y + y_src) - 1) >> 1)) + (((src->height + y_src - y - 1) >> 1)) * (src_stride >> 1)]; } else @@ -1555,6 +1557,7 @@ glitz_get_pixels (glitz_surface_t *src, if (transform) { glitz_image_t src_image, dst_image; + int y1; src_image.data = data; src_image.format = &gl_format->pixel; @@ -1587,12 +1590,18 @@ glitz_get_pixels (glitz_surface_t *src, if (box.x1 < box.x2 && box.y1 < box.y2) { + if (format->scanline_order == + GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP) + y1 = height - (box.y2 + y_src); + else + y1 = box.y1 - y_src; + _glitz_pixel_transform (transform, &src_image, &dst_image, - box.x1 - x_src, box.y1 - y_src, + box.x1 - x_src, y1, format->xoffset + box.x1 - x_src, - format->skip_lines + box.y1 - y_src, + format->skip_lines + y1, box.x2 - box.x1, box.y2 - box.y1); } clip++; -- cgit v1.2.3