diff options
author | Brian <[email protected]> | 2007-08-08 09:35:16 +0100 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-08 09:36:53 +0100 |
commit | f62b573922dd5274c01250fa941f9b1a151e6c45 (patch) | |
tree | 87d6fa33dacc985d8b32c07b8a1ae23f974ad5d3 /src/mesa/pipe/softpipe/sp_surface.c | |
parent | 08f33a025100dea2d951e6d628891fe294b18082 (diff) |
more get_tile() work
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_surface.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_surface.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 87bb64af1a0..85e1fcfa38f 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -322,12 +322,37 @@ a8r8g8b8_get_tile(struct pipe_surface *ps, { const GLuint *src = ((const GLuint *) ps->region->map) + y * ps->region->pitch + x; - assert(w == 1); - assert(h == 1); - p[0] = UBYTE_TO_FLOAT((src[0] >> 16) & 0xff); - p[1] = UBYTE_TO_FLOAT((src[0] >> 8) & 0xff); - p[2] = UBYTE_TO_FLOAT((src[0] >> 0) & 0xff); - p[3] = UBYTE_TO_FLOAT((src[0] >> 24) & 0xff); + GLuint i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + p[0] = UBYTE_TO_FLOAT((src[j] >> 16) & 0xff); + p[1] = UBYTE_TO_FLOAT((src[j] >> 8) & 0xff); + p[2] = UBYTE_TO_FLOAT((src[j] >> 0) & 0xff); + p[3] = UBYTE_TO_FLOAT((src[j] >> 24) & 0xff); + p += 4; + } + src += ps->region->pitch; + } +} + + +static void +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; + GLuint i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + p[0] = ((src[j] >> 10) & 0x1f) * (1.0 / 31); + p[1] = ((src[j] >> 5) & 0x1f) * (1.0 / 31); + p[2] = ((src[j] ) & 0x1f) * (1.0 / 31); + p[3] = src[j] >> 15; + p += 4; + } + src += ps->region->pitch; + } } @@ -358,6 +383,9 @@ init_quad_funcs(struct softpipe_surface *sps) case PIPE_FORMAT_U_A8_R8_G8_B8: sps->surface.get_tile = a8r8g8b8_get_tile; break; + case PIPE_FORMAT_U_A1_R5_G5_B5: + sps->surface.get_tile = a1r5g5b5_get_tile; + break; default: /* assert(0); |