diff options
Diffstat (limited to 'xc/extras/Mesa/src/readpix.c')
-rw-r--r-- | xc/extras/Mesa/src/readpix.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index 235444e03..cc1823897 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -75,11 +75,11 @@ static void read_index_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_shift_and_offset_ci( ctx, readWidth, index); + _mesa_shift_and_offset_ci( ctx, readWidth, index); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci(ctx, readWidth, index); + _mesa_map_ci(ctx, readWidth, index); } dest = _mesa_image_address(packing, pixels, @@ -199,7 +199,7 @@ static void read_depth_pixels( GLcontext *ctx, bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; - if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort) + if (type==GL_UNSIGNED_SHORT && ctx->Visual->DepthBits == 16 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ for (j=0;j<height;j++,y++) { @@ -207,7 +207,7 @@ static void read_depth_pixels( GLcontext *ctx, GLushort *dst = (GLushort*) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); GLint i; - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, depth); + _mesa_read_depth_span(ctx, width, x, y, depth); for (i = 0; i < width; i++) dst[i] = depth[i]; } @@ -218,11 +218,11 @@ static void read_depth_pixels( GLcontext *ctx, for (j=0;j<height;j++,y++) { GLdepth *dst = (GLdepth *) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, dst); + _mesa_read_depth_span(ctx, width, x, y, dst); } } else { - /* General case (slow) */ + /* General case (slower) */ for (j=0;j<height;j++,y++) { GLfloat depth[MAX_WIDTH]; GLvoid *dest; @@ -358,14 +358,14 @@ static void read_stencil_pixels( GLcontext *ctx, GLvoid *dest; GLstencil stencil[MAX_WIDTH]; - gl_read_stencil_span( ctx, readWidth, x, y, stencil ); + _mesa_read_stencil_span( ctx, readWidth, x, y, stencil ); if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, readWidth, stencil ); + _mesa_shift_and_offset_stencil( ctx, readWidth, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, readWidth, stencil ); + _mesa_map_stencil( ctx, readWidth, stencil ); } dest = _mesa_image_address( packing, pixels, @@ -500,8 +500,17 @@ read_fast_rgba_pixels( GLcontext *ctx, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - /* can't do scale, bias or mapping */ - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) + GLboolean applyTransferOps; + + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled; + /* can't do scale, bias, mapping, etc */ + if (applyTransferOps) return GL_FALSE; /* can't do fancy pixel packing */ @@ -559,8 +568,8 @@ read_fast_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLubyte (*)[4]) dest); if (ctx->Visual->SoftwareAlpha) { - gl_read_alpha_span(ctx, readWidth, srcX, srcY, - (GLubyte (*)[4]) dest); + _mesa_read_alpha_span(ctx, readWidth, srcX, srcY, + (GLubyte (*)[4]) dest); } dest += rowLength * 4; srcY++; @@ -641,13 +650,14 @@ static void read_rgba_pixels( GLcontext *ctx, gl_read_rgba_span( ctx, ctx->ReadBuffer, readWidth, x, y, rgba ); dest = _mesa_image_address( packing, pixels, width, height, - format, type, 0, j, 0); + format, type, 0, j, 0); _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, format, type, dest, packing, GL_TRUE ); } } else { + /* Convert color index pixels to RGBA */ GLint j; for (j=0;j<height;j++,y++) { GLubyte rgba[MAX_WIDTH][4]; @@ -657,13 +667,13 @@ static void read_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_map_ci( ctx, readWidth, index ); + _mesa_map_ci( ctx, readWidth, index ); } - gl_map_ci_to_rgba(ctx, readWidth, index, rgba ); + _mesa_map_ci_to_rgba_ubyte(ctx, readWidth, index, rgba ); dest = _mesa_image_address( packing, pixels, width, height, - format, type, 0, j, 0); + format, type, 0, j, 0); _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, format, type, dest, packing, GL_TRUE ); |