pack_visibleregion.c revision e0e0c19eefceaf5d4ec40f9466b58a771f50e799
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/** @file
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VBox Packing VisibleRegion information
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Copyright (C) 2008 Sun Microsystems, Inc.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * additional information or have any questions.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "packer.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "cr_opcodes.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include "cr_error.h"
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef WINDOWS
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#include <windows.h>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid PACK_APIENTRY crPackWindowVisibleRegion( GLint window, GLint cRects, GLint * pRects )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync GLint i, size, cnt;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef WINDOWS
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RECT *pRECT = (RECT*) pRects;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#else
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync GET_PACKER_CONTEXT(pc);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync unsigned char *data_ptr;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync (void) pc;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync size = 16 + cRects * 4 * sizeof(GLint);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync GET_BUFFERED_POINTER( pc, size );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA( 0, GLint, size );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA( 4, GLenum, CR_WINDOWVISIBLEREGION_EXTEND_OPCODE );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA( 8, GLint, window );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA( 12, GLint, cRects );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync cnt = 16;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i=0; i<cRects; ++i)
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#ifdef WINDOWS
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA(cnt, GLint, (GLint) pRECT[i].left);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA(cnt+4, GLint, (GLint) pRECT[i].top);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA(cnt+8, GLint, (GLint) pRECT[i].right);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_DATA(cnt+12, GLint, (GLint) pRECT[i].bottom);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync cnt += 16;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#else
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync }
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvoid PACK_APIENTRY crPackWindowVisibleRegionSWAP( GLint window, GLint cRects, GLint * pRects )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync{
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crError( "crPackWindowVisibleRegionSWAP unimplemented and shouldn't be called" );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync}