summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-10-13 16:34:25 +0000
committerBrian Paul <[email protected]>2006-10-13 16:34:25 +0000
commit176501dfff14b5bec78af2b3487207d42c26d37a (patch)
treeb114ed316d67c6da4c460b130edc0643b90e8000 /src/mesa/main/image.c
parent8a9b5518fb946462fe55a62c1da1cab94d6d12cc (diff)
In _mesa_pack_rgba_span_float() we don't need to make a temporary copy of
incoming colors when applying pixel transfer ops. In all cases, the caller either indicates there's no pixel transfer ops, or the incoming colors are coming from temporary storage already and can be safely modified.
Diffstat (limited to 'src/mesa/main/image.c')
-rw-r--r--src/mesa/main/image.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 55753c22c5a..af116af7e81 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1065,18 +1065,18 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
* by the dstFormat, dstType and dstPacking. Used by glReadPixels,
* glGetConvolutionFilter(), etc.
* Incoming colors will be clamped to [0,1] if needed.
+ * Note: the rgba values will be modified by this function when any pixel
+ * transfer ops are enabled.
*/
void
-_mesa_pack_rgba_span_float( GLcontext *ctx,
- GLuint n, CONST GLfloat rgbaIn[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLbitfield transferOps )
+_mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLbitfield transferOps)
{
+ GLfloat luminance[MAX_WIDTH];
const GLint comps = _mesa_components_in_format(dstFormat);
- GLfloat rgbaCopy[MAX_WIDTH][4], luminance[MAX_WIDTH];
- const GLfloat (*rgba)[4];
GLuint i;
if (dstType != GL_FLOAT) {
@@ -1085,19 +1085,11 @@ _mesa_pack_rgba_span_float( GLcontext *ctx,
}
if (transferOps) {
- /* make copy of incoming data */
- _mesa_memcpy(rgbaCopy, rgbaIn, n * 4 * sizeof(GLfloat));
- _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgbaCopy);
- rgba = (const GLfloat (*)[4]) rgbaCopy;
-
+ _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba);
if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) {
return;
}
}
- else {
- /* use incoming data, not a copy */
- rgba = (const GLfloat (*)[4]) rgbaIn;
- }
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
/* compute luminance values */