VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c@ 21216

Last change on this file since 21216 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.2 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#include "cr_opcodes.h"
9#include "cr_mem.h"
10
11void PACK_APIENTRY crPackBoundsInfoCR( const CRrecti *bounds, const GLbyte *payload, GLint len, GLint num_opcodes )
12{
13 GET_PACKER_CONTEXT(pc);
14 /* Don't get the buffered_ptr here because we've already
15 * verified that there's enough space for everything. */
16
17 unsigned char *data_ptr = pc->buffer.data_current;
18 int len_aligned = ( len + 0x3 ) & ~0x3;
19 int total_len = 24 + len_aligned;
20
21 WRITE_DATA( 0, int, total_len );
22 WRITE_DATA( 4, int, bounds->x1 );
23 WRITE_DATA( 8, int, bounds->y1 );
24 WRITE_DATA( 12, int, bounds->x2 );
25 WRITE_DATA( 16, int, bounds->y2 );
26 WRITE_DATA( 20, int, num_opcodes );
27
28 /* skip the BOUNDSINFO */
29 data_ptr += 24;
30
31 /* put in padding opcodes (deliberately bogus) */
32 switch ( len_aligned - len )
33 {
34 case 3: *data_ptr++ = 0xff; /* FALLTHROUGH */
35 case 2: *data_ptr++ = 0xff; /* FALLTHROUGH */
36 case 1: *data_ptr++ = 0xff; /* FALLTHROUGH */
37 default: break;
38 }
39
40 crMemcpy( data_ptr, payload, len );
41
42 WRITE_OPCODE( pc, CR_BOUNDSINFOCR_OPCODE );
43 pc->buffer.data_current += 24 + len_aligned;
44}
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