VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.c@ 45248

最後變更 在這個檔案從45248是 27983,由 vboxsync 提交於 15 年 前

crOpenGL: fix 32/64bit bug

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 3.9 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 "cr_spu.h"
8#include "chromium.h"
9#include "cr_error.h"
10#include "cr_mem.h"
11#include "cr_net.h"
12#include "server_dispatch.h"
13#include "server.h"
14
15static GLint __sizeQuery( GLenum map )
16{
17 GLint get_values;
18 /* Windows compiler gets mad if variables might be uninitialized */
19 GLenum newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
20
21 switch( map )
22 {
23 case GL_PIXEL_MAP_I_TO_I:
24 newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
25 break;
26 case GL_PIXEL_MAP_S_TO_S:
27 newmap = GL_PIXEL_MAP_S_TO_S_SIZE;
28 break;
29 case GL_PIXEL_MAP_I_TO_R:
30 newmap = GL_PIXEL_MAP_I_TO_R_SIZE;
31 break;
32 case GL_PIXEL_MAP_I_TO_G:
33 newmap = GL_PIXEL_MAP_I_TO_G_SIZE;
34 break;
35 case GL_PIXEL_MAP_I_TO_B:
36 newmap = GL_PIXEL_MAP_I_TO_B_SIZE;
37 break;
38 case GL_PIXEL_MAP_I_TO_A:
39 newmap = GL_PIXEL_MAP_I_TO_A_SIZE;
40 break;
41 case GL_PIXEL_MAP_R_TO_R:
42 newmap = GL_PIXEL_MAP_R_TO_R_SIZE;
43 break;
44 case GL_PIXEL_MAP_G_TO_G:
45 newmap = GL_PIXEL_MAP_G_TO_G_SIZE;
46 break;
47 case GL_PIXEL_MAP_B_TO_B:
48 newmap = GL_PIXEL_MAP_B_TO_B_SIZE;
49 break;
50 case GL_PIXEL_MAP_A_TO_A:
51 newmap = GL_PIXEL_MAP_A_TO_A_SIZE;
52 break;
53 default:
54 crError( "Bad map in crServerDispatchGetPixelMap: %d", map );
55 break;
56 }
57
58 cr_server.head_spu->dispatch_table.GetIntegerv( newmap, &get_values );
59
60 return get_values;
61}
62
63void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapfv( GLenum map, GLfloat *values )
64{
65#ifdef CR_ARB_pixel_buffer_object
66 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
67 {
68 GLvoid *pbo_offset;
69
70 pbo_offset = (GLfloat*) ((uintptr_t) *((GLint*)values));
71
72 cr_server.head_spu->dispatch_table.GetPixelMapfv( map, pbo_offset );
73 }
74 else
75#endif
76 {
77 int size = sizeof( GLfloat );
78 int tabsize = __sizeQuery( map );
79 GLfloat *local_values;
80
81 size *= tabsize;
82 local_values = (GLfloat*)crAlloc( size );
83
84 cr_server.head_spu->dispatch_table.GetPixelMapfv( map, local_values );
85 crServerReturnValue( local_values, size );
86 crFree( local_values );
87 }
88}
89
90void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapuiv( GLenum map, GLuint *values )
91{
92#ifdef CR_ARB_pixel_buffer_object
93 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
94 {
95 GLvoid *pbo_offset;
96
97 pbo_offset = (GLuint*) ((uintptr_t) *((GLint*)values));
98
99 cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, pbo_offset );
100 }
101 else
102#endif
103 {
104 int size = sizeof( GLuint );
105 int tabsize = __sizeQuery( map );
106 GLuint *local_values;
107
108 size *= tabsize;
109 local_values = (GLuint*)crAlloc( size );
110
111 cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, local_values );
112 crServerReturnValue( local_values, size );
113 crFree( local_values );
114 }
115}
116
117void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapusv( GLenum map, GLushort *values )
118{
119#ifdef CR_ARB_pixel_buffer_object
120 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
121 {
122 GLvoid *pbo_offset;
123
124 pbo_offset = (GLushort*) ((uintptr_t) *((GLint*)values));
125
126 cr_server.head_spu->dispatch_table.GetPixelMapusv( map, pbo_offset );
127 }
128 else
129#endif
130 {
131 int size = sizeof( GLushort );
132 int tabsize = __sizeQuery( map );
133 GLushort *local_values;
134
135 size *= tabsize;
136 local_values = (GLushort*)crAlloc( size );
137
138 cr_server.head_spu->dispatch_table.GetPixelMapusv( map, local_values );
139 crServerReturnValue( local_values, size );
140 crFree( local_values );
141 }
142}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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