[Mesa-dev] [PATCH 14/23] readpix: use integer conversion for RGBA/UNSIGNED_BYTE

Jordan Justen jordan.l.justen at intel.com
Fri Jan 4 18:41:37 PST 2013


If the source read buffer is integer based, and the the read
pixels type is RGBA/UNSIGNED_BYTE, then use the integer pixel
conversion path.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/readpix.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 5b80e9a..8e99bfb 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -325,6 +325,11 @@ slow_read_rgba_pixels( struct gl_context *ctx,
    GLboolean dst_is_integer = _mesa_is_enum_format_integer(format);
    GLboolean dst_is_uint = _mesa_is_format_unsigned(rbFormat);
 
+   if (_mesa_is_format_integer_color(rbFormat) && format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
+      format = GL_RGBA_INTEGER;
+      dst_is_integer = GL_TRUE;
+   }
+
    dstStride = _mesa_image_row_stride(packing, width, format, type);
    dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
 					   format, type, 0, 0);
-- 
1.7.10.4



More information about the mesa-dev mailing list