From 8140642f5335eba5a524a7782fa40e6d095b5ada Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 8 Aug 2007 16:46:32 -0600 Subject: use surface offset value in get_tile() --- src/mesa/pipe/softpipe/sp_surface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 174dcc0169..3260bcce75 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -321,10 +321,19 @@ a8r8g8b8_get_tile(struct pipe_surface *ps, GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p) { const GLuint *src - = ((const GLuint *) ps->region->map) + y * ps->region->pitch + x; + = ((const GLuint *) (ps->region->map + ps->offset)) + + y * ps->region->pitch + x; GLuint i, j; +#if 0 assert(x + w <= ps->width); assert(y + h <= ps->height); +#else + /* temp hack */ + if (x + w > ps->width) + w = ps->width - x; + if (y + h > ps->height) + h = ps->height -y; +#endif for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { p[0] = UBYTE_TO_FLOAT((src[j] >> 16) & 0xff); @@ -343,7 +352,8 @@ a1r5g5b5_get_tile(struct pipe_surface *ps, GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p) { const GLushort *src - = ((const GLushort *) ps->region->map) + y * ps->region->pitch + x; + = ((const GLushort *) (ps->region->map + ps->offset)) + + y * ps->region->pitch + x; GLuint i, j; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { -- cgit v1.2.3