aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_readpix.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-29 22:05:53 +0000
committermarha <marha@users.sourceforge.net>2010-11-29 22:05:53 +0000
commitfed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7 (patch)
treefa1ba494685a71e28a096990a8707680c7cb378b /mesalib/src/mesa/swrast/s_readpix.c
parentae340911c1ba1f98b418bd8f1a487fa4d79491b0 (diff)
parent6fda93be42ace9eeab0e82ceebb6798961c9105c (diff)
downloadvcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.gz
vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.bz2
vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/swrast/s_readpix.c')
-rw-r--r--mesalib/src/mesa/swrast/s_readpix.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c
index 368311e14..1de481248 100644
--- a/mesalib/src/mesa/swrast/s_readpix.c
+++ b/mesalib/src/mesa/swrast/s_readpix.c
@@ -27,7 +27,6 @@
#include "main/bufferobj.h"
#include "main/colormac.h"
#include "main/convolve.h"
-#include "main/context.h"
#include "main/feedback.h"
#include "main/formats.h"
#include "main/image.h"
@@ -192,7 +191,8 @@ fast_read_rgba_pixels( GLcontext *ctx,
if (!rb)
return GL_FALSE;
- ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
+ ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_ALPHA);
/* clipping should have already been done */
ASSERT(x + width <= (GLint) rb->Width);
@@ -265,10 +265,18 @@ adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4])
const GLuint rShift = 8 - fb->Visual.redBits;
const GLuint gShift = 8 - fb->Visual.greenBits;
const GLuint bShift = 8 - fb->Visual.blueBits;
- const GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1);
- const GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1);
- const GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1);
+ GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1);
+ GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1);
+ GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1);
GLuint i;
+
+ if (fb->Visual.redBits == 0)
+ rScale = 0;
+ if (fb->Visual.greenBits == 0)
+ gScale = 0;
+ if (fb->Visual.blueBits == 0)
+ bScale = 0;
+
for (i = 0; i < n; i++) {
GLint r, g, b;
/* convert float back to ubyte */