pack_pixels.c revision 4843615ac0ee0063b79548dfdcd73a58dc3c4a9d
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* Copyright (c) 2001, Stanford University
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * All rights reserved
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * See the file LICENSE.txt for information on redistributing this software.
af8d59d05d72f134aeea62712f1286b369807d52vboxsyncvoid PACK_APIENTRY crPackDrawPixels(GLsizei width, GLsizei height,
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync unsigned char *data_ptr;
af8d59d05d72f134aeea62712f1286b369807d52vboxsync int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
af8d59d05d72f134aeea62712f1286b369807d52vboxsync imagesize = crImageSize( format, type, width, height );
af8d59d05d72f134aeea62712f1286b369807d52vboxsync crDebug("crPackDrawPixels: 0 image size, ignoring");
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync data_ptr = (unsigned char *) crPackAlloc( packet_length );
e761514762c8705557b347266d54ade68888537cvboxsync WRITE_DATA( 20, GLint, (GLint) (uintptr_t) pixels );
af8d59d05d72f134aeea62712f1286b369807d52vboxsync (void *) (data_ptr + 24), format, type, NULL, /* dst */
af8d59d05d72f134aeea62712f1286b369807d52vboxsyncvoid PACK_APIENTRY crPackReadPixels(GLint x, GLint y, GLsizei width,
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync unsigned char *data_ptr;
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync sprintf(string, "crPackReadPixels(format 0x%x or type 0x%x)", format, type);
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync __PackError(__LINE__, __FILE__, GL_INVALID_ENUM, string);
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync /* default bytes_per_row so crserver can allocate memory */
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync GLint remainder = bytes_per_row % packstate->alignment;
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync stride = bytes_per_row + (packstate->alignment - remainder);
2f44080df90cb90c1e524d97c8e327b40298f3c6vboxsync CR_GET_BUFFERED_POINTER(pc, 48 + sizeof(CRNetworkPointer) );
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync WRITE_DATA( 24, GLint, stride ); /* XXX not really used! */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* Round N up to the next multiple of 8 */
af8d59d05d72f134aeea62712f1286b369807d52vboxsyncvoid PACK_APIENTRY crPackBitmap(GLsizei width, GLsizei height,
af8d59d05d72f134aeea62712f1286b369807d52vboxsync GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
af8d59d05d72f134aeea62712f1286b369807d52vboxsync const GLubyte *bitmap, const CRPixelPackState *unpack )
af8d59d05d72f134aeea62712f1286b369807d52vboxsync const int noimagedata = (bitmap == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync unsigned char *data_ptr;
af8d59d05d72f134aeea62712f1286b369807d52vboxsync data_ptr = (unsigned char *) crPackAlloc( packet_length );
e761514762c8705557b347266d54ade68888537cvboxsync WRITE_DATA( 28, GLint, (GLint) (uintptr_t) bitmap);
af8d59d05d72f134aeea62712f1286b369807d52vboxsync crBitmapCopy(width, height, (GLubyte *)(data_ptr + 32), bitmap, unpack);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync ZPix - compressed DrawPixels
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid PACK_APIENTRY crPackZPixCR( GLsizei width, GLsizei height,
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync unsigned char *data_ptr;
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync sizeof( int ) + /* packet size */
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync sizeof( type ) +
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crDebug("PackZPixCR: fb %d x %d, state %d, zlen = %d, plen = %d",
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync width, height, ztype, length, packet_length);
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync data_ptr = (unsigned char *) crPackAlloc( packet_length );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackGetTexImage( GLenum target, GLint level, GLenum format, GLenum type,
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync GLvoid * pixels, const CRPixelPackState * packstate,
420f9d67d828890dcf3c94f96bb4b72885ff48a2vboxsync unsigned char *data_ptr;