1 | /*
|
---|
2 | * Copyright © 2004 Philip Blundell
|
---|
3 | *
|
---|
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.
|
---|
13 | *
|
---|
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.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include <X11/X.h>
|
---|
24 | #include "scrnintstr.h"
|
---|
25 | #include "windowstr.h"
|
---|
26 | #include "dixfontstr.h"
|
---|
27 | #include "mi.h"
|
---|
28 | #include "regionstr.h"
|
---|
29 | #include "globals.h"
|
---|
30 | #include "gcstruct.h"
|
---|
31 | #include "shadow.h"
|
---|
32 | #include "fb.h"
|
---|
33 |
|
---|
34 | #if ROTATE == 270
|
---|
35 |
|
---|
36 | #define WINSTEPX(stride) (stride)
|
---|
37 | #define WINSTART(x,y) (((pScreen->height - 1) - y) + (x * winStride))
|
---|
38 | #define WINSTEPY() -1
|
---|
39 |
|
---|
40 | #elif ROTATE == 90
|
---|
41 |
|
---|
42 | #define WINSTEPX(stride) (-stride)
|
---|
43 | #define WINSTEPY() 1
|
---|
44 | #define WINSTART(x,y) (((pScreen->width - 1 - x) * winStride) + y)
|
---|
45 |
|
---|
46 | #else
|
---|
47 |
|
---|
48 | #error This rotation is not supported here
|
---|
49 |
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #ifdef __arm__
|
---|
53 | #define PREFETCH
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | void
|
---|
57 | FUNC (ScreenPtr pScreen,
|
---|
58 | shadowBufPtr pBuf);
|
---|
59 |
|
---|
60 | void
|
---|
61 | FUNC (ScreenPtr pScreen,
|
---|
62 | shadowBufPtr pBuf)
|
---|
63 | {
|
---|
64 | RegionPtr damage = shadowDamage(pBuf);
|
---|
65 | PixmapPtr pShadow = pBuf->pPixmap;
|
---|
66 | int nbox = RegionNumRects (damage);
|
---|
67 | BoxPtr pbox = RegionRects (damage);
|
---|
68 | FbBits *shaBits;
|
---|
69 | Data *shaBase, *shaLine, *sha;
|
---|
70 | FbStride shaStride, winStride;
|
---|
71 | int shaBpp;
|
---|
72 | _X_UNUSED int shaXoff, shaYoff;
|
---|
73 | int x, y, w, h;
|
---|
74 | Data *winBase, *win, *winLine;
|
---|
75 | CARD32 winSize;
|
---|
76 |
|
---|
77 | fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
|
---|
78 | shaBase = (Data *) shaBits;
|
---|
79 | shaStride = shaStride * sizeof (FbBits) / sizeof (Data);
|
---|
80 |
|
---|
81 | winBase = (Data *) (*pBuf->window) (pScreen, 0, 0,
|
---|
82 | SHADOW_WINDOW_WRITE,
|
---|
83 | &winSize, pBuf->closure);
|
---|
84 | winStride = (Data *) (*pBuf->window) (pScreen, 1, 0,
|
---|
85 | SHADOW_WINDOW_WRITE,
|
---|
86 | &winSize, pBuf->closure) - winBase;
|
---|
87 |
|
---|
88 | while (nbox--)
|
---|
89 | {
|
---|
90 | x = pbox->x1;
|
---|
91 | y = pbox->y1;
|
---|
92 | w = (pbox->x2 - pbox->x1);
|
---|
93 | h = pbox->y2 - pbox->y1;
|
---|
94 |
|
---|
95 | shaLine = shaBase + (y * shaStride) + x;
|
---|
96 | #ifdef PREFETCH
|
---|
97 | __builtin_prefetch (shaLine);
|
---|
98 | #endif
|
---|
99 | winLine = winBase + WINSTART(x, y);
|
---|
100 |
|
---|
101 | while (h--)
|
---|
102 | {
|
---|
103 | sha = shaLine;
|
---|
104 | win = winLine;
|
---|
105 |
|
---|
106 | while (sha < (shaLine + w - 16))
|
---|
107 | {
|
---|
108 | #ifdef PREFETCH
|
---|
109 | __builtin_prefetch (sha + shaStride);
|
---|
110 | #endif
|
---|
111 | *win = *sha++;
|
---|
112 | win += WINSTEPX(winStride);
|
---|
113 | *win = *sha++;
|
---|
114 | win += WINSTEPX(winStride);
|
---|
115 | *win = *sha++;
|
---|
116 | win += WINSTEPX(winStride);
|
---|
117 | *win = *sha++;
|
---|
118 | win += WINSTEPX(winStride);
|
---|
119 |
|
---|
120 | *win = *sha++;
|
---|
121 | win += WINSTEPX(winStride);
|
---|
122 | *win = *sha++;
|
---|
123 | win += WINSTEPX(winStride);
|
---|
124 | *win = *sha++;
|
---|
125 | win += WINSTEPX(winStride);
|
---|
126 | *win = *sha++;
|
---|
127 | win += WINSTEPX(winStride);
|
---|
128 |
|
---|
129 | *win = *sha++;
|
---|
130 | win += WINSTEPX(winStride);
|
---|
131 | *win = *sha++;
|
---|
132 | win += WINSTEPX(winStride);
|
---|
133 | *win = *sha++;
|
---|
134 | win += WINSTEPX(winStride);
|
---|
135 | *win = *sha++;
|
---|
136 | win += WINSTEPX(winStride);
|
---|
137 |
|
---|
138 | *win = *sha++;
|
---|
139 | win += WINSTEPX(winStride);
|
---|
140 | *win = *sha++;
|
---|
141 | win += WINSTEPX(winStride);
|
---|
142 | *win = *sha++;
|
---|
143 | win += WINSTEPX(winStride);
|
---|
144 | *win = *sha++;
|
---|
145 | win += WINSTEPX(winStride);
|
---|
146 | }
|
---|
147 |
|
---|
148 | while (sha < (shaLine + w))
|
---|
149 | {
|
---|
150 | *win = *sha++;
|
---|
151 | win += WINSTEPX(winStride);
|
---|
152 | }
|
---|
153 |
|
---|
154 | y++;
|
---|
155 | shaLine += shaStride;
|
---|
156 | winLine += WINSTEPY();
|
---|
157 | }
|
---|
158 | pbox++;
|
---|
159 | } /* nbox */
|
---|
160 | }
|
---|