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"
44 * 32 4-bit pixels per write
48 #define PL_UNIT (1 << PL_SHIFT)
49 #define PL_MASK (PL_UNIT - 1)
57 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
58 * 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
59 * m . . . H . . . G . . . F . . . E . . . D . . . C . . . B . . . A
60 * m1 G . . . F . . . E . . . D . . . C . . . B . . . A . . . . . . . m << (7 - (p))
61 * m2 . H . . . G . . . F . . . E . . . D . . . C . . . B . . . A . . (m >> (p)) << 2
62 * m3 G E C A m1 & 0x80808080
63 * m4 H F D B m2 & 0x40404040
64 * m5 G H E F C D A B m3 | m4
65 * m6 G H E F C D G H A B E F m5 | (m5 >> 20)
66 * m7 G H E F C D G H A B C D E F G H m6 | (m6 >> 10)
70 #define GetBits(p,o,d) {\
72 m1 = m << (7 - (p)); \
73 m2 = (m >> (p)) << 2; \
74 m3 = m1 & 0x80808080; \
75 m4 = m2 & 0x40404040; \
77 m6 = m5 | (m5 >> 20); \
78 d = m6 | (m6 >> 10); \
81 #define GetBits(p,o,d) {\
83 m5 = ((m << (7 - (p))) & 0x80808080) | (((m >> (p)) << 2) & 0x40404040); \
84 m6 = m5 | (m5 >> 20); \
85 d = m6 | (m6 >> 10); \
90 shadowUpdatePlanar4 (ScreenPtr pScreen
,
93 RegionPtr damage
= shadowDamage (pBuf
);
94 PixmapPtr pShadow
= pBuf
->pPixmap
;
95 int nbox
= REGION_NUM_RECTS (damage
);
96 BoxPtr pbox
= REGION_RECTS (damage
);
97 CARD32
*shaBase
, *shaLine
, *sha
;
99 int scrBase
, scrLine
, scr
;
101 int shaXoff
, shaYoff
; /* XXX assumed to be zero */
102 int x
, y
, w
, h
, width
;
104 CARD32
*winBase
= NULL
, *win
;
108 CARD8 s1
, s2
, s3
, s4
;
110 fbGetStipDrawable (&pShadow
->drawable
, shaBase
, shaStride
, shaBpp
, shaXoff
, shaYoff
);
113 x
= (pbox
->x1
) * shaBpp
;
115 w
= (pbox
->x2
- pbox
->x1
) * shaBpp
;
116 h
= pbox
->y2
- pbox
->y1
;
118 w
= (w
+ (x
& PL_MASK
) + PL_MASK
) >> PL_SHIFT
;
121 scrLine
= (x
>> PL_SHIFT
);
122 shaLine
= shaBase
+ y
* shaStride
+ (x
>> FB_SHIFT
);
126 for (plane
= 0; plane
< 4; plane
++)
134 /* how much remains in this window */
135 i
= scrBase
+ winSize
- scr
;
136 if (i
<= 0 || scr
< scrBase
)
138 winBase
= (CARD32
*) (*pBuf
->window
) (pScreen
,
140 (scr
<< 4) | (plane
),
150 win
= winBase
+ (scr
- scrBase
);
162 *win
++ = s1
| (s2
<< 8) | (s3
<< 16) | (s4
<< 24);
167 shaLine
+= shaStride
;
174 shadowUpdateProc
shadowUpdatePlanar4Weak(void) {
175 return shadowUpdatePlanar4
;
178 shadowUpdateProc
shadowUpdatePlanar4x8Weak(void) {
179 return shadowUpdatePlanar4x8
;