summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-06-23 09:47:12 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-06-23 09:47:12 -0600
commitf738c3acaca235c68a26c7b7d41903c64a36ae9f (patch)
tree5fedbbbb031d7b949e9431798c5ba1edf45526b6 /src/gallium/auxiliary
parent81b1a4224de1992d25ada006f54ff9147aa82da3 (diff)
gallium: fix Y-inverted copies
Don't require the caller to pass a non-intuitive negative src_y coord anymore when doing a src-inverted copy.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/p_util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/p_util.c b/src/gallium/auxiliary/util/p_util.c
index 0e3f082b3ee..4e60b1b8418 100644
--- a/src/gallium/auxiliary/util/p_util.c
+++ b/src/gallium/auxiliary/util/p_util.c
@@ -37,6 +37,7 @@
/**
* Copy 2D rect from one place to another.
* Position and sizes are in pixels.
+ * src_pitch may be negative to do vertical flip of pixels from source.
*/
void
pipe_copy_rect(ubyte * dst,
@@ -52,6 +53,7 @@ pipe_copy_rect(ubyte * dst,
int src_y)
{
unsigned i;
+ int src_pitch_pos = src_pitch < 0 ? -src_pitch : src_pitch;
assert(cpp > 0);
assert(src_x >= 0);
@@ -61,10 +63,11 @@ pipe_copy_rect(ubyte * dst,
dst_pitch *= cpp;
src_pitch *= cpp;
+ src_pitch_pos *= cpp;
dst += dst_x * cpp;
src += src_x * cpp;
dst += dst_y * dst_pitch;
- src += src_y * src_pitch;
+ src += src_y * src_pitch_pos;
width *= cpp;
if (width == dst_pitch && width == src_pitch)