VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_pixelmap.c@ 70939

Last change on this file since 70939 was 69392, checked in by vboxsync, 7 years ago

GuestHost/OpenGL: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 1.8 KB
Line 
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
9static unsigned char * __gl_HandlePixelMapData( GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values )
10{
11 int i;
12
13 int packet_length =
14 sizeof( map ) +
15 sizeof( mapsize ) +
16 mapsize*size_of_value;
17 unsigned char *data_ptr = (unsigned char *) crPackAlloc( packet_length );
18
19 WRITE_DATA( 0, GLenum, SWAP32(map) );
20 WRITE_DATA( 4, GLsizei, SWAP32(mapsize) );
21
22 for (i = 0 ; i < mapsize ; i++)
23 {
24 switch( size_of_value )
25 {
26 case 2:
27 WRITE_DATA( 8 + i*sizeof(GLshort), GLshort, SWAP16(*((GLshort *)values + i) ));
28 break;
29 case 4:
30 WRITE_DATA( 8 + i*sizeof(GLint), GLint, SWAP32(*((GLint *)values + i) ));
31 break;
32 }
33 }
34 return data_ptr;
35}
36
37void PACK_APIENTRY crPackPixelMapfvSWAP(GLenum map, GLsizei mapsize,
38 const GLfloat *values )
39{
40 unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
41
42 crHugePacket( CR_PIXELMAPFV_OPCODE, data_ptr );
43 crPackFree( data_ptr );
44}
45
46void PACK_APIENTRY crPackPixelMapuivSWAP(GLenum map, GLsizei mapsize,
47 const GLuint *values )
48{
49 unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
50
51 crHugePacket( CR_PIXELMAPUIV_OPCODE, data_ptr );
52 crPackFree( data_ptr );
53}
54
55void PACK_APIENTRY crPackPixelMapusvSWAP(GLenum map, GLsizei mapsize,
56 const GLushort *values )
57{
58 unsigned char *data_ptr = __gl_HandlePixelMapData( map, mapsize, sizeof( *values ), values );
59
60 crHugePacket( CR_PIXELMAPUSV_OPCODE, data_ptr );
61 crPackFree( data_ptr );
62}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette