VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_drawpixels.c@ 62863

最後變更 在這個檔案從62863是 27983,由 vboxsync 提交於 15 年 前

crOpenGL: fix 32/64bit bug

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 3.0 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 "unpacker.h"
8#include "cr_error.h"
9
10void 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 GLint noimagedata = READ_DATA( sizeof( int ) + 16, GLint );
17 GLvoid *pixels;
18
19 if (noimagedata)
20 pixels = (void*) (uintptr_t) READ_DATA( sizeof( int ) + 20, GLint);
21 else
22 pixels = DATA_POINTER( sizeof( int ) + 24, GLvoid );
23
24 cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
25 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
26 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
27 cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
28
29 cr_unpackDispatch.DrawPixels( width, height, format, type, pixels );
30
31 INCR_VAR_PTR( );
32}
33
34void crUnpackBitmap( void )
35{
36 GLsizei width = READ_DATA( sizeof( int ) + 0, GLsizei );
37 GLsizei height = READ_DATA( sizeof( int ) + 4, GLsizei );
38 GLfloat xorig = READ_DATA( sizeof( int ) + 8, GLfloat );
39 GLfloat yorig = READ_DATA( sizeof( int ) + 12, GLfloat );
40 GLfloat xmove = READ_DATA( sizeof( int ) + 16, GLfloat );
41 GLfloat ymove = READ_DATA( sizeof( int ) + 20, GLfloat );
42 GLuint noimagedata = READ_DATA( sizeof( int ) + 24, GLuint );
43 GLubyte *bitmap;
44
45 if (noimagedata)
46 bitmap = (void*) (uintptr_t) READ_DATA(sizeof(int) + 28, GLint);
47 else
48 bitmap = DATA_POINTER( sizeof(int) + 32, GLubyte );
49
50 cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
51 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
52 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
53 cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
54
55 cr_unpackDispatch.Bitmap( width, height, xorig, yorig, xmove, ymove, bitmap );
56
57 INCR_VAR_PTR( );
58}
59
60/*
61 * ZPixCR - compressed DrawPixels
62 */
63void crUnpackExtendZPixCR( void )
64{
65 GLsizei width = READ_DATA( 8, GLsizei );
66 GLsizei height = READ_DATA( 12, GLsizei );
67 GLenum format = READ_DATA( 16, GLenum );
68 GLenum type = READ_DATA( 20, GLenum );
69 GLenum ztype = READ_DATA( 24, GLenum );
70 GLint zparm = READ_DATA( 28, GLuint );
71 GLint length = READ_DATA( 32, GLint );
72 GLvoid *pixels = DATA_POINTER( 36, GLvoid );
73
74/*XXX JAG
75 crDebug("UnpackZPixCR: w = %d, h = %d, len = %d",
76 width, height, length);
77*/
78 cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
79 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
80 cr_unpackDispatch.PixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
81 cr_unpackDispatch.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
82
83 cr_unpackDispatch.ZPixCR( width, height, format, type, ztype, zparm, length, pixels );
84
85 /* Don't call INCR_VAR_PTR(); - it's done in crUnpackExtend() */
86}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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