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 "unpacker.h"
|
---|
8 | #include "cr_error.h"
|
---|
9 |
|
---|
10 | void crUnpackDrawPixels( void )
|
---|
11 | {
|
---|
12 | GLsizei width = READ_DATA( sizeof( int ) + 0, GLsizei );
|
---|
13 | GLsizei height = READ_DATA( sizeof( int ) + 4, GLsizei );
|
---|
14 | GLenum format = READ_DATA( sizeof( int ) + 8, GLenum );
|
---|
15 | GLenum type = READ_DATA( sizeof( int ) + 12, GLenum );
|
---|
16 | GLvoid *pixels = DATA_POINTER( sizeof( int ) + 16, GLvoid );
|
---|
17 |
|
---|
18 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
|
---|
19 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
|
---|
20 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
|
---|
21 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
|
---|
22 |
|
---|
23 | cr_unpackDispatch.DrawPixels( width, height, format, type, pixels );
|
---|
24 |
|
---|
25 | INCR_VAR_PTR( );
|
---|
26 | }
|
---|
27 |
|
---|
28 | void crUnpackBitmap( void )
|
---|
29 | {
|
---|
30 | GLsizei width = READ_DATA( sizeof( int ) + 0, GLsizei );
|
---|
31 | GLsizei height = READ_DATA( sizeof( int ) + 4, GLsizei );
|
---|
32 | GLfloat xorig = READ_DATA( sizeof( int ) + 8, GLfloat );
|
---|
33 | GLfloat yorig = READ_DATA( sizeof( int ) + 12, GLfloat );
|
---|
34 | GLfloat xmove = READ_DATA( sizeof( int ) + 16, GLfloat );
|
---|
35 | GLfloat ymove = READ_DATA( sizeof( int ) + 20, GLfloat );
|
---|
36 | GLuint is_null = READ_DATA( sizeof( int ) + 24, GLuint );
|
---|
37 | GLubyte *bitmap = NULL;
|
---|
38 |
|
---|
39 | if ( !is_null )
|
---|
40 | {
|
---|
41 | bitmap = DATA_POINTER( sizeof(int) + 28, GLubyte );
|
---|
42 | }
|
---|
43 |
|
---|
44 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
|
---|
45 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
|
---|
46 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
|
---|
47 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
|
---|
48 |
|
---|
49 | cr_unpackDispatch.Bitmap( width, height, xorig, yorig, xmove, ymove, bitmap );
|
---|
50 |
|
---|
51 | INCR_VAR_PTR( );
|
---|
52 | }
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * ZPixCR - compressed DrawPixels
|
---|
56 | */
|
---|
57 | void crUnpackExtendZPixCR( void )
|
---|
58 | {
|
---|
59 | GLsizei width = READ_DATA( 8, GLsizei );
|
---|
60 | GLsizei height = READ_DATA( 12, GLsizei );
|
---|
61 | GLenum format = READ_DATA( 16, GLenum );
|
---|
62 | GLenum type = READ_DATA( 20, GLenum );
|
---|
63 | GLenum ztype = READ_DATA( 24, GLenum );
|
---|
64 | GLint zparm = READ_DATA( 28, GLuint );
|
---|
65 | GLint length = READ_DATA( 32, GLint );
|
---|
66 | GLvoid *pixels = DATA_POINTER( 36, GLvoid );
|
---|
67 |
|
---|
68 | /*XXX JAG
|
---|
69 | crDebug("UnpackZPixCR: w = %d, h = %d, len = %d",
|
---|
70 | width, height, length);
|
---|
71 | */
|
---|
72 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
|
---|
73 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
|
---|
74 | cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
|
---|
75 | cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
|
---|
76 |
|
---|
77 | cr_unpackDispatch.ZPixCR( width, height, format, type, ztype, zparm, length, pixels );
|
---|
78 |
|
---|
79 | /* Don't call INCR_VAR_PTR(); - it's done in crUnpackExtend() */
|
---|
80 | }
|
---|