]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/hw/vnc/spritest.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / programs / Xserver / hw / vnc / spritest.h
1 /*
2  * spritest.h
3  *
4  * sprite structures - based on misprite
5  */
6
7 /*
8  *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
9  *
10  *  This is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This software is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this software; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
23  *  USA.
24  */
25
26 /*
27
28 Copyright (c) 1989  X Consortium
29
30 Permission is hereby granted, free of charge, to any person obtaining a copy
31 of this software and associated documentation files (the "Software"), to deal
32 in the Software without restriction, including without limitation the rights
33 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34 copies of the Software, and to permit persons to whom the Software is
35 furnished to do so, subject to the following conditions:
36
37 The above copyright notice and this permission notice shall be included in
38 all copies or substantial portions of the Software.
39
40 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
43 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
44 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
47 Except as contained in this notice, the name of the X Consortium shall not be
48 used in advertising or otherwise to promote the sale, use or other dealings
49 in this Software without prior written authorization from the X Consortium.
50 */
51
52 # include   "sprite.h"
53
54 /*
55  * per screen information
56  */
57
58 typedef struct {
59     CloseScreenProcPtr                  CloseScreen;
60     GetImageProcPtr                     GetImage;
61     GetSpansProcPtr                     GetSpans;
62     SourceValidateProcPtr               SourceValidate;
63     CreateGCProcPtr                     CreateGC;
64     InstallColormapProcPtr              InstallColormap;
65     StoreColorsProcPtr                  StoreColors;
66     PaintWindowBackgroundProcPtr        PaintWindowBackground;
67     PaintWindowBorderProcPtr            PaintWindowBorder;
68     CopyWindowProcPtr                   CopyWindow;
69     ClearToBackgroundProcPtr            ClearToBackground;
70     SaveDoomedAreasProcPtr              SaveDoomedAreas;
71     RestoreAreasProcPtr                 RestoreAreas;
72
73     CursorPtr       pCursor;
74     int             x;
75     int             y;
76     BoxRec          saved;
77     WindowPtr       pCacheWin;
78     Bool            isInCacheWin;
79     Bool            checkPixels;
80     xColorItem      colors[2];
81     ColormapPtr     pInstalledMap;
82     ColormapPtr     pColormap;
83     VisualPtr       pVisual;
84     rfbSpriteCursorFuncPtr    funcs;
85 } rfbSpriteScreenRec, *rfbSpriteScreenPtr;
86
87 #define SOURCE_COLOR    0
88 #define MASK_COLOR      1
89
90 typedef struct {
91     GCFuncs             *wrapFuncs;
92     GCOps               *wrapOps;
93 } rfbSpriteGCRec, *rfbSpriteGCPtr;
94
95 /*
96  * Overlap BoxPtr and Box elements
97  */
98 #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \
99         (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \
100          ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2))
101
102 /*
103  * Overlap BoxPtr, origins, and rectangle
104  */
105 #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \
106     BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h))
107
108 /*
109  * Overlap BoxPtr, origins and RectPtr
110  */
111 #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \
112     ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \
113                 (int)((pRect)->width), (int)((pRect)->height))
114 /*
115  * Overlap BoxPtr and horizontal span
116  */
117 #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y))
118
119 #define LINE_SORT(x1,y1,x2,y2) \
120 { int _t; \
121   if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \
122   if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } }
123
124 #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
125     BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))