summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-10 17:59:43 -0700
committerBrian Paul <[email protected]>2011-11-11 07:12:59 -0700
commit16bff7e2cec06b340e0c7c5dd935c53353f289b0 (patch)
tree0031764fbd6b8d38fb8eb2cf3a2c2c68a9b4fa81 /src/mesa
parent0f3f6cf02b7a1cb8e1d828be6730e246d8dd0070 (diff)
swrast: avoid calling _mesa_get_srgb_format_linear() inside a loop
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_readpix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 54f42db0254..3cef7304a4a 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -236,6 +236,7 @@ slow_read_rgba_pixels( struct gl_context *ctx,
GLbitfield transferOps )
{
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+ const gl_format rbFormat = _mesa_get_srgb_format_linear(rb->Format);
union {
float f[MAX_WIDTH][4];
unsigned int i[MAX_WIDTH][4];
@@ -252,11 +253,10 @@ slow_read_rgba_pixels( struct gl_context *ctx,
for (j = 0; j < height; j++) {
if (_mesa_is_integer_format(format)) {
- _mesa_unpack_int_rgba_row(rb->Format, width, map, rgba.i);
+ _mesa_unpack_int_rgba_row(rbFormat, width, map, rgba.i);
_mesa_pack_rgba_span_int(ctx, width, rgba.i, format, type, dst);
} else {
- _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb->Format),
- width, map, rgba.f);
+ _mesa_unpack_rgba_row(rbFormat, width, map, rgba.f);
_mesa_pack_rgba_span_float(ctx, width, rgba.f, format, type, dst,
packing, transferOps);
}