diff options
author | David Reveman <davidr@novell.com> | 2006-02-16 01:20:44 +0000 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2006-02-16 01:20:44 +0000 |
commit | 7a54cc935345267b12b8db4626855cd1e38b7dbd (patch) | |
tree | 6e657b1e986aae6f04166a9285762661c1da2103 | |
parent | 18cc256d047a2c12b5e2de3a7e728832b304b36a (diff) |
Fix glitz_get_pixels
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | src/glitz_pixel.c | 30 |
3 files changed, 30 insertions, 13 deletions
@@ -1,3 +1,10 @@ +2006-02-16 David Reveman <davidr@novell.com> + + * TODO: Add note about removing some complexity. + + * src/glitz_pixel.c (glitz_get_pixels): Patch together clipped + fetching of pixels. + 2006-02-15 David Reveman <davidr@novell.com> * src/glitz_pixel.c (glitz_get_pixels): Flip clip box if output @@ -1,3 +1,9 @@ +* Remove some complexity. Surfaces currently include x and y offsets + that are not longer used, removing these will make a lot of code easier to + read. get_pixels and set_pixels currently use both the clip rects and + the rect given as parameter. clip rects should be enough and it would + simplify the code in glitz_pixel.c a bit. + * More YUV surface formats (YUY2, UYVY, I420..). * Support for logical ops. diff --git a/src/glitz_pixel.c b/src/glitz_pixel.c index 271bf4b..6c78452 100644 --- a/src/glitz_pixel.c +++ b/src/glitz_pixel.c @@ -1266,7 +1266,7 @@ glitz_get_pixels (glitz_surface_t *src, char *pixels, *data = NULL; glitz_gl_pixel_format_t *gl_format = NULL; unsigned long transform = 0; - int src_x = 0, src_y = 0; + int src_x = x_src, src_y = y_src; int src_w = width, src_h = height; int bytes_per_line, bytes_per_pixel; glitz_color_format_t *color; @@ -1557,7 +1557,7 @@ glitz_get_pixels (glitz_surface_t *src, if (transform) { glitz_image_t src_image, dst_image; - int y1; + int y; src_image.data = data; src_image.format = &gl_format->pixel; @@ -1588,22 +1588,26 @@ glitz_get_pixels (glitz_surface_t *src, if (y_src + height < box.y2) box.y2 = y_src + height; - if (box.x1 < box.x2 && box.y1 < box.y2) + if (format->scanline_order == GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP) { -#if 0 - if (format->scanline_order == - GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP) - y1 = height - (box.y2 + y_src); - else -#endif - y1 = box.y1 - y_src; + src_image.data = data + bytes_per_line * (src_h - box.y2); + y = height - box.y2 + y_src; + } + else + { + src_image.data = data - bytes_per_line * (box.y1 - src_y); + y = box.y1 - y_src; + } + if (box.x1 < box.x2 && box.y1 < box.y2) + { _glitz_pixel_transform (transform, &src_image, &dst_image, - box.x1 - x_src, y1, - format->xoffset + box.x1 - x_src, - format->skip_lines + y1, + box.x1 - src_x, + 0, + format->xoffset + (box.x1 - x_src), + format->skip_lines + y, box.x2 - box.x1, box.y2 - box.y1); } clip++; |