VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_readpixels.c@ 18255

Last change on this file since 18255 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.8 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 "cr_spu.h"
8#include "chromium.h"
9#include "cr_error.h"
10#include "cr_mem.h"
11#include "cr_net.h"
12#include "cr_pixeldata.h"
13#include "cr_unpack.h"
14#include "server_dispatch.h"
15#include "server.h"
16
17
18void SERVER_DISPATCH_APIENTRY
19crServerDispatchReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
20 GLenum format, GLenum type, GLvoid *pixels)
21{
22 CRMessageReadPixels *rp;
23 const GLint stride = READ_DATA( 24, GLint );
24 const GLint alignment = READ_DATA( 28, GLint );
25 const GLint skipRows = READ_DATA( 32, GLint );
26 const GLint skipPixels = READ_DATA( 36, GLint );
27 const GLint bytes_per_row = READ_DATA( 40, GLint );
28 const GLint rowLength = READ_DATA( 44, GLint );
29 const int msg_len = sizeof(*rp) + bytes_per_row * height;
30
31 CRASSERT(bytes_per_row > 0);
32
33 rp = (CRMessageReadPixels *) crAlloc( msg_len );
34
35 /* Note: the ReadPixels data gets densely packed into the buffer
36 * (no skip pixels, skip rows, etc. It's up to the receiver (pack spu,
37 * tilesort spu, etc) to apply the real PixelStore packing parameters.
38 */
39 cr_server.head_spu->dispatch_table.ReadPixels( x, y, width, height,
40 format, type, rp + 1);
41
42 rp->header.type = CR_MESSAGE_READ_PIXELS;
43 rp->width = width;
44 rp->height = height;
45 rp->bytes_per_row = bytes_per_row;
46 rp->stride = stride;
47 rp->format = format;
48 rp->type = type;
49 rp->alignment = alignment;
50 rp->skipRows = skipRows;
51 rp->skipPixels = skipPixels;
52 rp->rowLength = rowLength;
53
54 /* <pixels> points to the 8-byte network pointer */
55 crMemcpy( &rp->pixels, pixels, sizeof(rp->pixels) );
56
57 crNetSend( cr_server.curClient->conn, NULL, rp, msg_len );
58 crFree( rp );
59}
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