VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.0.1/shrotpack.h@ 69348

Last change on this file since 69348 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 6.2 KB
Line 
1/*
2 * $XFree86: xc/programs/Xserver/miext/shadow/shrotpack.h,v 1.3 2001/05/29 04:54:13 keithp Exp $
3 *
4 * Copyright © 2000 Keith Packard
5 *
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
15 *
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
23 */
24
25/*
26 * Thanks to Daniel Chemko <[email protected]> for making the 90 and 180
27 * orientations work.
28 */
29
30#ifdef HAVE_DIX_CONFIG_H
31#include <dix-config.h>
32#endif
33
34#include <X11/X.h>
35#include "scrnintstr.h"
36#include "windowstr.h"
37#include <X11/fonts/font.h>
38#include "dixfontstr.h"
39#include <X11/fonts/fontstruct.h>
40#include "mi.h"
41#include "regionstr.h"
42#include "globals.h"
43#include "gcstruct.h"
44#include "shadow.h"
45#include "fb.h"
46
47#define DANDEBUG 0
48
49#if ROTATE == 270
50
51#define SCRLEFT(x,y,w,h) (pScreen->height - ((y) + (h)))
52#define SCRY(x,y,w,h) (x)
53#define SCRWIDTH(x,y,w,h) (h)
54#define FIRSTSHA(x,y,w,h) (((y) + (h) - 1) * shaStride + (x))
55#define STEPDOWN(x,y,w,h) ((w)--)
56#define NEXTY(x,y,w,h) ((x)++)
57#define SHASTEPX(stride) -(stride)
58#define SHASTEPY(stride) (1)
59
60#elif ROTATE == 90
61
62#define SCRLEFT(x,y,w,h) (y)
63#define SCRY(x,y,w,h) (pScreen->width - ((x) + (w)) - 1)
64#define SCRWIDTH(x,y,w,h) (h)
65#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x + w - 1))
66#define STEPDOWN(x,y,w,h) ((w)--)
67#define NEXTY(x,y,w,h) ((void)(x))
68#define SHASTEPX(stride) (stride)
69#define SHASTEPY(stride) (-1)
70
71#elif ROTATE == 180
72
73#define SCRLEFT(x,y,w,h) (pScreen->width - ((x) + (w)))
74#define SCRY(x,y,w,h) (pScreen->height - ((y) + (h)) - 1)
75#define SCRWIDTH(x,y,w,h) (w)
76#define FIRSTSHA(x,y,w,h) ((y + h - 1) * shaStride + (x + w - 1))
77#define STEPDOWN(x,y,w,h) ((h)--)
78#define NEXTY(x,y,w,h) ((void)(y))
79#define SHASTEPX(stride) (-1)
80#define SHASTEPY(stride) -(stride)
81
82#else
83
84#define SCRLEFT(x,y,w,h) (x)
85#define SCRY(x,y,w,h) (y)
86#define SCRWIDTH(x,y,w,h) (w)
87#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x))
88#define STEPDOWN(x,y,w,h) ((h)--)
89#define NEXTY(x,y,w,h) ((y)++)
90#define SHASTEPX(stride) (1)
91#define SHASTEPY(stride) (stride)
92
93#endif
94
95void
96FUNC (ScreenPtr pScreen,
97 shadowBufPtr pBuf)
98{
99 RegionPtr damage = &pBuf->damage;
100 PixmapPtr pShadow = pBuf->pPixmap;
101 int nbox = REGION_NUM_RECTS (damage);
102 BoxPtr pbox = REGION_RECTS (damage);
103 FbBits *shaBits;
104 Data *shaBase, *shaLine, *sha;
105 FbStride shaStride;
106 int scrBase, scrLine, scr;
107 int shaBpp;
108 int shaXoff, shaYoff; /* XXX assumed to be zero */
109 int x, y, w, h, width;
110 int i;
111 Data *winBase = NULL, *win;
112 CARD32 winSize;
113
114 fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
115 shaBase = (Data *) shaBits;
116 shaStride = shaStride * sizeof (FbBits) / sizeof (Data);
117#if (DANDEBUG > 1)
118 ErrorF ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n", pShadow, pScreen, damage, shaStride, shaBase, shaBpp);
119#endif
120 while (nbox--)
121 {
122 x = pbox->x1;
123 y = pbox->y1;
124 w = (pbox->x2 - pbox->x1);
125 h = pbox->y2 - pbox->y1;
126
127#if (DANDEBUG > 2)
128 ErrorF (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n", x, y, w, h);
129#endif
130 scrLine = SCRLEFT(x,y,w,h);
131 shaLine = shaBase + FIRSTSHA(x,y,w,h);
132
133 while (STEPDOWN(x,y,w,h))
134 {
135 winSize = 0;
136 scrBase = 0;
137 width = SCRWIDTH(x,y,w,h);
138 scr = scrLine;
139 sha = shaLine;
140#if (DANDEBUG > 3)
141 ErrorF (" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n", width, scr, sha);
142#endif
143 while (width)
144 {
145 /* how much remains in this window */
146 i = scrBase + winSize - scr;
147 if (i <= 0 || scr < scrBase)
148 {
149 winBase = (Data *) (*pBuf->window) (pScreen,
150 SCRY(x,y,w,h),
151 scr * sizeof (Data),
152 SHADOW_WINDOW_WRITE,
153 &winSize,
154 pBuf->closure);
155 if(!winBase)
156 return;
157 scrBase = scr;
158 winSize /= sizeof (Data);
159 i = winSize;
160#if(DANDEBUG > 4)
161 ErrorF (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n", winBase, scrBase, winSize, SHASTEPX(shaStride), SHASTEPY(shaStride), w, h);
162#endif
163 }
164 win = winBase + (scr - scrBase);
165 if (i > width)
166 i = width;
167 width -= i;
168 scr += i;
169#if(DANDEBUG > 5)
170 ErrorF (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n", win, sha);
171#endif
172 while (i--)
173 {
174#if(DANDEBUG > 6)
175 ErrorF (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n", win, sha, i);
176#endif
177 *win++ = *sha;
178 sha += SHASTEPX(shaStride);
179 } /* i */
180 } /* width */
181 shaLine += SHASTEPY(shaStride);
182 NEXTY(x,y,w,h);
183 } /* STEPDOWN */
184 pbox++;
185 } /* nbox */
186}
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