}
-/*
- * Pack the given RGBA span into client memory at 'dest' address
- * in the given pixel format and type.
- * Optionally apply the enabled pixel transfer ops.
- * Pack into memory using the given packing params struct.
- * This is used by glReadPixels and glGetTexImage?D()
- * \param ctx - the context
- * n - number of pixels in the span
- * rgba - the pixels
- * format - dest packing format
- * type - dest packing data type
- * destination - destination packing address
- * packing - pixel packing parameters
- * transferOps - bitmask of IMAGE_*_BIT operations to apply
- */
-void
-_mesa_pack_rgba_span_chan( GLcontext *ctx,
- GLuint n, CONST GLchan srcRgba[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLuint transferOps)
-{
- ASSERT((ctx->NewState & _NEW_PIXEL) == 0 || transferOps == 0);
-
- /* Test for optimized case first */
- if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) {
- /* common simple case */
- _mesa_memcpy(dstAddr, srcRgba, n * 4 * sizeof(GLchan));
- }
- else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) {
- /* common simple case */
- GLuint i;
- GLchan *dest = (GLchan *) dstAddr;
- for (i = 0; i < n; i++) {
- dest[0] = srcRgba[i][RCOMP];
- dest[1] = srcRgba[i][GCOMP];
- dest[2] = srcRgba[i][BCOMP];
- dest += 3;
- }
- }
- else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) {
- /* common simple case */
- GLuint i;
- GLubyte *dest = (GLubyte *) dstAddr;
- for (i = 0; i < n; i++) {
- dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]);
- dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]);
- dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]);
- dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]);
- dest += 4;
- }
- }
- else {
- /* general solution */
- GLuint i;
- GLfloat rgba[MAX_WIDTH][4];
- assert(n <= MAX_WIDTH);
- /* convert color components to floating point */
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]);
- rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]);
- rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]);
- rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]);
- }
- _mesa_pack_rgba_span_float(ctx, n, (const GLfloat (*)[4]) rgba,
- dstFormat, dstType, dstAddr,
- dstPacking, transferOps);
- }
-}
-
-
#define SWAP2BYTE(VALUE) \
{ \
GLubyte *bytes = (GLubyte *) &(VALUE); \
GLuint transferOps );
-extern void
-_mesa_pack_rgba_span_chan( GLcontext *ctx,
- GLuint n, CONST GLchan rgba[][4],
- GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLuint transferOps );
-
-
extern void
_mesa_unpack_color_span_chan( GLcontext *ctx,
GLuint n, GLenum dstFormat, GLchan dest[],