summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
authorBrian <brian@i915.localnet.net>2007-08-08 16:46:32 -0600
committerBrian <brian@i915.localnet.net>2007-08-08 16:46:32 -0600
commit8140642f5335eba5a524a7782fa40e6d095b5ada (patch)
treedfb6bc3314f3fc11ce1b5bc4ad143cf9ca7ed915 /src/mesa/pipe/softpipe
parent09a1b912605ff48c8782dcc5aae55ac77e27037b (diff)
use surface offset value in get_tile()
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c14
1 files changed, 12 insertions, 2 deletions
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++) {