From cf576500dcc9ab613abdd0556966c20ff89db036 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 5 May 2000 23:42:23 +0000 Subject: [PATCH] replaced buggy fxDDReadRGBAPixels() with read_R5G6B5_pixels() --- src/mesa/drivers/glide/fxddspan.c | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index c7479eb..c620cc3 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -452,31 +452,48 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color); } -static void fxDDReadRGBAPixels(const GLcontext *ctx, + +static void read_R5G6B5_pixels(const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; - - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n"); - } - - for(i=0;icurrentFB,x[i],bottom-y[i],1,1,0,&pixel); - rgba[i][RCOMP] = FX_PixelToR[pixel]; - rgba[i][GCOMP] = FX_PixelToG[pixel]; - rgba[i][BCOMP] = FX_PixelToB[pixel]; - rgba[i][ACOMP] = 255; + fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; + GrLfbInfo_t info; + BEGIN_BOARD_LOCK(); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { +#ifdef XF86DRI + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); +#else + const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ +#endif + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + GLuint i; + for(i=0;icurrentFB); } + END_BOARD_LOCK(); } + /************************************************************************/ /***** Depth functions *****/ /************************************************************************/ @@ -603,7 +620,7 @@ void fxSetupDDSpanPointers(GLcontext *ctx) /* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan;*/ ctx->Driver.ReadRGBASpan = read_R5G6B5_span; - ctx->Driver.ReadRGBAPixels =fxDDReadRGBAPixels; + ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels; ctx->Driver.ReadCI32Span =NULL; ctx->Driver.ReadCI32Pixels =NULL; -- 2.7.4