2
* $XFree86: xc/programs/Xserver/miext/shadow/shplanar8.c,v 1.4 2001/10/28 03:34:16 tsi Exp $
4
* Copyright � 2000 Keith Packard
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.
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.
26
#include "scrnintstr.h"
27
#include "windowstr.h"
29
#include "dixfontstr.h"
30
#include "fontstruct.h"
32
#include "regionstr.h"
48
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
49
* 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
50
* 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))
51
* 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))
52
* m3 D C B A m1 & 0x80808080
53
* m4 H G F E m2 & 0x08080808
54
* m5 D H C G B F A E m3 | m4
55
* m6 D H C G B F m5 >> 9
56
* m7 D H C D G H B C F G A B E F m5 | m6
57
* m8 D H C D G H m7 >> 18
58
* m9 D H C D G H B C D F G H A B C D E F G H m7 | m8
62
#define PL_UNIT (1 << PL_SHIFT)
63
#define PL_MASK (PL_UNIT - 1)
66
#define GetBits(p,o,d) { \
67
CARD32 m1,m2,m3,m4,m5,m6,m7,m8; \
68
m1 = sha[o] << (7 - (p)); \
69
m2 = sha[(o)+1] << (3 - (p)); \
70
m3 = m1 & 0x80808080; \
71
m4 = m2 & 0x08080808; \
79
#define GetBits(p,o,d) { \
81
m5 = ((sha[o] << (7 - (p))) & 0x80808080) | ((sha[(o)+1] << (3 - (p))) & 0x08080808); \
82
m7 = m5 | (m5 >> 9); \
83
d = m7 | (m7 >> 18); \
88
shadowUpdatePlanar4x8 (ScreenPtr pScreen,
91
RegionPtr damage = &pBuf->damage;
92
PixmapPtr pShadow = pBuf->pPixmap;
93
int nbox = REGION_NUM_RECTS (damage);
94
BoxPtr pbox = REGION_RECTS (damage);
95
CARD32 *shaBase, *shaLine, *sha;
98
int scrBase, scrLine, scr;
100
int shaXoff, shaYoff; /* XXX assumed to be zero */
101
int x, y, w, h, width;
103
CARD32 *winBase = NULL, *win;
107
fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
110
x = pbox->x1 * shaBpp;
112
w = (pbox->x2 - pbox->x1) * shaBpp;
113
h = pbox->y2 - pbox->y1;
115
w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
118
scrLine = (x >> PL_SHIFT);
119
shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
123
for (plane = 0; plane < 4; plane++)
131
/* how much remains in this window */
132
i = scrBase + winSize - scr;
133
if (i <= 0 || scr < scrBase)
135
winBase = (CARD32 *) (*pBuf->window) (pScreen,
137
(scr << 4) | (plane),
147
win = winBase + (scr - scrBase);
159
*win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
164
shaLine += shaStride;