1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "packer.h"
|
---|
8 | #include "cr_mem.h"
|
---|
9 |
|
---|
10 | static unsigned char * __gl_HandlePixelMapData( GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values )
|
---|
11 | {
|
---|
12 | int packet_length =
|
---|
13 | sizeof( map ) +
|
---|
14 | sizeof( mapsize ) +
|
---|
15 | mapsize*size_of_value;
|
---|
16 | unsigned char *data_ptr = (unsigned char *) crPackAlloc( packet_length );
|
---|
17 |
|
---|
18 | WRITE_DATA( 0, GLenum, map );
|
---|
19 | WRITE_DATA( 4, GLsizei, mapsize );
|
---|
20 | crMemcpy( data_ptr + 8, values, mapsize*size_of_value );
|
---|
21 | return data_ptr;
|
---|
22 | }
|
---|
23 |
|
---|
24 | void PACK_APIENTRY crPackPixelMapfv(GLenum map, GLsizei mapsize,
|
---|
25 | const GLfloat *values )
|
---|
26 | {
|
---|
27 | unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
|
---|
28 |
|
---|
29 | crHugePacket( CR_PIXELMAPFV_OPCODE, data_ptr );
|
---|
30 | crPackFree( data_ptr );
|
---|
31 | }
|
---|
32 |
|
---|
33 | void PACK_APIENTRY crPackPixelMapuiv(GLenum map, GLsizei mapsize,
|
---|
34 | const GLuint *values )
|
---|
35 | {
|
---|
36 | unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
|
---|
37 |
|
---|
38 | crHugePacket( CR_PIXELMAPUIV_OPCODE, data_ptr );
|
---|
39 | crPackFree( data_ptr );
|
---|
40 | }
|
---|
41 |
|
---|
42 | void PACK_APIENTRY crPackPixelMapusv(GLenum map, GLsizei mapsize,
|
---|
43 | const GLushort *values )
|
---|
44 | {
|
---|
45 | unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
|
---|
46 |
|
---|
47 | crHugePacket( CR_PIXELMAPUSV_OPCODE, data_ptr );
|
---|
48 | crPackFree( data_ptr );
|
---|
49 | }
|
---|