summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-05-22 17:40:07 +0000
committerBrian Paul <[email protected]>2006-05-22 17:40:07 +0000
commit17befff800084f9bbcfda86d2e087e646959f1f1 (patch)
treeba142bcf9fb7929e1590c20b10374ea0ee07c29a
parent8065c120c45e89e49ca9f707408fd7bd14db6b23 (diff)
GL_INDEX_OFFSET didn't work with CI->RGB mappings.
Added some const qualifiers.
-rw-r--r--src/mesa/swrast/s_drawpix.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index b2d6b1ef79f..cfe516733f1 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -61,6 +61,11 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
if (swrast->_RasterMask & MULTI_DRAW_BIT)
return GL_FALSE;
+ if (ctx->_ImageTransferState) {
+ /* don't handle any pixel transfer options here */
+ return GL_FALSE;
+ }
+
if (ctx->Depth.Test)
_swrast_span_default_z(ctx, &span);
if (swrast->_FogEnabled)
@@ -155,10 +160,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
* skip "skipRows" rows and skip "skipPixels" pixels/row.
*/
- if (format == GL_RGBA && type == CHAN_TYPE
- && ctx->_ImageTransferState==0) {
+ if (format == GL_RGBA && type == CHAN_TYPE) {
if (ctx->Visual.rgbMode) {
- GLchan *src = (GLchan *) pixels
+ const GLchan *src = (const GLchan *) pixels
+ (skipRows * rowLength + skipPixels) * 4;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
@@ -193,10 +197,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
}
return GL_TRUE;
}
- else if (format == GL_RGB && type == CHAN_TYPE
- && ctx->_ImageTransferState == 0) {
+ else if (format == GL_RGB && type == CHAN_TYPE) {
if (ctx->Visual.rgbMode) {
- GLchan *src = (GLchan *) pixels
+ const GLchan *src = (const GLchan *) pixels
+ (skipRows * rowLength + skipPixels) * 3;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
GLint row;
@@ -231,10 +234,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
}
return GL_TRUE;
}
- else if (format == GL_LUMINANCE && type == CHAN_TYPE
- && ctx->_ImageTransferState==0) {
+ else if (format == GL_LUMINANCE && type == CHAN_TYPE) {
if (ctx->Visual.rgbMode) {
- GLchan *src = (GLchan *) pixels
+ const GLchan *src = (const GLchan *) pixels
+ (skipRows * rowLength + skipPixels);
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
@@ -293,10 +295,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
}
return GL_TRUE;
}
- else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE
- && ctx->_ImageTransferState == 0) {
+ else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE) {
if (ctx->Visual.rgbMode) {
- GLchan *src = (GLchan *) pixels
+ const GLchan *src = (const GLchan *) pixels
+ (skipRows * rowLength + skipPixels)*2;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
@@ -304,7 +305,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
ASSERT(drawWidth <= MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
- GLchan *ptr = src;
+ const GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
span.array->rgba[i][0] = *ptr;
span.array->rgba[i][1] = *ptr;
@@ -323,7 +324,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
ASSERT(drawWidth <= MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
- GLchan *ptr = src;
+ const GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
span.array->rgba[i][0] = *ptr;
span.array->rgba[i][1] = *ptr;
@@ -341,7 +342,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
GLint row;
ASSERT(drawWidth <= MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
- GLchan *ptr = src;
+ const GLchan *ptr = src;
GLint i;
for (i=0;i<drawWidth;i++) {
span.array->rgba[i][0] = *ptr;
@@ -362,7 +363,8 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
return GL_TRUE;
}
else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) {
- GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels;
+ const GLubyte *src =
+ (const GLubyte *) pixels + skipRows * rowLength + skipPixels;
if (ctx->Visual.rgbMode) {
/* convert CI data to RGBA */
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
@@ -408,7 +410,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
return GL_TRUE;
}
}
- else if (ctx->_ImageTransferState==0) {
+ else {
/* write CI data to CI frame buffer */
GLint row;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {