X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_readpix.c;h=48b9408d242f49bb790ed8e91b0164a41d3506e9;hb=5cd7042088bdd0b5d9a92f4fc927029a46a23734;hp=6186f92899efdd47535abc8dc85eec5402c72658;hpb=101d1a658a614d1e2ec02b1e697f6161291af653;p=mesa.git diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 6186f92899e..48b9408d242 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -24,16 +24,16 @@ #include "main/glheader.h" -#include "bufferobj.h" +#include "main/bufferobj.h" #include "main/colormac.h" -#include "convolve.h" +#include "main/convolve.h" #include "main/context.h" -#include "feedback.h" -#include "image.h" +#include "main/feedback.h" +#include "main/image.h" #include "main/macros.h" #include "main/imports.h" -#include "pixel.h" -#include "state.h" +#include "main/pixel.h" +#include "main/state.h" #include "s_context.h" #include "s_depth.h" @@ -129,7 +129,8 @@ read_depth_pixels( GLcontext *ctx, rb->GetRow(ctx, rb, width, x, y, dest); /* convert range from 24-bit to 32-bit */ for (k = 0; k < width; k++) { - dest[k] = (dest[k] << 8) | (dest[k] >> 24); + /* Note: put MSByte of 24-bit value into LSByte */ + dest[k] = (dest[k] << 8) | ((dest[k] >> 16) & 0xff); } } } @@ -554,11 +555,11 @@ _swrast_ReadPixels( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_pixelstore_attrib clippedPacking = *packing; - /* Need to do RENDER_START before clipping or anything else since this - * is where a driver may grab the hw lock and get an updated window - * size. + /* Need to do swrast_render_start() before clipping or anything else + * since this is where a driver may grab the hw lock and get an updated + * window size. */ - RENDER_START(swrast, ctx); + swrast_render_start(ctx); if (ctx->NewState) _mesa_update_state(ctx); @@ -569,13 +570,14 @@ _swrast_ReadPixels( GLcontext *ctx, /* Do all needed clipping here, so that we can forget about it later */ if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) { /* The ReadPixels region is totally outside the window bounds */ - goto end; + swrast_render_finish(ctx); + return; } - pixels = _mesa_map_readpix_pbo(ctx, &clippedPacking, pixels); + pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels); if (!pixels) return; - + switch (format) { case GL_COLOR_INDEX: read_index_pixels(ctx, x, y, width, height, type, pixels, @@ -612,9 +614,7 @@ _swrast_ReadPixels( GLcontext *ctx, /* don't return yet, clean-up */ } + swrast_render_finish(ctx); -end: - RENDER_FINISH(swrast, ctx); - - _mesa_unmap_readpix_pbo(ctx, &clippedPacking); + _mesa_unmap_pbo_dest(ctx, &clippedPacking); }