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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user