summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_bitmap.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-09-06 13:15:04 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-09-06 13:15:04 +0200
commitf02f63997ce65530788a6dfcb28f11790a14d938 (patch)
treefc6aedb5256bfb84eb170cb82addd2b6605510f8 /src/mesa/state_tracker/st_cb_bitmap.c
parente95e76e1255a3ad0ce604271301d090337b2e82b (diff)
parent9778731732b4753e79a1b786c65325a52392411d (diff)
Merge branch 'master' into r300-compiler
Conflicts: src/gallium/drivers/r300/r300_tgsi_to_rc.c
Diffstat (limited to 'src/mesa/state_tracker/st_cb_bitmap.c')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c67
1 files changed, 7 insertions, 60 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index ccf972f805..902fb38d1a 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);
}
@@ -328,7 +275,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
struct pipe_texture *pt;
/* PBO source... */
- bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap);
+ bitmap = _mesa_map_pbo_source(ctx, unpack, bitmap);
if (!bitmap) {
return NULL;
}
@@ -340,7 +287,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
0, width, height, 1,
PIPE_TEXTURE_USAGE_SAMPLER);
if (!pt) {
- _mesa_unmap_bitmap_pbo(ctx, unpack);
+ _mesa_unmap_pbo_source(ctx, unpack);
return NULL;
}
@@ -355,7 +302,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
unpack_bitmap(ctx->st, 0, 0, width, height, unpack, bitmap,
dest, transfer->stride);
- _mesa_unmap_bitmap_pbo(ctx, unpack);
+ _mesa_unmap_pbo_source(ctx, unpack);
/* Release transfer */
screen->transfer_unmap(screen, transfer);