diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-06-25 04:05:11 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-06-25 04:05:11 +1000 |
commit | b40ed6a0b54d1ba74799aeb3f529c4d298625aa1 (patch) | |
tree | da1ae04dcd8c1db1294f3caab9ba28760ccb3f8e /src/gallium/auxiliary/util/p_util.c | |
parent | 95fe122f67024f55d555e2816a95409a8b53a49e (diff) | |
parent | 0561a293b6596641c0200df7e6580599ecb8b111 (diff) |
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/gallium/auxiliary/util/p_util.c')
-rw-r--r-- | src/gallium/auxiliary/util/p_util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/p_util.c b/src/gallium/auxiliary/util/p_util.c index 2a92f8e408..4e60b1b841 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,13 +53,21 @@ 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); + assert(src_y >= 0); + assert(dst_x >= 0); + assert(dst_y >= 0); 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) |