1 | /*
|
---|
2 | * mispritest.h
|
---|
3 | *
|
---|
4 | * mi sprite structures
|
---|
5 | */
|
---|
6 |
|
---|
7 |
|
---|
8 | /*
|
---|
9 |
|
---|
10 | Copyright 1989, 1998 The Open Group
|
---|
11 |
|
---|
12 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
13 | documentation for any purpose is hereby granted without fee, provided that
|
---|
14 | the above copyright notice appear in all copies and that both that
|
---|
15 | copyright notice and this permission notice appear in supporting
|
---|
16 | documentation.
|
---|
17 |
|
---|
18 | The above copyright notice and this permission notice shall be included in
|
---|
19 | all copies or substantial portions of the Software.
|
---|
20 |
|
---|
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
24 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
25 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
26 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
27 |
|
---|
28 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
29 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
30 | in this Software without prior written authorization from The Open Group.
|
---|
31 | */
|
---|
32 |
|
---|
33 | #ifdef HAVE_DIX_CONFIG_H
|
---|
34 | #include <dix-config.h>
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #ifndef _MISPRITEST_H_
|
---|
38 | #define _MISPRITEST_H_
|
---|
39 |
|
---|
40 | # include "misprite.h"
|
---|
41 | #ifdef RENDER
|
---|
42 | # include "picturestr.h"
|
---|
43 | #endif
|
---|
44 | # include "damage.h"
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * per screen information
|
---|
48 | */
|
---|
49 |
|
---|
50 | typedef struct {
|
---|
51 | /* screen procedures */
|
---|
52 | CloseScreenProcPtr CloseScreen;
|
---|
53 | GetImageProcPtr GetImage;
|
---|
54 | GetSpansProcPtr GetSpans;
|
---|
55 | SourceValidateProcPtr SourceValidate;
|
---|
56 |
|
---|
57 | /* window procedures */
|
---|
58 | CopyWindowProcPtr CopyWindow;
|
---|
59 |
|
---|
60 | /* backing store procedures */
|
---|
61 | SaveDoomedAreasProcPtr SaveDoomedAreas;
|
---|
62 |
|
---|
63 | /* colormap procedures */
|
---|
64 | InstallColormapProcPtr InstallColormap;
|
---|
65 | StoreColorsProcPtr StoreColors;
|
---|
66 |
|
---|
67 | /* os layer procedures */
|
---|
68 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
69 |
|
---|
70 | CursorPtr pCursor;
|
---|
71 | int x; /* cursor hotspot */
|
---|
72 | int y;
|
---|
73 | BoxRec saved; /* saved area from the screen */
|
---|
74 | Bool isUp; /* cursor in frame buffer */
|
---|
75 | Bool shouldBeUp; /* cursor should be displayed */
|
---|
76 | WindowPtr pCacheWin; /* window the cursor last seen in */
|
---|
77 | Bool isInCacheWin;
|
---|
78 | Bool checkPixels; /* check colormap collision */
|
---|
79 | xColorItem colors[2];
|
---|
80 | ColormapPtr pInstalledMap;
|
---|
81 | ColormapPtr pColormap;
|
---|
82 | VisualPtr pVisual;
|
---|
83 | miSpriteCursorFuncPtr funcs;
|
---|
84 | DamagePtr pDamage; /* damage tracking structure */
|
---|
85 | } miSpriteScreenRec, *miSpriteScreenPtr;
|
---|
86 |
|
---|
87 | #define SOURCE_COLOR 0
|
---|
88 | #define MASK_COLOR 1
|
---|
89 |
|
---|
90 | #define miSpriteIsUpTRUE(pScreen, pScreenPriv) if (!pScreenPriv->isUp) { \
|
---|
91 | pScreenPriv->isUp = TRUE; \
|
---|
92 | DamageRegister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
|
---|
93 | }
|
---|
94 |
|
---|
95 | #define miSpriteIsUpFALSE(pScreen, pScreenPriv) if (pScreenPriv->isUp) { \
|
---|
96 | DamageUnregister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
|
---|
97 | pScreenPriv->isUp = FALSE; \
|
---|
98 | }
|
---|
99 |
|
---|
100 | /*
|
---|
101 | * Overlap BoxPtr and Box elements
|
---|
102 | */
|
---|
103 | #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \
|
---|
104 | (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \
|
---|
105 | ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2))
|
---|
106 |
|
---|
107 | /*
|
---|
108 | * Overlap BoxPtr, origins, and rectangle
|
---|
109 | */
|
---|
110 | #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \
|
---|
111 | BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h))
|
---|
112 |
|
---|
113 | /*
|
---|
114 | * Overlap BoxPtr, origins and RectPtr
|
---|
115 | */
|
---|
116 | #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \
|
---|
117 | ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \
|
---|
118 | (int)((pRect)->width), (int)((pRect)->height))
|
---|
119 | /*
|
---|
120 | * Overlap BoxPtr and horizontal span
|
---|
121 | */
|
---|
122 | #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y))
|
---|
123 |
|
---|
124 | #define LINE_SORT(x1,y1,x2,y2) \
|
---|
125 | { int _t; \
|
---|
126 | if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \
|
---|
127 | if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } }
|
---|
128 |
|
---|
129 | #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
|
---|
130 | BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))
|
---|
131 |
|
---|
132 | #endif /* _MISPRITEST_H_ */
|
---|