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