summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i965simple
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-01-18 19:08:30 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2008-01-18 19:11:30 +0100
commite44bdcf9789caf9971c3c94605fbff7ce66af7ba (patch)
treecd906e10125440159e82849cd2c427be0f877021 /src/mesa/pipe/i965simple
parent25e2b8d669e01aac551276af7f34d8708d8cb9d0 (diff)
Unify copy_rect helpers.
Some of the copies were buggy.
Diffstat (limited to 'src/mesa/pipe/i965simple')
-rw-r--r--src/mesa/pipe/i965simple/brw_surface.c56
1 files changed, 11 insertions, 45 deletions
diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c
index 4eacbdf82b..76b8c73d5c 100644
--- a/src/mesa/pipe/i965simple/brw_surface.c
+++ b/src/mesa/pipe/i965simple/brw_surface.c
@@ -76,40 +76,6 @@ brw_get_tex_surface(struct pipe_context *pipe,
}
-static void
-copy_rect(ubyte * dst,
- unsigned cpp,
- unsigned dst_pitch,
- unsigned dst_x,
- unsigned dst_y,
- unsigned width,
- unsigned height,
- const ubyte *src,
- unsigned src_pitch,
- unsigned src_x,
- unsigned src_y)
-{
- unsigned i;
-
- dst_pitch *= cpp;
- src_pitch *= cpp;
- dst += dst_x * cpp;
- src += src_x * cpp;
- dst += dst_y * dst_pitch;
- src += src_y * dst_pitch;
- width *= cpp;
-
- if (width == dst_pitch && width == src_pitch)
- memcpy(dst, src, height * width);
- else {
- for (i = 0; i < height; i++) {
- memcpy(dst, src, width);
- dst += dst_pitch;
- src += src_pitch;
- }
- }
-}
-
/* Upload data to a rectangular sub-region. Lots of choices how to do this:
*
* - memcpy by span to current destination
@@ -124,9 +90,9 @@ brw_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_pitch,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- copy_rect(pipe_surface_map(dst) + dst->offset,
- dst->cpp, dst->pitch,
- dstx, dsty, width, height, src, src_pitch, srcx, srcy);
+ pipe_copy_rect(pipe_surface_map(dst) + dst->offset,
+ dst->cpp, dst->pitch,
+ dstx, dsty, width, height, src, src_pitch, srcx, srcy);
pipe_surface_unmap(dst);
}
@@ -146,14 +112,14 @@ brw_surface_copy(struct pipe_context *pipe,
assert(dst->cpp == src->cpp);
if (0) {
- copy_rect(pipe_surface_map(dst) + dst->offset,
- dst->cpp,
- dst->pitch,
- dstx, dsty,
- width, height,
- pipe_surface_map(src) + src->offset,
- src->pitch,
- srcx, srcy);
+ pipe_copy_rect(pipe_surface_map(dst) + dst->offset,
+ dst->cpp,
+ dst->pitch,
+ dstx, dsty,
+ width, height,
+ pipe_surface_map(src) + src->offset,
+ src->pitch,
+ srcx, srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);