~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/dmx/glxProxy/renderpixswap.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
 
2
/*
 
3
** License Applicability. Except to the extent portions of this file are
 
4
** made subject to an alternative license as permitted in the SGI Free
 
5
** Software License B, Version 1.1 (the "License"), the contents of this
 
6
** file are subject only to the provisions of the License. You may not use
 
7
** this file except in compliance with the License. You may obtain a copy
 
8
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
 
9
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
 
10
** 
 
11
** http://oss.sgi.com/projects/FreeB
 
12
** 
 
13
** Note that, as provided in the License, the Software is distributed on an
 
14
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
 
15
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
 
16
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
 
17
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
 
18
** 
 
19
** Original Code. The Original Code is: OpenGL Sample Implementation,
 
20
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
 
21
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
 
22
** Copyright in any portions created by third parties is as indicated
 
23
** elsewhere herein. All Rights Reserved.
 
24
** 
 
25
** Additional Notice Provisions: The application programming interfaces
 
26
** established by SGI in conjunction with the Original Code are The
 
27
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
 
28
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
 
29
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
 
30
** Window System(R) (Version 1.3), released October 19, 1998. This software
 
31
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
 
32
** published by SGI, but has not been independently verified as being
 
33
** compliant with the OpenGL(R) version 1.2.1 Specification.
 
34
**
 
35
*/
 
36
 
 
37
#define NEED_REPLIES
 
38
#include "glxserver.h"
 
39
#include "unpack.h"
 
40
#include "g_disptab.h"
 
41
 
 
42
void __glXDispSwap_PolygonStipple(GLbyte *pc)
 
43
{
 
44
    __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
 
45
    __GLX_DECLARE_SWAP_VARIABLES;
 
46
 
 
47
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
48
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
49
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
50
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
51
 
 
52
    hdr->swapBytes = !hdr->swapBytes;
 
53
}
 
54
 
 
55
void __glXDispSwap_Bitmap(GLbyte *pc)
 
56
{
 
57
    __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
 
58
    __GLX_DECLARE_SWAP_VARIABLES;
 
59
 
 
60
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
61
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
62
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
63
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
64
 
 
65
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
66
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
67
    __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
 
68
    __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
 
69
    __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
 
70
    __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
 
71
 
 
72
    hdr->swapBytes = !hdr->swapBytes;
 
73
 
 
74
}
 
75
 
 
76
void __glXDispSwap_TexImage1D(GLbyte *pc)
 
77
{
 
78
    __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
 
79
    __GLX_DECLARE_SWAP_VARIABLES;
 
80
 
 
81
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
82
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
83
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
84
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
85
 
 
86
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
87
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
88
    __GLX_SWAP_INT((GLbyte *)&hdr->components);
 
89
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
90
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
91
    __GLX_SWAP_INT((GLbyte *)&hdr->border);
 
92
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
93
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
94
 
 
95
    /*
 
96
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
97
    ** the pixel data.
 
98
    */
 
99
    hdr->swapBytes = !hdr->swapBytes;
 
100
}
 
101
 
 
102
void __glXDispSwap_TexImage2D(GLbyte *pc)
 
103
{
 
104
    __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
 
105
    __GLX_DECLARE_SWAP_VARIABLES;
 
106
 
 
107
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
108
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
109
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
110
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
111
 
 
112
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
113
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
114
    __GLX_SWAP_INT((GLbyte *)&hdr->components);
 
115
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
116
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
117
    __GLX_SWAP_INT((GLbyte *)&hdr->border);
 
118
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
119
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
120
 
 
121
    /*
 
122
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
123
    ** the pixel data.
 
124
    */
 
125
    hdr->swapBytes = !hdr->swapBytes;
 
126
}
 
127
 
 
128
void __glXDispSwap_TexImage3D(GLbyte *pc)
 
129
{
 
130
    __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
 
131
    __GLX_DECLARE_SWAP_VARIABLES;
 
132
 
 
133
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
134
    __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
 
135
    __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
 
136
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
137
    __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
 
138
    __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
 
139
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
140
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
141
 
 
142
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
143
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
144
    __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
 
145
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
146
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
147
    __GLX_SWAP_INT((GLbyte *)&hdr->depth);
 
148
    __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
 
149
    __GLX_SWAP_INT((GLbyte *)&hdr->border);
 
150
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
151
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
152
 
 
153
    /*
 
154
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
155
    ** the pixel data.
 
156
    */
 
157
    hdr->swapBytes = !hdr->swapBytes;
 
158
}
 
159
 
 
160
void __glXDispSwap_DrawPixels(GLbyte *pc)
 
161
{
 
162
    __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
 
163
    __GLX_DECLARE_SWAP_VARIABLES;
 
164
 
 
165
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
166
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
167
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
168
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
169
 
 
170
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
171
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
172
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
173
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
174
 
 
175
    /*
 
176
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
177
    ** the pixel data.
 
178
    */
 
179
    hdr->swapBytes = !hdr->swapBytes;
 
180
}
 
181
 
 
182
void __glXDispSwap_TexSubImage1D(GLbyte *pc)
 
183
{
 
184
    __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
 
185
    __GLX_DECLARE_SWAP_VARIABLES;
 
186
 
 
187
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
188
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
189
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
190
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
191
 
 
192
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
193
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
194
    __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
 
195
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
196
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
197
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
198
 
 
199
    /*
 
200
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
201
    ** the pixel data.
 
202
    */
 
203
    hdr->swapBytes = !hdr->swapBytes;
 
204
}
 
