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
,
61 FUNC (ScreenPtr pScreen
,
64 RegionPtr damage
= shadowDamage(pBuf
);
65 PixmapPtr pShadow
= pBuf
->pPixmap
;
66 int nbox
= REGION_NUM_RECTS (damage
);
67 BoxPtr pbox
= REGION_RECTS (damage
);
69 Data
*shaBase
, *shaLine
, *sha
;
70 FbStride shaStride
, winStride
;
72 int shaXoff
, shaYoff
; /* XXX assumed to be zero */
74 Data
*winBase
, *win
, *winLine
;
77 fbGetDrawable (&pShadow
->drawable
, shaBits
, shaStride
, shaBpp
, shaXoff
, shaYoff
);
78 shaBase
= (Data
*) shaBits
;
79 shaStride
= shaStride
* sizeof (FbBits
) / sizeof (Data
);
81 winBase
= (Data
*) (*pBuf
->window
) (pScreen
, 0, 0,
83 &winSize
, pBuf
->closure
);
84 winStride
= (Data
*) (*pBuf
->window
) (pScreen
, 1, 0,
86 &winSize
, pBuf
->closure
) - winBase
;
92 w
= (pbox
->x2
- pbox
->x1
);
93 h
= pbox
->y2
- pbox
->y1
;
95 shaLine
= shaBase
+ (y
* shaStride
) + x
;
97 __builtin_prefetch (shaLine
);
99 winLine
= winBase
+ WINSTART(x
, y
);
106 while (sha
< (shaLine
+ w
- 16))
109 __builtin_prefetch (sha
+ shaStride
);
112 win
+= WINSTEPX(winStride
);
114 win
+= WINSTEPX(winStride
);
116 win
+= WINSTEPX(winStride
);
118 win
+= WINSTEPX(winStride
);
121 win
+= WINSTEPX(winStride
);
123 win
+= WINSTEPX(winStride
);
125 win
+= WINSTEPX(winStride
);
127 win
+= WINSTEPX(winStride
);
130 win
+= WINSTEPX(winStride
);
132 win
+= WINSTEPX(winStride
);
134 win
+= WINSTEPX(winStride
);
136 win
+= WINSTEPX(winStride
);
139 win
+= WINSTEPX(winStride
);
141 win
+= WINSTEPX(winStride
);
143 win
+= WINSTEPX(winStride
);
145 win
+= WINSTEPX(winStride
);
148 while (sha
< (shaLine
+ w
))
151 win
+= WINSTEPX(winStride
);
155 shaLine
+= shaStride
;
156 winLine
+= WINSTEPY();