2 * Copyright © 2004 Philip Blundell
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Philip Blundell not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Philip Blundell makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL PHILIP BLUNDELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
24 #include "scrnintstr.h"
25 #include "windowstr.h"
26 #include "dixfontstr.h"
28 #include "regionstr.h"
36 #define WINSTEPX(stride) (stride)
37 #define WINSTART(x,y) (((pScreen->height - 1) - y) + (x * winStride))
42 #define WINSTEPX(stride) (-stride)
44 #define WINSTART(x,y) (((pScreen->width - 1 - x) * winStride) + y)
48 #error This rotation is not supported here
57 FUNC(ScreenPtr pScreen
, shadowBufPtr pBuf
)
59 RegionPtr damage
= shadowDamage(pBuf
);
60 PixmapPtr pShadow
= pBuf
->pPixmap
;
61 int nbox
= RegionNumRects(damage
);
62 BoxPtr pbox
= RegionRects(damage
);
64 Data
*shaBase
, *shaLine
, *sha
;
65 FbStride shaStride
, winStride
;
67 _X_UNUSED
int shaXoff
, shaYoff
;
69 Data
*winBase
, *win
, *winLine
;
72 fbGetDrawable(&pShadow
->drawable
, shaBits
, shaStride
, shaBpp
, shaXoff
,
74 shaBase
= (Data
*) shaBits
;
75 shaStride
= shaStride
* sizeof(FbBits
) / sizeof(Data
);
77 winBase
= (Data
*) (*pBuf
->window
) (pScreen
, 0, 0,
79 &winSize
, pBuf
->closure
);
80 winStride
= (Data
*) (*pBuf
->window
) (pScreen
, 1, 0,
82 &winSize
, pBuf
->closure
) - winBase
;
87 w
= (pbox
->x2
- pbox
->x1
);
88 h
= pbox
->y2
- pbox
->y1
;
90 shaLine
= shaBase
+ (y
* shaStride
) + x
;
92 __builtin_prefetch(shaLine
);
94 winLine
= winBase
+ WINSTART(x
, y
);
100 while (sha
< (shaLine
+ w
- 16)) {
102 __builtin_prefetch(sha
+ shaStride
);
105 win
+= WINSTEPX(winStride
);
107 win
+= WINSTEPX(winStride
);
109 win
+= WINSTEPX(winStride
);
111 win
+= WINSTEPX(winStride
);
114 win
+= WINSTEPX(winStride
);
116 win
+= WINSTEPX(winStride
);
118 win
+= WINSTEPX(winStride
);
120 win
+= WINSTEPX(winStride
);
123 win
+= WINSTEPX(winStride
);
125 win
+= WINSTEPX(winStride
);
127 win
+= WINSTEPX(winStride
);
129 win
+= WINSTEPX(winStride
);
132 win
+= WINSTEPX(winStride
);
134 win
+= WINSTEPX(winStride
);
136 win
+= WINSTEPX(winStride
);
138 win
+= WINSTEPX(winStride
);
141 while (sha
< (shaLine
+ w
)) {
143 win
+= WINSTEPX(winStride
);
147 shaLine
+= shaStride
;
148 winLine
+= WINSTEPY();