VirtualBox

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

最後變更 在這個檔案從34356是 33457,由 vboxsync 提交於 14 年 前

crOpenGL: tabs to spaces

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 1.8 KB
 
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}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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