diff options
Diffstat (limited to 'hw/xfree86/xaa/xaaSpans.c')
-rw-r--r-- | hw/xfree86/xaa/xaaSpans.c | 876 |
1 files changed, 0 insertions, 876 deletions
diff --git a/hw/xfree86/xaa/xaaSpans.c b/hw/xfree86/xaa/xaaSpans.c deleted file mode 100644 index f03452a46..000000000 --- a/hw/xfree86/xaa/xaaSpans.c +++ /dev/null | |||
@@ -1,876 +0,0 @@ | |||
1 | |||
2 | #ifdef HAVE_XORG_CONFIG_H | ||
3 | #include <xorg-config.h> | ||
4 | #endif | ||
5 | |||
6 | #include "misc.h" | ||
7 | #include "xf86.h" | ||
8 | #include "xf86_OSproc.h" | ||
9 | |||
10 | #include <X11/X.h> | ||
11 | #include "scrnintstr.h" | ||
12 | #include "pixmapstr.h" | ||
13 | #include "xf86str.h" | ||
14 | #include "mi.h" | ||
15 | #include "mispans.h" | ||
16 | #include "xaa.h" | ||
17 | #include "xaalocal.h" | ||
18 | |||
19 | static void XAARenderSolidSpans(GCPtr, int, DDXPointPtr, int *, int, int, int); | ||
20 | static void XAARenderColor8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
21 | int); | ||
22 | static void XAARenderMono8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
23 | int); | ||
24 | static void XAARenderCacheBltSpans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
25 | int); | ||
26 | static void XAARenderColorExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
27 | int); | ||
28 | static void XAARenderCacheExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
29 | int); | ||
30 | static void XAARenderPixmapCopySpans(GCPtr, int, DDXPointPtr, int *, int, int, | ||
31 | int); | ||
32 | |||
33 | void | ||
34 | XAAFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, /* number of spans to fill */ | ||
35 | DDXPointPtr pptInit, /* pointer to list of start points */ | ||
36 | int *pwidthInit, /* pointer to list of n widths */ | ||
37 | int fSorted) | ||
38 | { | ||
39 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
40 | int type = 0; | ||
41 | ClipAndRenderSpansFunc function; | ||
42 | Bool fastClip = FALSE; | ||
43 | |||
44 | if ((nInit <= 0) || !pGC->planemask) | ||
45 | return; | ||
46 | |||
47 | if (!RegionNumRects(pGC->pCompositeClip)) | ||
48 | return; | ||
49 | |||
50 | switch (pGC->fillStyle) { | ||
51 | case FillSolid: | ||
52 | type = DO_SOLID; | ||
53 | break; | ||
54 | case FillStippled: | ||
55 | type = (*infoRec->StippledFillChooser) (pGC); | ||
56 | break; | ||
57 | case FillOpaqueStippled: | ||
58 | if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid && | ||
59 | CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) && | ||
60 | CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) && | ||
61 | CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) && | ||
62 | CHECK_FG(pGC, infoRec->FillSpansSolidFlags)) | ||
63 | type = DO_SOLID; | ||
64 | else | ||
65 | type = (*infoRec->OpaqueStippledFillChooser) (pGC); | ||
66 | break; | ||
67 | case FillTiled: | ||
68 | type = (*infoRec->TiledFillChooser) (pGC); | ||
69 | break; | ||
70 | } | ||
71 | |||
72 | switch (type) { | ||
73 | case DO_SOLID: | ||
74 | function = XAARenderSolidSpans; | ||
75 | if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) | ||
76 | fastClip = TRUE; | ||
77 | break; | ||
78 | case DO_COLOR_8x8: | ||
79 | function = XAARenderColor8x8Spans; | ||
80 | if (infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL) | ||
81 | fastClip = TRUE; | ||
82 | break; | ||
83 | case DO_MONO_8x8: | ||
84 | function = XAARenderMono8x8Spans; | ||
85 | if (infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL) | ||
86 | fastClip = TRUE; | ||
87 | break; | ||
88 | case DO_CACHE_BLT: | ||
89 | function = XAARenderCacheBltSpans; | ||
90 | if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY) | ||
91 | fastClip = TRUE; | ||
92 | break; | ||
93 | case DO_COLOR_EXPAND: | ||
94 | function = XAARenderColorExpandSpans; | ||
95 | break; | ||
96 | case DO_CACHE_EXPAND: | ||
97 | function = XAARenderCacheExpandSpans; | ||
98 | if (infoRec->ClippingFlags & | ||
99 | HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND) | ||
100 | fastClip = TRUE; | ||
101 | break; | ||
102 | case DO_PIXMAP_COPY: | ||
103 | function = XAARenderPixmapCopySpans; | ||
104 | if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY) | ||
105 | fastClip = TRUE; | ||
106 | break; | ||
107 | case DO_IMAGE_WRITE: | ||
108 | default: | ||
109 | (*XAAFallbackOps.FillSpans) (pDraw, pGC, nInit, pptInit, | ||
110 | pwidthInit, fSorted); | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | if ((nInit < 10) || (RegionNumRects(pGC->pCompositeClip) != 1)) | ||
115 | fastClip = FALSE; | ||
116 | |||
117 | if (fastClip) { | ||
118 | infoRec->ClipBox = &pGC->pCompositeClip->extents; | ||
119 | (*function) (pGC, nInit, pptInit, pwidthInit, fSorted, | ||
120 | pDraw->x, pDraw->y); | ||
121 | infoRec->ClipBox = NULL; | ||
122 | } | ||
123 | else | ||
124 | XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted, | ||
125 | function, pDraw->x, pDraw->y); | ||
126 | } | ||
127 | |||
128 | /*********************\ | ||
129 | | Solid Spans | | ||
130 | \*********************/ | ||
131 | |||
132 | static void | ||
133 | XAARenderSolidSpans(GCPtr pGC, | ||
134 | int n, | ||
135 | DDXPointPtr ppt, | ||
136 | int *pwidth, int fSorted, int xorg, int yorg) | ||
137 | { | ||
138 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
139 | |||
140 | (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel, | ||
141 | pGC->alu, pGC->planemask, n, ppt, pwidth, | ||
142 | fSorted); | ||
143 | } | ||
144 | |||
145 | /************************\ | ||
146 | | Mono 8x8 Spans | | ||
147 | \************************/ | ||
148 | |||
149 | static void | ||
150 | XAARenderMono8x8Spans(GCPtr pGC, | ||
151 | int n, | ||
152 | DDXPointPtr ppt, | ||
153 | int *pwidth, int fSorted, int xorg, int yorg) | ||
154 | { | ||
155 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
156 | XAAPixmapPtr pPriv; | ||
157 | int fg, bg; | ||
158 | |||
159 | switch (pGC->fillStyle) { | ||
160 | case FillStippled: | ||
161 | pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); | ||
162 | fg = pGC->fgPixel; | ||
163 | bg = -1; | ||
164 | break; | ||
165 | case FillOpaqueStippled: | ||
166 | pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple); | ||
167 | fg = pGC->fgPixel; | ||
168 | bg = pGC->bgPixel; | ||
169 | break; | ||
170 | case FillTiled: | ||
171 | pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); | ||
172 | fg = pPriv->fg; | ||
173 | bg = pPriv->bg; | ||
174 | break; | ||
175 | default: /* Muffle compiler */ | ||
176 | pPriv = NULL; /* Kaboom */ | ||
177 | fg = -1; | ||
178 | bg = -1; | ||
179 | break; | ||
180 | } | ||
181 | |||
182 | (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn, | ||
183 | fg, bg, pGC->alu, pGC->planemask, | ||
184 | n, ppt, pwidth, fSorted, | ||
185 | pPriv->pattern0, pPriv->pattern1, | ||
186 | (xorg + pGC->patOrg.x), | ||
187 | (yorg + pGC->patOrg.y)); | ||
188 | } | ||
189 | |||
190 | /*************************\ | ||
191 | | Color 8x8 Spans | | ||
192 | \*************************/ | ||
193 | |||
194 | static void | ||
195 | XAARenderColor8x8Spans(GCPtr pGC, | ||
196 | int n, | ||
197 | DDXPointPtr ppt, | ||
198 | int *pwidth, int fSorted, int xorg, int yorg) | ||
199 | { | ||
200 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
201 | XAACacheInfoPtr pCache; | ||
202 | PixmapPtr pPix; | ||
203 | int fg, bg; | ||
204 | |||
205 | switch (pGC->fillStyle) { | ||
206 | case FillStippled: | ||
207 | pPix = pGC->stipple; | ||
208 | fg = pGC->fgPixel; | ||
209 | bg = -1; | ||
210 | break; | ||
211 | case FillOpaqueStippled: | ||
212 | pPix = pGC->stipple; | ||
213 | fg = pGC->fgPixel; | ||
214 | bg = pGC->bgPixel; | ||
215 | break; | ||
216 | case FillTiled: | ||
217 | pPix = pGC->tile.pixmap; | ||
218 | fg = -1; | ||
219 | bg = -1; | ||
220 | break; | ||
221 | default: /* Muffle compiler */ | ||
222 | pPix = NULL; | ||
223 | fg = -1; | ||
224 | bg = -1; | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg); | ||
229 | |||
230 | (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn, | ||
231 | pGC->alu, pGC->planemask, n, ppt, | ||
232 | pwidth, fSorted, pCache, | ||
233 | (yorg + pGC->patOrg.x), | ||
234 | (xorg + pGC->patOrg.y)); | ||
235 | } | ||
236 | |||
237 | /****************************\ | ||
238 | | Color Expand Spans | | ||
239 | \****************************/ | ||
240 | |||
241 | static void | ||
242 | XAARenderColorExpandSpans(GCPtr pGC, | ||
243 | int n, | ||
244 | DDXPointPtr ppt, | ||
245 | int *pwidth, int fSorted, int xorg, int yorg) | ||
246 | { | ||
247 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
248 | int fg, bg; | ||
249 | |||
250 | switch (pGC->fillStyle) { | ||
251 | case FillStippled: | ||
252 | fg = pGC->fgPixel; | ||
253 | bg = -1; | ||
254 | break; | ||
255 | case FillOpaqueStippled: | ||
256 | fg = pGC->fgPixel; | ||
257 | bg = pGC->bgPixel; | ||
258 | break; | ||
259 | default: /* Muffle compiler */ | ||
260 | fg = -1; | ||
261 | bg = -1; | ||
262 | break; | ||
263 | } | ||
264 | |||
265 | (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg, | ||
266 | pGC->alu, pGC->planemask, n, ppt, pwidth, | ||
267 | fSorted, (xorg + pGC->patOrg.x), | ||
268 | (yorg + pGC->patOrg.y), pGC->stipple); | ||
269 | |||
270 | } | ||
271 | |||
272 | /*************************\ | ||
273 | | Cache Blt Spans | | ||
274 | \*************************/ | ||
275 | |||
276 | static void | ||
277 | XAARenderCacheBltSpans(GCPtr pGC, | ||
278 | int n, | ||
279 | DDXPointPtr ppt, | ||
280 | int *pwidth, int fSorted, int xorg, int yorg) | ||
281 | { | ||
282 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
283 | XAACacheInfoPtr pCache; | ||
284 | |||
285 | switch (pGC->fillStyle) { | ||
286 | case FillStippled: | ||
287 | pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, | ||
288 | pGC->fgPixel, -1); | ||
289 | break; | ||
290 | case FillOpaqueStippled: | ||
291 | pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple, | ||
292 | pGC->fgPixel, pGC->bgPixel); | ||
293 | break; | ||
294 | case FillTiled: | ||
295 | pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap); | ||
296 | break; | ||
297 | default: /* Muffle compiler */ | ||
298 | pCache = NULL; | ||
299 | break; | ||
300 | } | ||
301 | |||
302 | (*infoRec->FillCacheBltSpans) (infoRec->pScrn, | ||
303 | pGC->alu, pGC->planemask, n, ppt, pwidth, | ||
304 | fSorted, pCache, (xorg + pGC->patOrg.x), | ||
305 | (yorg + pGC->patOrg.y)); | ||
306 | |||
307 | } | ||
308 | |||
309 | /****************************\ | ||
310 | | Cache Expand Spans | | ||
311 | \****************************/ | ||
312 | |||
313 | static void | ||
314 | XAARenderCacheExpandSpans(GCPtr pGC, | ||
315 | int n, | ||
316 | DDXPointPtr ppt, | ||
317 | int *pwidth, int fSorted, int xorg, int yorg) | ||
318 | { | ||
319 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
320 | int fg, bg; | ||
321 | |||
322 | switch (pGC->fillStyle) { | ||
323 | case FillStippled: | ||
324 | fg = pGC->fgPixel; | ||
325 | bg = -1; | ||
326 | break; | ||
327 | case FillOpaqueStippled: | ||
328 | fg = pGC->fgPixel; | ||
329 | bg = pGC->bgPixel; | ||
330 | break; | ||
331 | default: /* Muffle compiler */ | ||
332 | fg = -1; | ||
333 | bg = -1; | ||
334 | break; | ||
335 | } | ||
336 | |||
337 | (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg, | ||
338 | pGC->alu, pGC->planemask, n, ppt, pwidth, | ||
339 | fSorted, (xorg + pGC->patOrg.x), | ||
340 | (yorg + pGC->patOrg.y), pGC->stipple); | ||
341 | } | ||
342 | |||
343 | /***************************\ | ||
344 | | Pixmap Copy Spans | | ||
345 | \***************************/ | ||
346 | |||
347 | static void | ||
348 | XAARenderPixmapCopySpans(GCPtr pGC, | ||
349 | int n, | ||
350 | DDXPointPtr ppt, | ||
351 | int *pwidth, int fSorted, int xorg, int yorg) | ||
352 | { | ||
353 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
354 | XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec); | ||
355 | XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap); | ||
356 | |||
357 | pCache->x = pPriv->offscreenArea->box.x1; | ||
358 | pCache->y = pPriv->offscreenArea->box.y1; | ||
359 | pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x; | ||
360 | pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y; | ||
361 | pCache->trans_color = -1; | ||
362 | |||
363 | (*infoRec->FillCacheBltSpans) (infoRec->pScrn, | ||
364 | pGC->alu, pGC->planemask, n, ppt, pwidth, | ||
365 | fSorted, pCache, (xorg + pGC->patOrg.x), | ||
366 | (yorg + pGC->patOrg.y)); | ||
367 | } | ||
368 | |||
369 | /****************\ | ||
370 | | Solid | | ||
371 | \****************/ | ||
372 | |||
373 | void | ||
374 | XAAFillSolidSpans(ScrnInfoPtr pScrn, | ||
375 | int fg, int rop, | ||
376 | unsigned int planemask, | ||
377 | int n, DDXPointPtr ppt, int *pwidth, int fSorted) | ||
378 | { | ||
379 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
380 | |||
381 | (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask); | ||
382 | |||
383 | if (infoRec->ClipBox) | ||
384 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
385 | infoRec->ClipBox->x1, | ||
386 | infoRec->ClipBox->y1, | ||
387 | infoRec->ClipBox->x2 - 1, | ||
388 | infoRec->ClipBox->y2 - 1); | ||
389 | |||
390 | while (n--) { | ||
391 | if (*pwidth > 0) | ||
392 | (*infoRec->SubsequentSolidFillRect) (pScrn, ppt->x, ppt->y, | ||
393 | *pwidth, 1); | ||
394 | ppt++; | ||
395 | pwidth++; | ||
396 | } | ||
397 | |||
398 | if (infoRec->ClipBox) | ||
399 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
400 | |||
401 | SET_SYNC_FLAG(infoRec); | ||
402 | } | ||
403 | |||
404 | /***************\ | ||
405 | | Mono 8x8 | | ||
406 | \***************/ | ||
407 | |||
408 | void | ||
409 | XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, | ||
410 | int fg, int bg, int rop, | ||
411 | unsigned int planemask, | ||
412 | int n, | ||
413 | DDXPointPtr ppt, | ||
414 | int *pwidth, int fSorted, | ||
415 | int pattern0, int pattern1, | ||
416 | int xorigin, int yorigin) | ||
417 | { | ||
418 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
419 | int patx = pattern0, paty = pattern1; | ||
420 | int xorg = (-xorigin) & 0x07; | ||
421 | int yorg = (-yorigin) & 0x07; | ||
422 | |||
423 | if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) { | ||
424 | if (!(infoRec->Mono8x8PatternFillFlags & | ||
425 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { | ||
426 | XAARotateMonoPattern(&patx, &paty, xorg, yorg, | ||
427 | (infoRec->Mono8x8PatternFillFlags & | ||
428 | BIT_ORDER_IN_BYTE_MSBFIRST)); | ||
429 | xorg = patx; | ||
430 | yorg = paty; | ||
431 | } | ||
432 | } | ||
433 | else { | ||
434 | XAACacheInfoPtr pCache = | ||
435 | (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); | ||
436 | patx = pCache->x; | ||
437 | paty = pCache->y; | ||
438 | if (!(infoRec->Mono8x8PatternFillFlags & | ||
439 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { | ||
440 | int slot = (yorg << 3) + xorg; | ||
441 | |||
442 | patx += pCache->offsets[slot].x; | ||
443 | paty += pCache->offsets[slot].y; | ||
444 | xorg = patx; | ||
445 | yorg = paty; | ||
446 | } | ||
447 | } | ||
448 | |||
449 | (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, | ||
450 | fg, bg, rop, planemask); | ||
451 | |||
452 | if (infoRec->ClipBox) | ||
453 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
454 | infoRec->ClipBox->x1, | ||
455 | infoRec->ClipBox->y1, | ||
456 | infoRec->ClipBox->x2 - 1, | ||
457 | infoRec->ClipBox->y2 - 1); | ||
458 | |||
459 | while (n--) { | ||
460 | (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, | ||
461 | xorg, yorg, ppt->x, | ||
462 | ppt->y, *pwidth, 1); | ||
463 | ppt++; | ||
464 | pwidth++; | ||
465 | } | ||
466 | |||
467 | if (infoRec->ClipBox) | ||
468 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
469 | |||
470 | SET_SYNC_FLAG(infoRec); | ||
471 | } | ||
472 | |||
473 | void | ||
474 | XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn, | ||
475 | int fg, int bg, int rop, | ||
476 | unsigned int planemask, | ||
477 | int n, | ||
478 | DDXPointPtr ppt, | ||
479 | int *pwidth, int fSorted, | ||
480 | int pattern0, int pattern1, int xorigin, int yorigin) | ||
481 | { | ||
482 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
483 | int patx = pattern0, paty = pattern1; | ||
484 | int xorg, yorg, slot; | ||
485 | XAACacheInfoPtr pCache = NULL; | ||
486 | |||
487 | if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) { | ||
488 | pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1); | ||
489 | patx = pCache->x; | ||
490 | paty = pCache->y; | ||
491 | } | ||
492 | |||
493 | (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty, | ||
494 | fg, bg, rop, planemask); | ||
495 | |||
496 | if (infoRec->ClipBox) | ||
497 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
498 | infoRec->ClipBox->x1, | ||
499 | infoRec->ClipBox->y1, | ||
500 | infoRec->ClipBox->x2 - 1, | ||
501 | infoRec->ClipBox->y2 - 1); | ||
502 | |||
503 | while (n--) { | ||
504 | xorg = (ppt->x - xorigin) & 0x07; | ||
505 | yorg = (ppt->y - yorigin) & 0x07; | ||
506 | |||
507 | if (!(infoRec->Mono8x8PatternFillFlags & | ||
508 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { | ||
509 | if (infoRec->Mono8x8PatternFillFlags & | ||
510 | HARDWARE_PATTERN_PROGRAMMED_BITS) { | ||
511 | patx = pattern0; | ||
512 | paty = pattern1; | ||
513 | XAARotateMonoPattern(&patx, &paty, xorg, yorg, | ||
514 | (infoRec->Mono8x8PatternFillFlags & | ||
515 | BIT_ORDER_IN_BYTE_MSBFIRST)); | ||
516 | xorg = patx; | ||
517 | yorg = paty; | ||
518 | } | ||
519 | else { | ||
520 | slot = (yorg << 3) + xorg; | ||
521 | xorg = patx + pCache->offsets[slot].x; | ||
522 | yorg = paty + pCache->offsets[slot].y; | ||
523 | } | ||
524 | } | ||
525 | |||
526 | (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, | ||
527 | xorg, yorg, ppt->x, | ||
528 | ppt->y, *pwidth, 1); | ||
529 | ppt++; | ||
530 | pwidth++; | ||
531 | } | ||
532 | |||
533 | if (infoRec->ClipBox) | ||
534 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
535 | |||
536 | SET_SYNC_FLAG(infoRec); | ||
537 | } | ||
538 | |||
539 | /****************\ | ||
540 | | Color 8x8 | | ||
541 | \****************/ | ||
542 | |||
543 | void | ||
544 | XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn, | ||
545 | int rop, | ||
546 | unsigned int planemask, | ||
547 | int n, | ||
548 | DDXPointPtr ppt, | ||
549 | int *pwidth, int fSorted, | ||
550 | XAACacheInfoPtr pCache, | ||
551 | int xorigin, int yorigin) | ||
552 | { | ||
553 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
554 | int patx = pCache->x, paty = pCache->y; | ||
555 | int xorg = (-xorigin) & 0x07; | ||
556 | int yorg = (-yorigin) & 0x07; | ||
557 | |||
558 | if (!(infoRec->Color8x8PatternFillFlags & | ||
559 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { | ||
560 | int slot = (yorg << 3) + xorg; | ||
561 | |||
562 | paty += pCache->offsets[slot].y; | ||
563 | patx += pCache->offsets[slot].x; | ||
564 | xorg = patx; | ||
565 | yorg = paty; | ||
566 | } | ||
567 | |||
568 | (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty, | ||
569 | rop, planemask, | ||
570 | pCache->trans_color); | ||
571 | |||
572 | if (infoRec->ClipBox) | ||
573 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
574 | infoRec->ClipBox->x1, | ||
575 | infoRec->ClipBox->y1, | ||
576 | infoRec->ClipBox->x2 - 1, | ||
577 | infoRec->ClipBox->y2 - 1); | ||
578 | |||
579 | while (n--) { | ||
580 | (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, | ||
581 | xorg, yorg, ppt->x, | ||
582 | ppt->y, *pwidth, 1); | ||
583 | ppt++; | ||
584 | pwidth++; | ||
585 | } | ||
586 | |||
587 | if (infoRec->ClipBox) | ||
588 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
589 | |||
590 | SET_SYNC_FLAG(infoRec); | ||
591 | } | ||
592 | |||
593 | void | ||
594 | XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn, | ||
595 | int rop, | ||
596 | unsigned int planemask, | ||
597 | int n, | ||
598 | DDXPointPtr ppt, | ||
599 | int *pwidth, int fSorted, | ||
600 | XAACacheInfoPtr pCache, int xorigin, int yorigin) | ||
601 | { | ||
602 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
603 | int xorg, yorg, slot; | ||
604 | |||
605 | (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y, | ||
606 | rop, planemask, | ||
607 | pCache->trans_color); | ||
608 | |||
609 | if (infoRec->ClipBox) | ||
610 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
611 | infoRec->ClipBox->x1, | ||
612 | infoRec->ClipBox->y1, | ||
613 | infoRec->ClipBox->x2 - 1, | ||
614 | infoRec->ClipBox->y2 - 1); | ||
615 | |||
616 | while (n--) { | ||
617 | xorg = (ppt->x - xorigin) & 0x07; | ||
618 | yorg = (ppt->y - yorigin) & 0x07; | ||
619 | |||
620 | if (!(infoRec->Color8x8PatternFillFlags & | ||
621 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) { | ||
622 | slot = (yorg << 3) + xorg; | ||
623 | yorg = pCache->y + pCache->offsets[slot].y; | ||
624 | xorg = pCache->x + pCache->offsets[slot].x; | ||
625 | } | ||
626 | |||
627 | (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn, | ||
628 | xorg, yorg, ppt->x, | ||
629 | ppt->y, *pwidth, 1); | ||
630 | ppt++; | ||
631 | pwidth++; | ||
632 | } | ||
633 | |||
634 | if (infoRec->ClipBox) | ||
635 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
636 | |||
637 | SET_SYNC_FLAG(infoRec); | ||
638 | } | ||
639 | |||
640 | /*****************\ | ||
641 | | Cache Blit | | ||
642 | \*****************/ | ||
643 | |||
644 | void | ||
645 | XAAFillCacheBltSpans(ScrnInfoPtr pScrn, | ||
646 | int rop, | ||
647 | unsigned int planemask, | ||
648 | int n, | ||
649 | DDXPointPtr ppt, | ||
650 | int *pwidth, | ||
651 | int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg) | ||
652 | { | ||
653 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
654 | int x, w, phaseX, phaseY, blit_w; | ||
655 | |||
656 | (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask, | ||
657 | pCache->trans_color); | ||
658 | |||
659 | if (infoRec->ClipBox) | ||
660 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
661 | infoRec->ClipBox->x1, | ||
662 | infoRec->ClipBox->y1, | ||
663 | infoRec->ClipBox->x2 - 1, | ||
664 | infoRec->ClipBox->y2 - 1); | ||
665 | |||
666 | while (n--) { | ||
667 | x = ppt->x; | ||
668 | w = *pwidth; | ||
669 | phaseX = (x - xorg) % pCache->orig_w; | ||
670 | if (phaseX < 0) | ||
671 | phaseX += pCache->orig_w; | ||
672 | phaseY = (ppt->y - yorg) % pCache->orig_h; | ||
673 | if (phaseY < 0) | ||
674 | phaseY += pCache->orig_h; | ||
675 | |||
676 | while (1) { | ||
677 | blit_w = pCache->w - phaseX; | ||
678 | if (blit_w > w) | ||
679 | blit_w = w; | ||
680 | |||
681 | (*infoRec->SubsequentScreenToScreenCopy) (pScrn, | ||
682 | pCache->x + phaseX, | ||
683 | pCache->y + phaseY, x, | ||
684 | ppt->y, blit_w, 1); | ||
685 | |||
686 | w -= blit_w; | ||
687 | if (!w) | ||
688 | break; | ||
689 | x += blit_w; | ||
690 | phaseX = (phaseX + blit_w) % pCache->orig_w; | ||
691 | } | ||
692 | ppt++; | ||
693 | pwidth++; | ||
694 | } | ||
695 | |||
696 | if (infoRec->ClipBox) | ||
697 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
698 | |||
699 | SET_SYNC_FLAG(infoRec); | ||
700 | } | ||
701 | |||
702 | /****************\ | ||
703 | | Cache Expand | | ||
704 | \****************/ | ||
705 | |||
706 | void | ||
707 | XAAFillCacheExpandSpans(ScrnInfoPtr pScrn, | ||
708 | int fg, int bg, int rop, | ||
709 | unsigned int planemask, | ||
710 | int n, | ||
711 | DDXPointPtr ppt, | ||
712 | int *pwidth, | ||
713 | int fSorted, int xorg, int yorg, PixmapPtr pPix) | ||
714 | { | ||
715 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); | ||
716 | int x, w, phaseX, phaseY, blit_w, cacheWidth; | ||
717 | XAACacheInfoPtr pCache; | ||
718 | |||
719 | pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix); | ||
720 | |||
721 | cacheWidth = (pCache->w * pScrn->bitsPerPixel) / | ||
722 | infoRec->CacheColorExpandDensity; | ||
723 | |||
724 | (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop, | ||
725 | planemask); | ||
726 | |||
727 | if (infoRec->ClipBox) | ||
728 | (*infoRec->SetClippingRectangle) (infoRec->pScrn, | ||
729 | infoRec->ClipBox->x1, | ||
730 | infoRec->ClipBox->y1, | ||
731 | infoRec->ClipBox->x2 - 1, | ||
732 | infoRec->ClipBox->y2 - 1); | ||
733 | |||
734 | while (n--) { | ||
735 | x = ppt->x; | ||
736 | w = *pwidth; | ||
737 | phaseX = (x - xorg) % pCache->orig_w; | ||
738 | if (phaseX < 0) | ||
739 | phaseX += pCache->orig_w; | ||
740 | phaseY = (ppt->y - yorg) % pCache->orig_h; | ||
741 | if (phaseY < 0) | ||
742 | phaseY += pCache->orig_h; | ||
743 | |||
744 | while (1) { | ||
745 | blit_w = cacheWidth - phaseX; | ||
746 | if (blit_w > w) | ||
747 | blit_w = w; | ||
748 | |||
749 | (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, | ||
750 | ppt->y, blit_w, | ||
751 | 1, pCache->x, | ||
752 | pCache->y + | ||
753 | phaseY, | ||
754 | phaseX); | ||
755 | |||
756 | w -= blit_w; | ||
757 | if (!w) | ||
758 | break; | ||
759 | x += blit_w; | ||
760 | phaseX = (phaseX + blit_w) % pCache->orig_w; | ||
761 | } | ||
762 | ppt++; | ||
763 | pwidth++; | ||
764 | } | ||
765 | |||
766 | if (infoRec->ClipBox) | ||
767 | (*infoRec->DisableClipping) (infoRec->pScrn); | ||
768 | |||
769 | SET_SYNC_FLAG(infoRec); | ||
770 | } | ||
771 | |||
772 | void | ||
773 | XAAClipAndRenderSpans(GCPtr pGC, | ||
774 | DDXPointPtr ppt, | ||
775 | int *pwidth, | ||
776 | int nspans, | ||
777 | int fSorted, | ||
778 | ClipAndRenderSpansFunc func, int xorg, int yorg) | ||
779 | { | ||
780 | XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); | ||
781 | DDXPointPtr pptNew, pptBase; | ||
782 | int *pwidthBase, *pwidthNew; | ||
783 | int Right, numRects, MaxBoxes; | ||
784 | |||
785 | MaxBoxes = infoRec->PreAllocSize / (sizeof(DDXPointRec) + sizeof(int)); | ||
786 | pptBase = (DDXPointRec *) infoRec->PreAllocMem; | ||
787 | pwidthBase = (int *) (&pptBase[MaxBoxes]); | ||
788 | |||
789 | pptNew = pptBase; | ||
790 | pwidthNew = pwidthBase; | ||
791 | |||
792 | numRects = RegionNumRects(pGC->pCompositeClip); | ||
793 | |||
794 | if (numRects == 1) { | ||
795 | BoxPtr pextent = RegionRects(pGC->pCompositeClip); | ||
796 | |||
797 | while (nspans--) { | ||
798 | if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) { | ||
799 | pptNew->x = max(pextent->x1, ppt->x); | ||
800 | Right = ppt->x + *pwidth; | ||
801 | *pwidthNew = min(pextent->x2, Right) - pptNew->x; | ||
802 | |||
803 | if (*pwidthNew > 0) { | ||
804 | pptNew->y = ppt->y; | ||
805 | pptNew++; | ||
806 | pwidthNew++; | ||
807 | |||
808 | if (pptNew >= (pptBase + MaxBoxes)) { | ||
809 | (*func) (pGC, MaxBoxes, pptBase, pwidthBase, fSorted, | ||
810 | xorg, yorg); | ||
811 | pptNew = pptBase; | ||
812 | pwidthNew = pwidthBase; | ||
813 | } | ||
814 | } | ||
815 | } | ||
816 | ppt++; | ||
817 | pwidth++; | ||
818 | } | ||
819 | } | ||
820 | else if (numRects) { | ||
821 | BoxPtr pbox; | ||
822 | int nbox; | ||
823 | |||
824 | while (nspans--) { | ||
825 | nbox = numRects; | ||
826 | pbox = RegionRects(pGC->pCompositeClip); | ||
827 | |||
828 | /* find the first band */ | ||
829 | while (nbox && (pbox->y2 <= ppt->y)) { | ||
830 | pbox++; | ||
831 | nbox--; | ||
832 | } | ||
833 | |||
834 | if (nbox && (pbox->y1 <= ppt->y)) { | ||
835 | int orig_y = pbox->y1; | ||
836 | |||
837 | Right = ppt->x + *pwidth; | ||
838 | while (nbox && (orig_y == pbox->y1)) { | ||
839 | if (pbox->x2 <= ppt->x) { | ||
840 | nbox--; | ||
841 | pbox++; | ||
842 | continue; | ||
843 | } | ||
844 | |||
845 | if (pbox->x1 >= Right) { | ||
846 | nbox = 0; | ||
847 | break; | ||
848 | } | ||
849 | |||
850 | pptNew->x = max(pbox->x1, ppt->x); | ||
851 | *pwidthNew = min(pbox->x2, Right) - pptNew->x; | ||
852 | if (*pwidthNew > 0) { | ||
853 | pptNew->y = ppt->y; | ||
854 | pptNew++; | ||
855 | pwidthNew++; | ||
856 | |||
857 | if (pptNew >= (pptBase + MaxBoxes)) { | ||
858 | (*func) (pGC, MaxBoxes, pptBase, pwidthBase, | ||
859 | fSorted, xorg, yorg); | ||
860 | pptNew = pptBase; | ||
861 | pwidthNew = pwidthBase; | ||
862 | } | ||
863 | } | ||
864 | pbox++; | ||
865 | nbox--; | ||
866 | } | ||
867 | } | ||
868 | ppt++; | ||
869 | pwidth++; | ||
870 | } | ||
871 | } | ||
872 | |||
873 | if (pptNew != pptBase) | ||
874 | (*func) (pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted, | ||
875 | xorg, yorg); | ||
876 | } | ||