summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2006-02-16 01:20:44 +0000
committerDavid Reveman <davidr@novell.com>2006-02-16 01:20:44 +0000
commit7a54cc935345267b12b8db4626855cd1e38b7dbd (patch)
tree6e657b1e986aae6f04166a9285762661c1da2103
parent18cc256d047a2c12b5e2de3a7e728832b304b36a (diff)
Fix glitz_get_pixels
-rw-r--r--ChangeLog7
-rw-r--r--TODO6
-rw-r--r--src/glitz_pixel.c30
3 files changed, 30 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index e1c707b..86b21e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/TODO b/TODO
index 305817b..d0cf467 100644
--- a/TODO
+++ b/TODO
@@ -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++;