b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * mispritest.h
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * mi sprite structures
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $Xorg: mispritest.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncCopyright 1989, 1998 The Open Group
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncthe above copyright notice appear in all copies and that both that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccopyright notice and this permission notice appear in supporting
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncdocumentation.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncThe above copyright notice and this permission notice shall be included in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncall copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncin this Software without prior written authorization from The Open Group.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync*/
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.4 2001/01/17 22:37:07 dawes Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef HAVE_DIX_CONFIG_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <dix-config.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef _MISPRITEST_H_
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define _MISPRITEST_H_
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# include "misprite.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef RENDER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# include "picturestr.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# include "damage.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * per screen information
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* screen procedures */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CloseScreenProcPtr CloseScreen;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GetImageProcPtr GetImage;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GetSpansProcPtr GetSpans;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SourceValidateProcPtr SourceValidate;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* window procedures */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CopyWindowProcPtr CopyWindow;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* backing store procedures */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SaveDoomedAreasProcPtr SaveDoomedAreas;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* colormap procedures */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync InstallColormapProcPtr InstallColormap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync StoreColorsProcPtr StoreColors;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* os layer procedures */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ScreenBlockHandlerProcPtr BlockHandler;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CursorPtr pCursor;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int x; /* cursor hotspot */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int y;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BoxRec saved; /* saved area from the screen */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool isUp; /* cursor in frame buffer */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool shouldBeUp; /* cursor should be displayed */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync WindowPtr pCacheWin; /* window the cursor last seen in */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool isInCacheWin;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool checkPixels; /* check colormap collision */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xColorItem colors[2];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ColormapPtr pInstalledMap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ColormapPtr pColormap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync VisualPtr pVisual;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync miSpriteCursorFuncPtr funcs;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DamagePtr pDamage; /* damage tracking structure */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} miSpriteScreenRec, *miSpriteScreenPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define SOURCE_COLOR 0
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MASK_COLOR 1
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define miSpriteIsUpTRUE(pScreen, pScreenPriv) if (!pScreenPriv->isUp) { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pScreenPriv->isUp = TRUE; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DamageRegister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync}
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define miSpriteIsUpFALSE(pScreen, pScreenPriv) if (pScreenPriv->isUp) { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DamageUnregister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync pScreenPriv->isUp = FALSE; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync}
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Overlap BoxPtr and Box elements
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Overlap BoxPtr, origins, and rectangle
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Overlap BoxPtr, origins and RectPtr
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (int)((pRect)->width), (int)((pRect)->height))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Overlap BoxPtr and horizontal span
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define LINE_SORT(x1,y1,x2,y2) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync{ int _t; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } }
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* _MISPRITEST_H_ */