VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getteximage.c@ 23750

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

crOpenGL: tabs to spaces

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.3 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 "chromium.h"
8#include "cr_error.h"
9#include "cr_mem.h"
10#include "cr_pixeldata.h"
11#include "server_dispatch.h"
12#include "server.h"
13
14void SERVER_DISPATCH_APIENTRY
15crServerDispatchGetTexImage(GLenum target, GLint level, GLenum format,
16 GLenum type, GLvoid * pixels)
17{
18 GLsizei width, height, depth, size;
19 GLvoid *buffer = NULL;
20
21 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
22 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
23 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
24
25 size = crTextureSize(format, type, width, height, depth);
26
27 if (size && (buffer = crAlloc(size))) {
28 /* Note, the other pixel PACK parameters (default values) should
29 * be OK at this point.
30 */
31 cr_server.head_spu->dispatch_table.PixelStorei(GL_PACK_ALIGNMENT, 1);
32 cr_server.head_spu->dispatch_table.GetTexImage(target, level, format, type, buffer);
33 crServerReturnValue( buffer, size );
34 crFree(buffer);
35 }
36 else {
37 /* need to return _something_ to avoid blowing up */
38 GLuint dummy = 0;
39 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
40 }
41}
42
43
44#if CR_ARB_texture_compression
45
46void SERVER_DISPATCH_APIENTRY
47crServerDispatchGetCompressedTexImageARB(GLenum target, GLint level,
48 GLvoid *img)
49{
50 GLint size;
51 GLvoid *buffer=NULL;
52
53 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &size);
54
55 if (size && (buffer = crAlloc(size))) {
56 /* XXX the pixel PACK parameter should be OK at this point */
57 cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level, buffer);
58 crServerReturnValue( buffer, size );
59 crFree(buffer);
60 }
61 else {
62 /* need to return _something_ to avoid blowing up */
63 GLuint dummy = 0;
64 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
65 }
66}
67
68#endif /* CR_ARB_texture_compression */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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