VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/util/calllists.c@ 59922

最後變更 在這個檔案從59922是 53726,由 vboxsync 提交於 10 年 前

properties.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.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 "chromium.h"
8#include "cr_calllists.h"
9
10#define EXPAND(typeEnum, typeCast, increment, value) \
11 case typeEnum: \
12 { \
13 const typeCast *array = (const typeCast *) lists; \
14 for (i = 0; i < (GLuint)n; i++, array increment) { \
15 (*callListFunc)(base + (GLuint) value); \
16 } \
17 } \
18 break
19
20#define EXPAND_WITH_DATA(typeEnum, typeCast, increment, value) \
21 case typeEnum: \
22 { \
23 const typeCast *array = (const typeCast *) lists; \
24 for (i = 0; i < (GLuint)n; i++, array increment) {\
25 (*callListFunc)(base + (GLuint) value, i, data); \
26 } \
27 } \
28 break
29
30
31int
32crExpandCallLists(GLsizei n, GLenum type, const GLvoid *lists,
33 GLuint base, void (*callListFunc)(GLuint list))
34{
35 GLuint i;
36
37 switch (type) {
38 EXPAND(GL_BYTE, GLbyte,++,*array);
39 EXPAND(GL_UNSIGNED_BYTE, GLubyte,++,*array);
40 EXPAND(GL_SHORT, GLshort,++,*array);
41 EXPAND(GL_UNSIGNED_SHORT, GLushort,++,*array);
42 EXPAND(GL_INT, GLint,++,*array);
43 EXPAND(GL_UNSIGNED_INT, GLuint,++,*array);
44 EXPAND(GL_FLOAT, GLfloat,++,*array);
45
46 EXPAND(GL_2_BYTES, GLubyte, +=2, 256*array[0] + array[1]);
47 EXPAND(GL_3_BYTES, GLubyte, +=3, 256 * (256 * array[0] + array[1]) + array[2]);
48 EXPAND(GL_4_BYTES, GLubyte, +=4, 256 * (256 * (256 * array[0] + array[1]) + array[2]) + array[3]);
49
50 default:
51 return GL_INVALID_ENUM;
52 }
53
54 return GL_NO_ERROR;
55}
56
57int
58crExpandCallListsWithData(GLsizei n, GLenum type, const GLvoid *lists,
59 GLuint base, void (*callListFunc)(GLuint list, GLuint index, GLvoid *data), GLvoid *data)
60{
61 GLuint i;
62
63 switch (type) {
64 EXPAND_WITH_DATA(GL_BYTE, GLbyte,++,*array);
65 EXPAND_WITH_DATA(GL_UNSIGNED_BYTE, GLubyte,++,*array);
66 EXPAND_WITH_DATA(GL_SHORT, GLshort,++,*array);
67 EXPAND_WITH_DATA(GL_UNSIGNED_SHORT, GLushort,++,*array);
68 EXPAND_WITH_DATA(GL_INT, GLint,++,*array);
69 EXPAND_WITH_DATA(GL_UNSIGNED_INT, GLuint,++,*array);
70 EXPAND_WITH_DATA(GL_FLOAT, GLfloat,++,*array);
71
72 EXPAND_WITH_DATA(GL_2_BYTES, GLubyte, +=2, 256*array[0] + array[1]);
73 EXPAND_WITH_DATA(GL_3_BYTES, GLubyte, +=3, 256 * (256 * array[0] + array[1]) + array[2]);
74 EXPAND_WITH_DATA(GL_4_BYTES, GLubyte, +=4, 256 * (256 * (256 * array[0] + array[1]) + array[2]) + array[3]);
75
76 default:
77 return GL_INVALID_ENUM;
78 }
79
80 return GL_NO_ERROR;
81}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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