3 * Copyright © 2000 Keith Packard
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
31 #include "scrnintstr.h"
32 #include "windowstr.h"
33 #include <X11/fonts/font.h>
34 #include "dixfontstr.h"
35 #include <X11/fonts/fontstruct.h>
37 #include "regionstr.h"
53 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
54 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
55 * m1 D x x x x x x x C x x x x x x x B x x x x x x x A x x x x x x x sha[0] << (7-(p))
56 * m2 x x x x H x x x x x x x G x x x x x x x F x x x x x x x E x x x sha[1] << (3-(p))
57 * m3 D C B A m1 & 0x80808080
58 * m4 H G F E m2 & 0x08080808
59 * m5 D H C G B F A E m3 | m4
60 * m6 D H C G B F m5 >> 9
61 * m7 D H C D G H B C F G A B E F m5 | m6
62 * m8 D H C D G H m7 >> 18
63 * m9 D H C D G H B C D F G H A B C D E F G H m7 | m8
67 #define PL_UNIT (1 << PL_SHIFT)
68 #define PL_MASK (PL_UNIT - 1)
71 #define GetBits(p,o,d) { \
72 CARD32 m1,m2,m3,m4,m5,m6,m7,m8; \
73 m1 = sha[o] << (7 - (p)); \
74 m2 = sha[(o)+1] << (3 - (p)); \
75 m3 = m1 & 0x80808080; \
76 m4 = m2 & 0x08080808; \
84 #define GetBits(p,o,d) { \
86 m5 = ((sha[o] << (7 - (p))) & 0x80808080) | ((sha[(o)+1] << (3 - (p))) & 0x08080808); \
87 m7 = m5 | (m5 >> 9); \
88 d = m7 | (m7 >> 18); \
93 shadowUpdatePlanar4x8(ScreenPtr pScreen
, shadowBufPtr pBuf
)
95 RegionPtr damage
= shadowDamage(pBuf
);
96 PixmapPtr pShadow
= pBuf
->pPixmap
;
97 int nbox
= RegionNumRects(damage
);
98 BoxPtr pbox
= RegionRects(damage
);
99 CARD32
*shaBase
, *shaLine
, *sha
;
100 CARD8 s1
, s2
, s3
, s4
;
102 int scrBase
, scrLine
, scr
;
104 _X_UNUSED
int shaXoff
, shaYoff
;
105 int x
, y
, w
, h
, width
;
107 CARD32
*winBase
= NULL
, *win
;
111 fbGetStipDrawable(&pShadow
->drawable
, shaBase
, shaStride
, shaBpp
, shaXoff
,
114 x
= pbox
->x1
* shaBpp
;
116 w
= (pbox
->x2
- pbox
->x1
) * shaBpp
;
117 h
= pbox
->y2
- pbox
->y1
;
119 w
= (w
+ (x
& PL_MASK
) + PL_MASK
) >> PL_SHIFT
;
122 scrLine
= (x
>> PL_SHIFT
);
123 shaLine
= shaBase
+ y
* shaStride
+ (x
>> FB_SHIFT
);
126 for (plane
= 0; plane
< 4; plane
++) {
133 /* how much remains in this window */
134 i
= scrBase
+ winSize
- scr
;
135 if (i
<= 0 || scr
< scrBase
) {
136 winBase
= (CARD32
*) (*pBuf
->window
) (pScreen
,
149 win
= winBase
+ (scr
- scrBase
);
156 GetBits(plane
, 0, s1
);
157 GetBits(plane
, 2, s2
);
158 GetBits(plane
, 4, s3
);
159 GetBits(plane
, 6, s4
);
160 *win
++ = s1
| (s2
<< 8) | (s3
<< 16) | (s4
<< 24);
165 shaLine
+= shaStride
;