diff options
author | Brian Paul <[email protected]> | 1999-10-22 10:59:15 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 1999-10-22 10:59:15 +0000 |
commit | 3428162e27c5937291a3ea16d4cd339728ee7f52 (patch) | |
tree | d719e7d88cb2ed936b0bbfed36ce602b4c8ce879 | |
parent | e261963104561a9c195852a11eaa9b57ef41a67b (diff) |
added optimized GL_RGB, GL_UNSIGNED_BYTE case to gl_pack_rgba_span)
-rw-r--r-- | src/mesa/main/image.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 0a487ff7cb8..aef37bfa8e4 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.7 1999/10/19 20:31:08 brianp Exp $ */ +/* $Id: image.c,v 1.8 1999/10/22 10:59:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1683,9 +1683,21 @@ void gl_pack_rgba_span( const GLcontext *ctx, /* Test for optimized case first */ if (!ctx->Pixel.ScaleOrBiasRGBA && !ctx->Pixel.MapColorFlag && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { - /* simple case */ + /* common simple case */ MEMCPY( destination, rgba, n * 4 * sizeof(GLubyte) ); } + else if (!ctx->Pixel.ScaleOrBiasRGBA && !ctx->Pixel.MapColorFlag && + format == GL_RGB && type == GL_UNSIGNED_BYTE) { + /* common simple case */ + GLint i; + GLubyte *dest = (GLubyte *) destination; + for (i = 0; i < n; i++) { + dest[i+0] = rgba[i][RCOMP]; + dest[i+1] = rgba[i][GCOMP]; + dest[i+2] = rgba[i][BCOMP]; + dest += 3; + } + } else { GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH]; GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH]; |