int crdlm_pointers_Bitmap( struct instanceBitmap *instance, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap, CRClientState *c) { unsigned int size = ((int)((width + 7) / 8)) * height; /* glBitmap can be called with a NULL size 0 bitmap, say for * an empty glyph that only moves the current raster position. * crMemcpy will raise an exception with a NULL source pointer, even if * the size to copy is 0. So make sure we don't ram into this. * Also, the bitmap isn't necessarily just sitting in memory; the PixelStore * client-side state affects how it is read from memory. It's easiest to just * use the utility. */ if (instance && size > 0) { crBitmapCopy(width, height, instance->bitmap, bitmap, &c->unpack); } return size; }
void PACK_APIENTRY crPackBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap, const CRPixelPackState *unpack ) { const int noimagedata = (bitmap == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB); unsigned char *data_ptr; int data_length = 0; GLubyte *destBitmap = NULL; int packet_length = sizeof( width ) + sizeof( height ) + sizeof( xorig ) + sizeof( yorig ) + sizeof( xmove ) + sizeof( ymove ) + sizeof( GLuint ) + sizeof(GLint); if (!noimagedata) { data_length = CEIL8(width) * height / 8; packet_length += data_length; } data_ptr = (unsigned char *) crPackAlloc( packet_length ); WRITE_DATA( 0, GLsizei, width ); WRITE_DATA( 4, GLsizei, height ); WRITE_DATA( 8, GLfloat, xorig ); WRITE_DATA( 12, GLfloat, yorig ); WRITE_DATA( 16, GLfloat, xmove ); WRITE_DATA( 20, GLfloat, ymove ); WRITE_DATA( 24, GLuint, noimagedata ); WRITE_DATA( 28, GLint, (GLint) (uintptr_t) bitmap); if (!noimagedata) crBitmapCopy(width, height, (GLubyte *)(data_ptr + 32), bitmap, unpack); crHugePacket( CR_BITMAP_OPCODE, data_ptr ); crPackFree( data_ptr ); }