diff options
author | Brian Paul <[email protected]> | 2009-09-01 17:11:59 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-09-01 17:39:32 -0600 |
commit | d5b6dd0001c90b896400e69067d21297d7601f32 (patch) | |
tree | f1279b5546ebef8ee3b20f8277f93ae72dc9612c /src | |
parent | 278e76832fc26678592368b7b89bfddc137e0e93 (diff) |
st/mesa: use new _mesa_expand_bitmap() function
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 61 |
1 files changed, 4 insertions, 57 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index ccf972f8055..3171b673764 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -241,7 +241,7 @@ combined_bitmap_fragment_program(GLcontext *ctx) /** * Copy user-provide bitmap bits into texture buffer, expanding * bits into texels. - * "On" bits will set texels to 0xff. + * "On" bits will set texels to 0x0. * "Off" bits will not modify texels. * Note that the image is actually going to be upside down in * the texture. We deal with that with texcoords. @@ -253,63 +253,10 @@ unpack_bitmap(struct st_context *st, const GLubyte *bitmap, ubyte *destBuffer, uint destStride) { - GLint row, col; - -#define SET_PIXEL(COL, ROW) \ - destBuffer[(py + (ROW)) * destStride + px + (COL)] = 0x0; - - for (row = 0; row < height; row++) { - const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack, - bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); - - if (unpack->LsbFirst) { - /* Lsb first */ - GLubyte mask = 1U << (unpack->SkipPixels & 0x7); - for (col = 0; col < width; col++) { - - if (*src & mask) { - SET_PIXEL(col, row); - } - - if (mask == 128U) { - src++; - mask = 1U; - } - else { - mask = mask << 1; - } - } - - /* get ready for next row */ - if (mask != 1) - src++; - } - else { - /* Msb first */ - GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); - for (col = 0; col < width; col++) { - - if (*src & mask) { - SET_PIXEL(col, row); - } - - if (mask == 1U) { - src++; - mask = 128U; - } - else { - mask = mask >> 1; - } - } - - /* get ready for next row */ - if (mask != 128) - src++; - } - - } /* row */ + destBuffer += py * destStride + px; -#undef SET_PIXEL + _mesa_expand_bitmap(width, height, unpack, bitmap, + destBuffer, destStride, 0x0); } |