First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / xf4bpp / vgaStipple.c
blob5ad53028cc45d050968532f04cd979f478535e96
1 /*
2 * Copyright IBM Corporation 1987,1988,1989
4 * All Rights Reserved
6 * Permission to use, copy, modify, and distribute this software and its
7 * documentation for any purpose and without fee is hereby granted,
8 * provided that the above copyright notice appear in all copies and that
9 * both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of IBM not be
11 * used in advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission.
14 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 * SOFTWARE.
24 #ifdef HAVE_XORG_CONFIG_H
25 #include <xorg-config.h>
26 #endif
28 #include "xf4bpp.h"
29 #include "OScompiler.h"
30 #include "vgaReg.h"
31 #include "vgaVideo.h"
33 #include "xf86str.h" /* for pScrn->vtSema */
34 extern ScrnInfoPtr *xf86Screens;
36 #ifndef PC98_EGC
37 static unsigned char
38 getbits
40 register const int x,
41 register const unsigned int patternWidth,
42 register const unsigned char * const lineptr
45 register unsigned char bits ;
46 register const unsigned char *cptr ;
47 register int shift ;
48 register int wrap ;
50 cptr = lineptr + ( x >> 3 ) ;
51 bits = *cptr ;
52 if ((shift = x & 7))
53 bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
54 if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
55 bits &= SCRLEFT8( 0xFF, wrap ) ;
56 bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
59 /* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
60 * I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
62 switch (patternWidth) {
63 case 1: /* Not really useful. */
64 bits &= ~SCRRIGHT8(0xFF,1);
65 bits |= SCRRIGHT8(bits,1);
66 bits |= SCRRIGHT8(bits,2);
67 bits |= SCRRIGHT8(bits,4);
68 break;
69 case 2:
70 bits &= ~SCRRIGHT8(0xFF,2);
71 bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
72 case 3:
73 bits &= ~SCRRIGHT8(0xFF,3);
74 bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
75 case 4:
76 bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
77 case 5:
78 bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
79 case 6:
80 bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
81 case 7:
82 bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
83 default:
85 /* Do nothing, of course */
87 return bits ;
89 #endif
91 /* GJA --
92 * Basically, in the code below, we will draw a stipple in the usual
93 * three parts: left edge, center and right edge.
94 * For efficiency reasons, the center will be drawn byte aligned, so that
95 * we will have to shuffle the bits in the left and right edges.
96 * The hard cases will be stipples with width < 8: In order to get 8
97 * bits from those, we will need a loop. One single 'if' will never do.
98 * This is taken care of above.
100 static void
101 DoMonoSingle
103 WindowPtr pWin, /* GJA */
104 int w,
105 int x,
106 int y,
107 register const unsigned char *mastersrc,
108 int h,
109 register unsigned int width,
110 register unsigned int paddedByteWidth,
111 unsigned int height,
112 int xshift,
113 int yshift
116 IOADDRESS REGBASE =
117 xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
118 register volatile unsigned char *xDst ;
119 register VideoAdapterObject tmp2 ;
120 register int NeedValX ;
121 register int counter ;
122 register int tmp1 ;
123 unsigned int rowCounter ;
124 int byte_cnt ;
125 #ifdef PC98_EGC
126 unsigned char bitmask;
127 #endif
129 /* Do Left Edge */
130 if ((tmp1 = x & 07)) {
131 tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
132 /* Catch The Cases Where The Entire Region Is Within One Byte */
133 if ( ( w -= 8 - tmp1 ) < 0 ) {
134 tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
135 w = 0 ;
137 #ifndef PC98_EGC
138 SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
139 #else
140 bitmask = tmp2; /* Set The Bit Mask */
141 #endif
143 * For Each Line In The Source Pixmap
145 xDst = SCREENADDRESS( pWin, x, y );
146 for ( tmp1 = yshift, rowCounter = h;
147 rowCounter ;
148 rowCounter-- , tmp1++ ) {
150 if ( tmp1 >= (int)height )
151 tmp1 -= height ;
152 #ifndef PC98_EGC
153 /* Read To Save */
154 tmp2 = *( (VgaMemoryPtr) xDst) ;
155 #endif
156 /* Write Pattern */
157 *( (VgaMemoryPtr) xDst ) =
158 #ifndef PC98_EGC
159 getbits( xshift /* GJA */, width,
160 mastersrc
161 + ( tmp1 * paddedByteWidth ) ) >> (x & 07) ;
162 #else
163 #if 0
164 (getbits( xshift /* GJA */, width,
165 mastersrc
166 + ( tmp1 * paddedByteWidth ) ) >> (x & 07)
167 & bitmask);
168 #else
169 (getbits_x( xshift /* GJA */, width,
170 mastersrc
171 + ( tmp1 * paddedByteWidth ), (x & 07))
172 & bitmask);
173 #endif
174 #endif
175 xDst += BYTES_PER_LINE(pWin);
177 NeedValX = (xshift + 8 - (x & 07)) % width;
178 x = ( x + 7 ) & ~07 ;
180 else {
181 NeedValX = xshift ;
184 if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
185 int SavNeedX = NeedValX ;
187 #ifndef PC98_EGC
188 SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
189 #endif
191 * For Each Line In The Source Pixmap
193 xDst = SCREENADDRESS( pWin, x, y );
194 for ( tmp1 = yshift, rowCounter = h;
195 rowCounter ;
196 rowCounter-- , tmp1++ ) {
197 register const unsigned char *l_ptr ;
198 if ( tmp1 >= (int)height )
199 tmp1 -= height ;
200 l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
202 * For Each Byte Across The Pattern In X
204 for ( counter = byte_cnt, NeedValX = SavNeedX ;
205 counter-- ; ) {
206 #ifndef PC98_EGC
207 /* Read To Save */
208 tmp2 = *( (VgaMemoryPtr) xDst) ;
209 #endif
210 /* Write Pattern */
211 *( (VgaMemoryPtr) xDst ) =
212 #ifndef PC98_EGC
213 getbits( NeedValX, width, l_ptr ) ;
214 #else
215 #if 0
216 getbits( NeedValX, width, l_ptr ) ;
217 #else
218 getbits_x ( NeedValX, width, l_ptr, 0 ) ;
219 #endif
220 #endif
221 /* GJA -- The '%' is there since width could be < 8 */
222 NeedValX = (NeedValX + 8) % width;
223 xDst++;
225 xDst += BYTES_PER_LINE(pWin) - byte_cnt;
229 /* Do Right Edge */
230 if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
231 /* Set The Bit Mask */
232 #ifndef PC98_EGC
233 SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
234 #else
235 bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ));
236 #endif
238 * For Each Line In The Source Pixmap
240 xDst = SCREENADDRESS( pWin, ( x + w ), y );
241 for ( tmp1 = yshift, rowCounter = h;
242 rowCounter ;
243 rowCounter-- , tmp1++ ) {
244 if ( tmp1 >= (int)height )
245 tmp1 -= height ;
246 #ifndef PC98_EGC
247 /* Read To Save */
248 tmp2 = *( (VgaMemoryPtr) xDst) ;
249 #endif
250 /* Write Pattern */
251 *( (VgaMemoryPtr) xDst ) =
252 #ifndef PC98_EGC
253 getbits( NeedValX, width,
254 mastersrc
255 + ( tmp1 * paddedByteWidth ) ) ;
256 #else
257 #if 0
258 (getbits( NeedValX, width,
259 mastersrc
260 + ( tmp1 * paddedByteWidth ) ) & bitmask);
261 #else
262 (getbits_x( NeedValX, width,
263 mastersrc
264 + ( tmp1 * paddedByteWidth ), 0 ) & bitmask);
265 #endif
266 #endif
267 xDst += BYTES_PER_LINE(pWin) ;
271 return ;
274 static void
275 DoMonoMany
277 WindowPtr pWin, /* GJA */
278 int w,
279 int x,
280 int y,
281 register const unsigned char *mastersrc,
282 int h,
283 register unsigned int width,
284 register unsigned int paddedByteWidth,
285 unsigned int height,
286 int xshift,
287 int yshift
290 IOADDRESS REGBASE =
291 xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
292 register volatile unsigned char *xDst ;
293 register VideoAdapterObject tmp2 ;
294 register int NeedValX ;
295 register int byte_cnt ;
296 register int tmp1 ;
297 unsigned DestinationRow ;
298 unsigned int SourceRow ;
299 volatile unsigned char *dst ;
300 int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ;
301 #ifdef PC98_EGC
302 unsigned char bitmask;
303 #endif
305 /* Do Left Edge */
306 if ((tmp1 = x & 07)) {
307 tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
308 /* Catch The Cases Where The Entire Region Is Within One Byte */
309 if ( ( w -= 8 - tmp1 ) < 0 ) {
310 tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
311 w = 0 ;
313 #ifndef PC98_EGC
314 SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
315 #else
316 bitmask = tmp2; /* Set The Bit Mask */
317 #endif
319 * For Each Line In The Source Pixmap
321 for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
322 SourceRow < height ;
323 tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
324 register unsigned bitPattern ;
326 if ( tmp1 >= (int)height )
327 tmp1 -= height ;
329 * For Each Time Pattern Repeats In The Y Dimension
331 xDst = dst;
332 for ( DestinationRow = SourceRow,
333 #ifndef PC98_EGC
334 bitPattern = getbits( xshift, width,
335 mastersrc
336 + ( tmp1 * paddedByteWidth ) ) ;
337 #else
338 #if 0
339 bitPattern = getbits( xshift, width,
340 mastersrc
341 + ( tmp1 * paddedByteWidth ) ) ;
342 #else
343 bitPattern = getbits_x( xshift, width,
344 mastersrc
345 + ( tmp1 * paddedByteWidth ), 0 ) ;
346 #endif
347 #endif
348 (int)DestinationRow < h ;
349 DestinationRow += height ) {
350 #ifndef PC98_EGC
351 /* Read To Save */
352 tmp2 = *( (VgaMemoryPtr) xDst ) ;
353 #endif
354 /* Write Pattern */
355 #ifndef PC98_EGC
356 *( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07);
357 #else
358 *( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask;
359 #endif
360 xDst += scr_incr;
363 NeedValX = (xshift + 8 - (x & 07)) % width;
364 x = ( x + 7 ) & ~07 ;
366 else {
367 NeedValX = xshift ;
370 if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
371 int SavNeedX = NeedValX ;
373 #ifndef PC98_EGC
374 SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
375 #endif
377 * For Each Line In The Source Pixmap
379 for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
380 SourceRow < height ;
381 tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) {
382 register const unsigned char *l_ptr ;
383 if ( tmp1 >= (int)height )
384 tmp1 -= height ;
385 l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
387 * For Each Byte Across The Pattern In X
389 for ( tmp2 = byte_cnt, NeedValX = SavNeedX ;
390 tmp2-- ;
391 dst++ ) {
392 register unsigned bitPattern ;
393 #ifndef PC98_EGC
394 register VideoAdapterObject tmp3 ;
395 #endif
397 * For Each Time Pattern Repeats In Y
399 xDst = dst;
400 for ( DestinationRow = SourceRow,
401 #ifndef PC98_EGC
402 bitPattern = getbits( NeedValX, width, l_ptr ) ;
403 #else
404 #if 0
405 bitPattern = getbits( NeedValX, width, l_ptr ) ;
406 #else
407 bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ;
408 #endif
409 #endif
410 (int)DestinationRow < h ;
411 DestinationRow += height ) {
412 #ifndef PC98_EGC
413 /* Read To Save */
414 tmp3 = *( (VgaMemoryPtr) xDst) ;
415 (void)tmp3;
416 #endif
417 /* Write Pattern */
418 *( (VgaMemoryPtr) xDst ) = bitPattern ;
419 xDst += scr_incr;
421 NeedValX = (NeedValX + 8) % width;
426 /* Do Right Edge */
427 if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
428 /* Set The Bit Mask */
429 #ifndef PC98_EGC
430 SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
431 #else
432 bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) );
433 #endif
435 * For Each Line In The Source Pixmap
437 for ( tmp1 = yshift, SourceRow = 0,
438 dst = SCREENADDRESS( pWin, ( x + w ), y ) ;
439 SourceRow < height ;
440 tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
441 register unsigned bitPattern ;
442 if ( tmp1 >= (int)height )
443 tmp1 -= height ;
445 * For Each Time Pattern Repeats In The Y Dimension
447 xDst = dst;
448 for ( DestinationRow = SourceRow,
449 #ifndef PC98_EGC
450 bitPattern = getbits( NeedValX, width,
451 mastersrc
452 + ( tmp1 * paddedByteWidth ) ) ;
453 #else
454 #if 0
455 bitPattern = getbits( NeedValX, width,
456 mastersrc
457 + ( tmp1 * paddedByteWidth ) ) ;
458 #else
459 bitPattern = getbits_x( NeedValX, width,
460 mastersrc
461 + ( tmp1 * paddedByteWidth ), 0 ) ;
462 #endif
463 #endif
464 (int)DestinationRow < h ;
465 DestinationRow += height ) {
466 #ifndef PC98_EGC
467 /* Read To Save */
468 tmp2 = *( (VgaMemoryPtr) xDst) ;
469 #endif
470 /* Write Pattern */
471 #ifndef PC98_EGC
472 *( (VgaMemoryPtr) xDst ) = bitPattern ;
473 #else
474 *( (VgaMemoryPtr) xDst ) = bitPattern & bitmask;
475 #endif
476 xDst += scr_incr;
481 return ;
484 #define DO_RECURSE 0x10000
486 static void
487 vgaSetMonoRegisters
489 DrawablePtr pDrawable,
490 register unsigned long int plane_mask,
491 register unsigned long int desiredState
494 IOADDRESS REGBASE =
495 xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
496 #ifndef PC98_EGC
497 /* Setup VGA Registers */
499 * Set The Plane-Enable
501 SetVideoSequencer( Mask_MapIndex, plane_mask ) ;
502 SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ;
504 * Put Display Into SET-AND (i.e. Write Mode 3 )
506 SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
508 * Set The Color in The Set/Reset Register
510 SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ;
512 * Set The Vga's Alu Function
514 SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ;
515 #else /* PC98_EGC */
516 unsigned short ROP_value;
517 /* Setup VGA Registers */
519 * Set The Plane-Enable
521 outw(EGC_PLANE, ~plane_mask);
522 switch((desiredState >> 8)&0x18) {
523 /* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
524 case VGA_AND_MODE:
525 if (desiredState & DO_RECURSE)
526 ROP_value = EGC_AND_INV_MODE;
527 else
528 ROP_value = EGC_AND_MODE;
529 break;
530 case VGA_OR_MODE:
531 if (desiredState & DO_RECURSE)
532 ROP_value = EGC_OR_INV_MODE;
533 else
534 ROP_value = EGC_OR_MODE;
535 break;
536 case VGA_XOR_MODE:
537 if (desiredState & DO_RECURSE)
538 ROP_value = EGC_XOR_INV_MODE;
539 else
540 ROP_value = EGC_XOR_MODE;
541 break;
542 case VGA_COPY_MODE:
543 default:
544 ROP_value = EGC_COPY_MODE;
545 break;
547 outw(EGC_MODE, ROP_value);
548 outw(EGC_FGC, desiredState & VGA_ALLPLANES);
549 #endif
551 return ;
554 static unsigned long
555 vgaCalcMonoMode
557 int rasterOp,
558 register unsigned long int color
561 register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ;
562 register unsigned int invert_existing_data = 0 ;
564 /* Test The Raster-Op */
565 switch ( rasterOp ) {
566 case GXclear: /* 0x0 Zero 0 */
567 color = 0 ;
568 break ;
569 case GXinvert: /* 0xa NOT dst */
570 data_rotate_value = VGA_XOR_MODE << 8 ;
571 case GXset: /* 0xf 1 */
572 color = VGA_ALLPLANES ;
573 break ;
574 case GXnor: /* 0x8 NOT src AND NOT dst */
575 invert_existing_data = DO_RECURSE ;
576 case GXandInverted: /* 0x4 NOT src AND dst */
577 color = ~color ;
578 case GXand: /* 0x1 src AND dst */
579 data_rotate_value = VGA_AND_MODE << 8 ;
580 case GXcopy: /* 0x3 src */
581 break ;
582 case GXequiv: /* 0x9 NOT src XOR dst */
583 color = ~color ;
584 case GXxor: /* 0x6 src XOR dst */
585 data_rotate_value = VGA_XOR_MODE << 8 ;
586 break ;
587 case GXandReverse: /* 0x2 src AND NOT dst */
588 invert_existing_data = DO_RECURSE ;
589 data_rotate_value = VGA_AND_MODE << 8 ;
590 break ;
591 case GXorReverse: /* 0xb src OR NOT dst */
592 invert_existing_data = DO_RECURSE ;
593 data_rotate_value = VGA_OR_MODE << 8 ;
594 break ;
595 case GXnand: /* 0xe NOT src OR NOT dst */
596 invert_existing_data = DO_RECURSE ;
597 case GXorInverted: /* 0xd NOT src OR dst */
598 color = ~color ;
599 case GXor: /* 0x7 src OR dst */
600 data_rotate_value = VGA_OR_MODE << 8 ;
601 break ;
602 case GXcopyInverted: /* 0xc NOT src */
603 color = ~color ;
604 break ;
605 case GXnoop: /* 0x5 dst */
606 ; /* Shouldn't Get Here !! */
609 return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ;
612 static void
613 vgaDrawMonoImage
615 WindowPtr pWin, /* GJA */
616 unsigned char *data,
617 int x,
618 int y,
619 int w,
620 int h,
621 unsigned long int fg,
622 int alu,
623 unsigned long int planes
626 unsigned long regState ;
628 if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
629 xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes );
630 return;
633 if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
634 return ;
636 #ifndef PC98_EGC
637 if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
638 vgaDrawMonoImage( pWin, data, x, y, w, h,
639 VGA_ALLPLANES, GXinvert, planes ) ;
640 regState &= ~DO_RECURSE ;
642 #else
643 regState = vgaCalcMonoMode(alu, (char)fg);
644 #endif
647 vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
649 DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h,
650 w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ;
653 return ;
656 void
657 xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
658 WindowPtr pWin; /* GJA */
659 register PixmapPtr const pStipple ;
660 unsigned long int fg ;
661 const int alu ;
662 unsigned long int planes ;
663 int x, y, w, h ;
664 const int xSrc, ySrc ;
666 unsigned int width ;
667 unsigned int height ;
668 int xshift ;
669 int yshift ;
670 unsigned long regState ;
672 if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
673 xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes,
674 x, y, w, h, xSrc, ySrc );
675 return;
678 if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
679 return ;
681 #if 1
682 if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
683 xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes,
684 x, y, w, h, xSrc, ySrc ) ;
685 regState &= ~DO_RECURSE ;
687 #else
688 regState = vgaCalcMonoMode(alu, (char)fg);
689 #endif
692 vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
694 /* Figure Bit Offsets & Source Address */
695 width = pStipple->drawable.width ;
696 if ( ( xshift = ( x - xSrc ) ) < 0 )
697 xshift = width - ( ( - xshift ) % width ) ;
698 else
699 xshift %= width ;
700 if ( xshift == (int)width ) xshift = 0;
702 height = pStipple->drawable.height ;
703 if ( ( yshift = ( y - ySrc ) ) < 0 )
704 yshift = height - ( ( - yshift ) % height ) ;
705 else
706 yshift %= height ;
707 if ( yshift == (int)height ) yshift = 0;
709 (* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) (
710 pWin, w, x, y,
711 (const unsigned char *) pStipple->devPrivate.ptr,
713 width,
714 ( ( width + 31 ) & ((unsigned)(~31)) ) >> 3,
715 height,
716 xshift, yshift
719 return ;