1 | /*
|
---|
2 | * $Id: shrotpackYX.h,v 1.2 2005/08/08 06:25:22 keithp Exp $
|
---|
3 | *
|
---|
4 | * Copyright © 2004 Philip Blundell
|
---|
5 | *
|
---|
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 Philip Blundell not be used in
|
---|
11 | * advertising or publicity pertaining to distribution of the software without
|
---|
12 | * specific, written prior permission. Philip Blundell makes no
|
---|
13 | * representations about the suitability of this software for any purpose. It
|
---|
14 | * is provided "as is" without express or implied warranty.
|
---|
15 | *
|
---|
16 | * PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
17 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
18 | * EVENT SHALL PHILIP BLUNDELL 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.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #include <X11/X.h>
|
---|
26 | #include "scrnintstr.h"
|
---|
27 | #include "windowstr.h"
|
---|
28 | #include "dixfontstr.h"
|
---|
29 | #include "mi.h"
|
---|
30 | #include "regionstr.h"
|
---|
31 | #include "globals.h"
|
---|
32 | #include "gcstruct.h"
|
---|
33 | #include "shadow.h"
|
---|
34 | #include "fb.h"
|
---|
35 |
|
---|
36 | #if ROTATE == 270
|
---|
37 |
|
---|
38 | #define WINSTEPX(stride) (stride)
|
---|
39 | #define WINSTART(x,y) (((pScreen->height - 1) - y) + (x * winStride))
|
---|
40 | #define WINSTEPY() -1
|
---|
41 |
|
---|
42 | #elif ROTATE == 90
|
---|
43 |
|
---|
44 | #define WINSTEPX(stride) (-stride)
|
---|
45 | #define WINSTEPY() 1
|
---|
46 | #define WINSTART(x,y) (((pScreen->width - 1 - x) * winStride) + y)
|
---|
47 |
|
---|
48 | #else
|
---|
49 |
|
---|
50 | #error This rotation is not supported here
|
---|
51 |
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #ifdef __arm__
|
---|
55 | #define PREFETCH
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | void
|
---|
59 | FUNC (ScreenPtr pScreen,
|
---|
60 | shadowBufPtr pBuf);
|
---|
61 |
|
---|
62 | void
|
---|
63 | FUNC (ScreenPtr pScreen,
|
---|
64 | shadowBufPtr pBuf)
|
---|
65 | {
|
---|
66 | RegionPtr damage = shadowDamage(pBuf);
|
---|
67 | PixmapPtr pShadow = pBuf->pPixmap;
|
---|
68 | int nbox = REGION_NUM_RECTS (damage);
|
---|
69 | BoxPtr pbox = REGION_RECTS (damage);
|
---|
70 | FbBits *shaBits;
|
---|
71 | Data *shaBase, *shaLine, *sha;
|
---|
72 | FbStride shaStride, winStride;
|
---|
73 | int shaBpp;
|
---|
74 | int shaXoff, shaYoff; /* XXX assumed to be zero */
|
---|
75 | int x, y, w, h;
|
---|
76 | Data *winBase, *win, *winLine;
|
---|
77 | CARD32 winSize;
|
---|
78 |
|
---|
79 | fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff);
|
---|
80 | shaBase = (Data *) shaBits;
|
---|
81 | shaStride = shaStride * sizeof (FbBits) / sizeof (Data);
|
---|
82 |
|
---|
83 | winBase = (Data *) (*pBuf->window) (pScreen, 0, 0,
|
---|
84 | SHADOW_WINDOW_WRITE,
|
---|
85 | &winSize, pBuf->closure);
|
---|
86 | winStride = (Data *) (*pBuf->window) (pScreen, 1, 0,
|
---|
87 | SHADOW_WINDOW_WRITE,
|
---|
88 | &winSize, pBuf->closure) - winBase;
|
---|
89 |
|
---|
90 | while (nbox--)
|
---|
91 | {
|
---|
92 | x = pbox->x1;
|
---|
93 | y = pbox->y1;
|
---|
94 | w = (pbox->x2 - pbox->x1);
|
---|
95 | h = pbox->y2 - pbox->y1;
|
---|
96 |
|
---|
97 | shaLine = shaBase + (y * shaStride) + x;
|
---|
98 | #ifdef PREFETCH
|
---|
99 | __builtin_prefetch (shaLine);
|
---|
100 | #endif
|
---|
101 | winLine = winBase + WINSTART(x, y);
|
---|
102 |
|
---|
103 | while (h--)
|
---|
104 | {
|
---|
105 | sha = shaLine;
|
---|
106 | win = winLine;
|
---|
107 |
|
---|
108 | while (sha < (shaLine + w - 16))
|
---|
109 | {
|
---|
110 | #ifdef PREFETCH
|
---|
111 | __builtin_prefetch (sha + shaStride);
|
---|
112 | #endif
|
---|
113 | *win = *sha++;
|
---|
114 | win += WINSTEPX(winStride);
|
---|
115 | *win = *sha++;
|
---|
116 | win += WINSTEPX(winStride);
|
---|
117 | *win = *sha++;
|
---|
118 | win += WINSTEPX(winStride);
|
---|
119 | *win = *sha++;
|
---|
120 | win += WINSTEPX(winStride);
|
---|
121 |
|
---|
122 | *win = *sha++;
|
---|
123 | win += WINSTEPX(winStride);
|
---|
124 | *win = *sha++;
|
---|
125 | win += WINSTEPX(winStride);
|
---|
126 | *win = *sha++;
|
---|
127 | win += WINSTEPX(winStride);
|
---|
128 | *win = *sha++;
|
---|
129 | win += WINSTEPX(winStride);
|
---|
130 |
|
---|
131 | *win = *sha++;
|
---|
132 | win += WINSTEPX(winStride);
|
---|
133 | *win = *sha++;
|
---|
134 | win += WINSTEPX(winStride);
|
---|
135 | *win = *sha++;
|
---|
136 | win += WINSTEPX(winStride);
|
---|
137 | *win = *sha++;
|
---|
138 | win += WINSTEPX(winStride);
|
---|
139 |
|
---|
140 | *win = *sha++;
|
---|
141 | win += WINSTEPX(winStride);
|
---|
142 | *win = *sha++;
|
---|
143 | win += WINSTEPX(winStride);
|
---|
144 | *win = *sha++;
|
---|
145 | win += WINSTEPX(winStride);
|
---|
146 | *win = *sha++;
|
---|
147 | win += WINSTEPX(winStride);
|
---|
148 | }
|
---|
149 |
|
---|
150 | while (sha < (shaLine + w))
|
---|
151 | {
|
---|
152 | *win = *sha++;
|
---|
153 | win += WINSTEPX(winStride);
|
---|
154 | }
|
---|
155 |
|
---|
156 | y++;
|
---|
157 | shaLine += shaStride;
|
---|
158 | winLine += WINSTEPY();
|
---|
159 | }
|
---|
160 | pbox++;
|
---|
161 | } /* nbox */
|
---|
162 | }
|
---|