205
 
 
206
void __glXDispSwap_TexSubImage2D(GLbyte *pc)
 
207
{
 
208
    __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
 
209
    __GLX_DECLARE_SWAP_VARIABLES;
 
210
 
 
211
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
212
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
213
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
214
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
215
 
 
216
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
217
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
218
    __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
 
219
    __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
 
220
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
221
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
222
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
223
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
224
 
 
225
    /*
 
226
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
227
    ** the pixel data.
 
228
    */
 
229
    hdr->swapBytes = !hdr->swapBytes;
 
230
}
 
231
 
 
232
void __glXDispSwap_TexSubImage3D(GLbyte *pc)
 
233
{
 
234
    __GLXdispatchTexSubImage3DHeader *hdr =
 
235
                                (__GLXdispatchTexSubImage3DHeader *) pc;
 
236
 
 
237
    __GLX_DECLARE_SWAP_VARIABLES;
 
238
 
 
239
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
240
    __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
 
241
    __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
 
242
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
243
    __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
 
244
    __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
 
245
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
246
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
247
 
 
248
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
249
    __GLX_SWAP_INT((GLbyte *)&hdr->level);
 
250
    __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
 
251
    __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
 
252
    __GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
 
253
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
254
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
255
    __GLX_SWAP_INT((GLbyte *)&hdr->depth);
 
256
    __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
 
257
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
258
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
259
 
 
260
    /*
 
261
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
262
    ** the pixel data.
 
263
    */
 
264
    hdr->swapBytes = !hdr->swapBytes;
 
265
}
 
266
 
 
267
void __glXDispSwap_ColorTable(GLbyte *pc)
 
268
{
 
269
    __GLXdispatchColorTableHeader *hdr =
 
270
                                (__GLXdispatchColorTableHeader *) pc;
 
271
    __GLX_DECLARE_SWAP_VARIABLES;
 
272
 
 
273
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
274
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
275
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
276
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
277
 
 
278
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
279
    __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
 
280
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
281
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
282
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
283
 
 
284
    /*
 
285
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
286
    ** the pixel data.
 
287
    */
 
288
    hdr->swapBytes = !hdr->swapBytes;
 
289
}
 
290
 
 
291
void __glXDispSwap_ColorSubTable(GLbyte *pc)
 
292
{
 
293
    __GLXdispatchColorSubTableHeader *hdr =
 
294
                                (__GLXdispatchColorSubTableHeader *) pc;
 
295
    __GLX_DECLARE_SWAP_VARIABLES;
 
296
 
 
297
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
298
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
299
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
300
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
301
 
 
302
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
303
    __GLX_SWAP_INT((GLbyte *)&hdr->start);
 
304
    __GLX_SWAP_INT((GLbyte *)&hdr->count);
 
305
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
306
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
307
 
 
308
    /*
 
309
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
310
    ** the pixel data.
 
311
    */
 
312
    hdr->swapBytes = !hdr->swapBytes;
 
313
}
 
314
 
 
315
void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
 
316
{
 
317
    __GLXdispatchConvolutionFilterHeader *hdr =
 
318
                                (__GLXdispatchConvolutionFilterHeader *) pc;
 
319
    __GLX_DECLARE_SWAP_VARIABLES;
 
320
 
 
321
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
322
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
323
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
324
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
325
 
 
326
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
327
    __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
 
328
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
329
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
330
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
331
 
 
332
    /*
 
333
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
334
    ** the pixel data.
 
335
    */
 
336
    hdr->swapBytes = !hdr->swapBytes;
 
337
}
 
338
 
 
339
void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
 
340
{
 
341
    __GLXdispatchConvolutionFilterHeader *hdr =
 
342
                                (__GLXdispatchConvolutionFilterHeader *) pc;
 
343
    __GLX_DECLARE_SWAP_VARIABLES;
 
344
 
 
345
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
346
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
347
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
348
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
349
 
 
350
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
351
    __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
 
352
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
353
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
354
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
355
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
356
 
 
357
    /*
 
358
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
359
    ** the pixel data.
 
360
    */
 
361
    hdr->swapBytes = !hdr->swapBytes;
 
362
}
 
363
 
 
364
void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
 
365
{
 
366
    __GLXdispatchConvolutionFilterHeader *hdr =
 
367
                                (__GLXdispatchConvolutionFilterHeader *) pc;
 
368
    GLint hdrlen, image1len;
 
369
    __GLX_DECLARE_SWAP_VARIABLES;
 
370
 
 
371
    hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
 
372
 
 
373
    __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
 
374
    __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
 
375
    __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
 
376
    __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
 
377
 
 
378
    __GLX_SWAP_INT((GLbyte *)&hdr->target);
 
379
    __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
 
380
    __GLX_SWAP_INT((GLbyte *)&hdr->width);
 
381
    __GLX_SWAP_INT((GLbyte *)&hdr->height);
 
382
    __GLX_SWAP_INT((GLbyte *)&hdr->format);
 
383
    __GLX_SWAP_INT((GLbyte *)&hdr->type);
 
384
 
 
385
    /*
 
386
    ** Just invert swapBytes flag; the GL will figure out if it needs to swap
 
387
    ** the pixel data.
 
388
    */
 
389
    hdr->swapBytes = !hdr->swapBytes;
 
390
}