2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 #include <hidd/graphics.h>
9 #include "graphics_intern.h"
12 #include <aros/debug.h>
14 /****************************************************************************************/
16 VOID
BM__Hidd_BitMap__FillMemRect8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect8
*msg
)
19 LONG phase
, width
, height
, w
, p
;
23 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
;
24 width
= msg
->maxX
- msg
->minX
+ 1;
25 height
= msg
->maxY
- msg
->minY
+ 1;
26 start_add
= msg
->dstMod
- width
;
28 if ((phase
= (IPTR
)start
& 3L))
31 if (phase
> width
) phase
= width
;
36 fill32
|= (fill32
<< 8);
37 fill32
|= (fill32
<< 16);
46 *start
++ = (UBYTE
)fill32
;
50 *((ULONG
*)start
) = fill32
;
55 *start
++ = (UBYTE
)fill32
;
62 /****************************************************************************************/
64 VOID
BM__Hidd_BitMap__FillMemRect16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect16
*msg
)
67 LONG phase
, width
, height
, w
, p
;
71 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 2;
72 width
= msg
->maxX
- msg
->minX
+ 1;
73 height
= msg
->maxY
- msg
->minY
+ 1;
74 start_add
= msg
->dstMod
- width
* 2;
76 if ((phase
= (IPTR
)start
& 1L))
79 if (phase
> width
) phase
= width
;
84 fill32
|= (fill32
<< 16);
93 *((UWORD
*)start
) = (UWORD
)fill32
;
98 *((ULONG
*)start
) = fill32
;
103 *((UWORD
*)start
) = (UWORD
)fill32
;
111 /****************************************************************************************/
113 VOID
BM__Hidd_BitMap__FillMemRect24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect24
*msg
)
116 LONG width
, height
, w
;
117 UBYTE fill1
, fill2
, fill3
;
120 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 3;
121 width
= msg
->maxX
- msg
->minX
+ 1;
122 height
= msg
->maxY
- msg
->minY
+ 1;
123 start_add
= msg
->dstMod
- width
* 3;
126 fill1
= (msg
->fill
>> 16) & 0xFF;
127 fill2
= (msg
->fill
>> 8) & 0xFF;
128 fill3
= msg
->fill
& 0xFF;
130 fill1
= msg
->fill
& 0xFF;
131 fill2
= (msg
->fill
>> 8) & 0xFF;
132 fill3
= (msg
->fill
>> 16) & 0xFF;
150 /****************************************************************************************/
152 VOID
BM__Hidd_BitMap__FillMemRect32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect32
*msg
)
155 LONG width
, height
, w
;
159 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 4;
160 width
= msg
->maxX
- msg
->minX
+ 1;
161 height
= msg
->maxY
- msg
->minY
+ 1;
162 start_add
= msg
->dstMod
- width
* 4;
172 *((ULONG
*)start
) = fill32
;
180 /****************************************************************************************/
182 VOID
BM__Hidd_BitMap__InvertMemRect(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_InvertMemRect
*msg
)
185 LONG phase
, width
, height
, w
, p
;
188 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
;
189 width
= msg
->maxX
- msg
->minX
+ 1;
190 height
= msg
->maxY
- msg
->minY
+ 1;
191 start_add
= msg
->dstMod
- width
;
193 if ((phase
= (IPTR
)start
& 3L))
196 if (phase
> width
) phase
= width
;
215 bg32
= *(ULONG
*)start
;
216 *((ULONG
*)start
) = ~bg32
;
229 /****************************************************************************************/
231 VOID
BM__Hidd_BitMap__CopyMemBox8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox8
*msg
)
233 UBYTE
*src_start
, *dst_start
;
234 LONG phase
, width
, height
, w
, p
;
235 ULONG src_start_add
, dst_start_add
;
239 height
= msg
->height
;
241 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
242 src_start_add
= msg
->srcMod
- width
;
244 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
;
245 dst_start_add
= msg
->dstMod
- width
;
247 if ((IPTR
)src_start
> (IPTR
)dst_start
)
249 if ((phase
= (IPTR
)src_start
& 3L))
252 if (phase
> width
) phase
= width
;
259 src_start
+= (height
- 1) * msg
->srcMod
+ width
;
260 dst_start
+= (height
- 1) * msg
->dstMod
+ width
;
262 phase
= ((IPTR
)src_start
& 3L);
263 if (phase
> width
) phase
= width
;
269 /* NOTE: This can write LONGs to odd addresses, which might not work
270 on some CPUs (MC68000) */
281 *dst_start
++ = *src_start
++;
285 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
286 w
-= 4; dst_start
+= 4; src_start
+= 4;
290 *dst_start
++ = *src_start
++;
292 src_start
+= src_start_add
;
293 dst_start
+= dst_start_add
;
305 *--dst_start
= *--src_start
;
309 dst_start
-= 4; src_start
-= 4;
310 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
315 *--dst_start
= *--src_start
;
317 src_start
-= src_start_add
;
318 dst_start
-= dst_start_add
;
324 /****************************************************************************************/
326 VOID
BM__Hidd_BitMap__CopyMemBox16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox16
*msg
)
328 UBYTE
*src_start
, *dst_start
;
329 LONG phase
, width
, height
, w
, p
;
330 ULONG src_start_add
, dst_start_add
;
334 height
= msg
->height
;
336 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 2;
337 src_start_add
= msg
->srcMod
- width
* 2;
339 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
340 dst_start_add
= msg
->dstMod
- width
* 2;
342 if ((IPTR
)src_start
> (IPTR
)dst_start
)
344 if ((phase
= (IPTR
)src_start
& 1L))
347 if (phase
> width
) phase
= width
;
354 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 2;
355 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 2;
357 phase
= ((IPTR
)src_start
& 1L);
358 if (phase
> width
) phase
= width
;
373 *((UWORD
*)dst_start
) = *((UWORD
*)src_start
);
374 dst_start
+= 2; src_start
+= 2;
378 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
379 w
-= 2; dst_start
+= 4; src_start
+= 4;
383 *((UWORD
*)dst_start
) = *((UWORD
*)src_start
);
384 dst_start
+= 2; src_start
+= 2;
386 src_start
+= src_start_add
;
387 dst_start
+= dst_start_add
;
399 dst_start
-= 2; src_start
-= 2;
400 *(UWORD
*)dst_start
= *(UWORD
*)src_start
;
404 dst_start
-= 4; src_start
-= 4;
405 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
410 dst_start
-= 2; src_start
-= 2;
411 *(UWORD
*)dst_start
= *(UWORD
*)src_start
;
413 src_start
-= src_start_add
;
414 dst_start
-= dst_start_add
;
420 /****************************************************************************************/
422 VOID
BM__Hidd_BitMap__CopyMemBox24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox24
*msg
)
424 UBYTE
*src_start
, *dst_start
;
425 LONG width
, height
, w
;
426 ULONG src_start_add
, dst_start_add
;
430 height
= msg
->height
;
432 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 3;
433 src_start_add
= msg
->srcMod
- width
* 3;
435 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
436 dst_start_add
= msg
->dstMod
- width
* 3;
438 if ((IPTR
)src_start
> (IPTR
)dst_start
)
444 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 3;
445 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 3;
458 *dst_start
++ = *src_start
++;
459 *dst_start
++ = *src_start
++;
460 *dst_start
++ = *src_start
++;
463 src_start
+= src_start_add
;
464 dst_start
+= dst_start_add
;
475 *--dst_start
= *--src_start
;
476 *--dst_start
= *--src_start
;
477 *--dst_start
= *--src_start
;
480 src_start
-= src_start_add
;
481 dst_start
-= dst_start_add
;
487 /****************************************************************************************/
489 VOID
BM__Hidd_BitMap__CopyMemBox32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox32
*msg
)
491 UBYTE
*src_start
, *dst_start
;
492 LONG width
, height
, w
;
493 ULONG src_start_add
, dst_start_add
;
497 height
= msg
->height
;
499 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 4;
500 src_start_add
= msg
->srcMod
- width
* 4;
502 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 4;
503 dst_start_add
= msg
->dstMod
- width
* 4;
505 if ((IPTR
)src_start
> (IPTR
)dst_start
)
511 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 4;
512 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 4;
525 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
526 dst_start
+= 4; src_start
+= 4;
529 src_start
+= src_start_add
;
530 dst_start
+= dst_start_add
;
541 dst_start
-= 4; src_start
-= 4;
542 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
545 src_start
-= src_start_add
;
546 dst_start
-= dst_start_add
;
552 /****************************************************************************************/
554 VOID
BM__Hidd_BitMap__CopyLUTMemBox16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox16
*msg
)
556 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
557 UBYTE
*src_start
, *dst_start
;
558 LONG width
, height
, w
;
559 ULONG src_start_add
, dst_start_add
;
564 height
= msg
->height
;
566 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
567 src_start_add
= msg
->srcMod
- width
;
569 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
570 dst_start_add
= msg
->dstMod
- width
* 2;
578 *(UWORD
*)dst_start
= (UWORD
)(pixlut
[*src_start
++]);
581 src_start
+= src_start_add
;
582 dst_start
+= dst_start_add
;
586 /****************************************************************************************/
588 VOID
BM__Hidd_BitMap__CopyLUTMemBox24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox24
*msg
)
590 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
591 UBYTE
*src_start
, *dst_start
;
592 LONG width
, height
, w
;
593 ULONG src_start_add
, dst_start_add
;
598 height
= msg
->height
;
600 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
601 src_start_add
= msg
->srcMod
- width
;
603 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
604 dst_start_add
= msg
->dstMod
- width
* 3;
612 HIDDT_Pixel pix
= pixlut
[*src_start
++];
615 *dst_start
++ = (pix
>> 16) & 0xFF;
616 *dst_start
++ = (pix
>> 8) & 0xFF;
617 *dst_start
++ = pix
& 0xFF;
619 *dst_start
++ = pix
& 0xFF;
620 *dst_start
++ = (pix
>> 8) & 0xFF;
621 *dst_start
++ = (pix
>> 16) & 0xFF;
624 src_start
+= src_start_add
;
625 dst_start
+= dst_start_add
;
629 /****************************************************************************************/
631 VOID
BM__Hidd_BitMap__CopyLUTMemBox32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox32
*msg
)
633 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
634 UBYTE
*src_start
, *dst_start
;
635 LONG width
, height
, w
;
636 ULONG src_start_add
, dst_start_add
;
641 height
= msg
->height
;
643 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
644 src_start_add
= msg
->srcMod
- width
;
646 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 4;
647 dst_start_add
= msg
->dstMod
- width
* 4;
655 *((ULONG
*)dst_start
) = (ULONG
)(pixlut
[*src_start
++]);
658 src_start
+= src_start_add
;
659 dst_start
+= dst_start_add
;
663 /****************************************************************************************/
665 VOID
BM__Hidd_BitMap__PutMem32Image8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image8
*msg
)
667 UBYTE
*src_start
, *dst_start
;
668 LONG width
, height
, w
;
669 ULONG src_start_add
, dst_start_add
;
672 height
= msg
->height
;
674 src_start
= msg
->src
;
675 src_start_add
= msg
->srcMod
- width
* 4;
677 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
;
678 dst_start_add
= msg
->dstMod
- width
;
686 *dst_start
++ = (UBYTE
)(*(ULONG
*)src_start
);
689 src_start
+= src_start_add
;
690 dst_start
+= dst_start_add
;
694 /****************************************************************************************/
696 VOID
BM__Hidd_BitMap__PutMem32Image16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image16
*msg
)
698 UBYTE
*src_start
, *dst_start
;
699 LONG width
, height
, w
;
700 ULONG src_start_add
, dst_start_add
;
703 height
= msg
->height
;
705 src_start
= msg
->src
;
706 src_start_add
= msg
->srcMod
- width
* 4;
708 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
709 dst_start_add
= msg
->dstMod
- width
* 2;
717 *(UWORD
*)dst_start
= (UWORD
)(*(ULONG
*)src_start
);
718 dst_start
+= 2; src_start
+= 4;
720 src_start
+= src_start_add
;
721 dst_start
+= dst_start_add
;
725 /****************************************************************************************/
727 VOID
BM__Hidd_BitMap__PutMem32Image24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image24
*msg
)
729 UBYTE
*src_start
, *dst_start
;
730 LONG width
, height
, w
;
731 ULONG src_start_add
, dst_start_add
;
734 height
= msg
->height
;
736 src_start
= msg
->src
;
737 src_start_add
= msg
->srcMod
- width
* 4;
739 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
740 dst_start_add
= msg
->dstMod
- width
* 3;
748 ULONG pix
= *(ULONG
*)src_start
;
753 *dst_start
++ = (pix
>> 16) & 0xFF;
754 *dst_start
++ = (pix
>> 8) & 0xFF;
755 *dst_start
++ = pix
& 0xFF;
757 *dst_start
++ = pix
& 0xFF;
758 *dst_start
++ = (pix
>> 8) & 0xFF;
759 *dst_start
++ = (pix
>> 16) & 0xFF;
763 src_start
+= src_start_add
;
764 dst_start
+= dst_start_add
;
768 /****************************************************************************************/
770 VOID
BM__Hidd_BitMap__GetMem32Image8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image8
*msg
)
772 UBYTE
*src_start
, *dst_start
;
773 LONG width
, height
, w
;
774 ULONG src_start_add
, dst_start_add
;
777 height
= msg
->height
;
779 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
780 src_start_add
= msg
->srcMod
- width
;
782 dst_start
= msg
->dst
;
783 dst_start_add
= msg
->dstMod
- width
* 4;
791 *(ULONG
*)dst_start
= (ULONG
)(*src_start
++);
794 src_start
+= src_start_add
;
795 dst_start
+= dst_start_add
;
799 /****************************************************************************************/
801 VOID
BM__Hidd_BitMap__GetMem32Image16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image16
*msg
)
803 UBYTE
*src_start
, *dst_start
;
804 LONG width
, height
, w
;
805 ULONG src_start_add
, dst_start_add
;
808 height
= msg
->height
;
810 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 2;
811 src_start_add
= msg
->srcMod
- width
* 2;
813 dst_start
= msg
->dst
;
814 dst_start_add
= msg
->dstMod
- width
* 4;
822 *(ULONG
*)dst_start
= (ULONG
)(*(UWORD
*)src_start
);
823 dst_start
+= 4; src_start
+= 2;
825 src_start
+= src_start_add
;
826 dst_start
+= dst_start_add
;
830 /****************************************************************************************/
832 VOID
BM__Hidd_BitMap__GetMem32Image24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image24
*msg
)
834 UBYTE
*src_start
, *dst_start
;
835 LONG width
, height
, w
;
836 ULONG src_start_add
, dst_start_add
;
839 height
= msg
->height
;
841 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 3;
842 src_start_add
= msg
->srcMod
- width
* 3;
844 dst_start
= msg
->dst
;
845 dst_start_add
= msg
->dstMod
- width
* 4;
853 UBYTE pix1
= *src_start
++;
854 UBYTE pix2
= *src_start
++;
855 UBYTE pix3
= *src_start
++;
858 *(ULONG
*)dst_start
= (pix1
<< 16) | (pix2
<< 8) | pix3
;
860 *(ULONG
*)dst_start
= (pix3
<< 16) | (pix2
<< 8) | pix1
;
865 src_start
+= src_start_add
;
866 dst_start
+= dst_start_add
;
870 /****************************************************************************************/
872 VOID
BM__Hidd_BitMap__PutMemTemplate8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate8
*msg
)
875 UBYTE
*bitarray
, *buf
;
877 OOP_Object
*gc
= msg
->gc
;
878 ULONG fg
= GC_FG(gc
);
879 ULONG bg
= GC_BG(gc
);
882 if (msg
->width
<= 0 || msg
->height
<= 0)
885 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
889 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
898 if (msg
->inverttemplate
) type
++;
900 bitarray
= msg
->template + ((msg
->srcx
/ 16) * 2);
901 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
903 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
;
905 for(y
= 0; y
< msg
->height
; y
++)
907 ULONG mask
= bitmask
;
908 UWORD
*array
= (UWORD
*)bitarray
;
909 UWORD bitword
= AROS_BE2WORD(*array
);
915 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
917 if (bitword
& mask
) *xbuf
= fg
;
924 bitword
= AROS_BE2WORD(*array
);
927 } /* for(x = 0; x < msg->width; x++) */
930 case 1: /* JAM1 | INVERSVID */
931 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
933 if (!(bitword
& mask
)) *xbuf
= fg
;
940 bitword
= AROS_BE2WORD(*array
);
943 } /* for(x = 0; x < msg->width; x++) */
946 case 2: /* COMPLEMENT */
947 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
949 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
956 bitword
= AROS_BE2WORD(*array
);
958 } /* for(x = 0; x < msg->width; x++) */
961 case 3: /* COMPLEMENT | INVERSVID*/
962 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
964 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
971 bitword
= AROS_BE2WORD(*array
);
973 } /* for(x = 0; x < msg->width; x++) */
977 for(x
= 0; x
< msg
->width
; x
++)
979 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
986 bitword
= AROS_BE2WORD(*array
);
989 } /* for(x = 0; x < msg->width; x++) */
992 case 5: /* JAM2 | INVERSVID */
993 for(x
= 0; x
< msg
->width
; x
++)
995 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1002 bitword
= AROS_BE2WORD(*array
);
1004 } /* for(x = 0; x < msg->width; x++) */
1007 } /* switch(type) */
1010 bitarray
+= msg
->modulo
;
1012 } /* for(y = 0; y < msg->height; y++) */
1015 /****************************************************************************************/
1017 VOID
BM__Hidd_BitMap__PutMemTemplate16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate16
*msg
)
1020 UBYTE
*bitarray
, *buf
;
1022 OOP_Object
*gc
= msg
->gc
;
1023 ULONG fg
= GC_FG(gc
);
1024 ULONG bg
= GC_BG(gc
);
1027 if (msg
->width
<= 0 || msg
->height
<= 0)
1030 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1034 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1043 if (msg
->inverttemplate
) type
++;
1045 bitarray
= msg
->template + ((msg
->srcx
/ 16) * 2);
1046 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1048 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 2;
1050 for(y
= 0; y
< msg
->height
; y
++)
1052 ULONG mask
= bitmask
;
1053 UWORD
*array
= (UWORD
*)bitarray
;
1054 UWORD bitword
= AROS_BE2WORD(*array
);
1055 UWORD
*xbuf
= (UWORD
*)buf
;
1060 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1062 if (bitword
& mask
) *xbuf
= fg
;
1069 bitword
= AROS_BE2WORD(*array
);
1072 } /* for(x = 0; x < msg->width; x++) */
1075 case 1: /* JAM1 | INVERSVID */
1076 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1078 if (!(bitword
& mask
)) *xbuf
= fg
;
1085 bitword
= AROS_BE2WORD(*array
);
1088 } /* for(x = 0; x < msg->width; x++) */
1091 case 2: /* COMPLEMENT */
1092 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1094 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
1101 bitword
= AROS_BE2WORD(*array
);
1103 } /* for(x = 0; x < msg->width; x++) */
1106 case 3: /* COMPLEMENT | INVERSVID*/
1107 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1109 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
1116 bitword
= AROS_BE2WORD(*array
);
1118 } /* for(x = 0; x < msg->width; x++) */
1122 for(x
= 0; x
< msg
->width
; x
++)
1124 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
1131 bitword
= AROS_BE2WORD(*array
);
1134 } /* for(x = 0; x < msg->width; x++) */
1137 case 5: /* JAM2 | INVERSVID */
1138 for(x
= 0; x
< msg
->width
; x
++)
1140 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1147 bitword
= AROS_BE2WORD(*array
);
1149 } /* for(x = 0; x < msg->width; x++) */
1152 } /* switch(type) */
1155 bitarray
+= msg
->modulo
;
1157 } /* for(y = 0; y < msg->height; y++) */
1161 /****************************************************************************************/
1163 VOID
BM__Hidd_BitMap__PutMemTemplate24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate24
*msg
)
1166 UBYTE
*bitarray
, *buf
;
1168 OOP_Object
*gc
= msg
->gc
;
1169 ULONG fg
= GC_FG(gc
);
1170 UBYTE fg1
, fg2
, fg3
;
1171 ULONG bg
= GC_BG(gc
);
1172 UBYTE bg1
, bg2
, bg3
;
1175 if (msg
->width
<= 0 || msg
->height
<= 0)
1179 fg1
= (fg
>> 16) & 0xFF;
1180 fg2
= (fg
>> 8) & 0xFF;
1183 bg1
= (bg
>> 16) & 0xFF;
1184 bg2
= (bg
>> 8) & 0xFF;
1188 fg2
= (fg
>> 8) & 0xFF;
1189 fg3
= (fg
>> 16) & 0xFF;
1192 bg2
= (bg
>> 8) & 0xFF;
1193 bg3
= (bg
>> 16) & 0xFF;
1196 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1200 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1209 if (msg
->inverttemplate
) type
++;
1211 bitarray
= msg
->template + ((msg
->srcx
/ 16) * 2);
1212 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1214 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 3;
1216 for(y
= 0; y
< msg
->height
; y
++)
1218 ULONG mask
= bitmask
;
1219 UWORD
*array
= (UWORD
*)bitarray
;
1220 UWORD bitword
= AROS_BE2WORD(*array
);
1226 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1240 bitword
= AROS_BE2WORD(*array
);
1243 } /* for(x = 0; x < msg->width; x++) */
1246 case 1: /* JAM1 | INVERSVID */
1247 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1249 if (!(bitword
& mask
))
1261 bitword
= AROS_BE2WORD(*array
);
1264 } /* for(x = 0; x < msg->width; x++) */
1267 case 2: /* COMPLEMENT */
1268 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1282 bitword
= AROS_BE2WORD(*array
);
1284 } /* for(x = 0; x < msg->width; x++) */
1287 case 3: /* COMPLEMENT | INVERSVID*/
1288 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1290 if (!(bitword
& mask
))
1302 bitword
= AROS_BE2WORD(*array
);
1304 } /* for(x = 0; x < msg->width; x++) */
1308 for(x
= 0; x
< msg
->width
; x
++)
1328 bitword
= AROS_BE2WORD(*array
);
1331 } /* for(x = 0; x < msg->width; x++) */
1334 case 5: /* JAM2 | INVERSVID */
1335 for(x
= 0; x
< msg
->width
; x
++)
1355 bitword
= AROS_BE2WORD(*array
);
1357 } /* for(x = 0; x < msg->width; x++) */
1360 } /* switch(type) */
1363 bitarray
+= msg
->modulo
;
1365 } /* for(y = 0; y < msg->height; y++) */
1369 /****************************************************************************************/
1371 VOID
BM__Hidd_BitMap__PutMemTemplate32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate32
*msg
)
1374 UBYTE
*bitarray
, *buf
;
1376 OOP_Object
*gc
= msg
->gc
;
1377 ULONG fg
= GC_FG(gc
);
1378 ULONG bg
= GC_BG(gc
);
1381 if (msg
->width
<= 0 || msg
->height
<= 0)
1384 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1388 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1397 if (msg
->inverttemplate
) type
++;
1399 bitarray
= msg
->template + ((msg
->srcx
/ 16) * 2);
1400 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1402 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 4;
1404 for(y
= 0; y
< msg
->height
; y
++)
1406 ULONG mask
= bitmask
;
1407 UWORD
*array
= (UWORD
*)bitarray
;
1408 UWORD bitword
= AROS_BE2WORD(*array
);
1409 ULONG
*xbuf
= (ULONG
*)buf
;
1414 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1416 if (bitword
& mask
) *xbuf
= fg
;
1423 bitword
= AROS_BE2WORD(*array
);
1426 } /* for(x = 0; x < msg->width; x++) */
1429 case 1: /* JAM1 | INVERSVID */
1430 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1432 if (!(bitword
& mask
)) *xbuf
= fg
;
1439 bitword
= AROS_BE2WORD(*array
);
1442 } /* for(x = 0; x < msg->width; x++) */
1445 case 2: /* COMPLEMENT */
1446 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1448 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
1455 bitword
= AROS_BE2WORD(*array
);
1457 } /* for(x = 0; x < msg->width; x++) */
1460 case 3: /* COMPLEMENT | INVERSVID*/
1461 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1463 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
1470 bitword
= AROS_BE2WORD(*array
);
1472 } /* for(x = 0; x < msg->width; x++) */
1476 for(x
= 0; x
< msg
->width
; x
++)
1478 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
1485 bitword
= AROS_BE2WORD(*array
);
1488 } /* for(x = 0; x < msg->width; x++) */
1491 case 5: /* JAM2 | INVERSVID */
1492 for(x
= 0; x
< msg
->width
; x
++)
1494 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1501 bitword
= AROS_BE2WORD(*array
);
1503 } /* for(x = 0; x < msg->width; x++) */
1506 } /* switch(type) */
1509 bitarray
+= msg
->modulo
;
1511 } /* for(y = 0; y < msg->height; y++) */
1515 /****************************************************************************************/
1517 VOID
BM__Hidd_BitMap__PutMemPattern8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern8
*msg
)
1520 UBYTE
*patarray
, *buf
, *maskarray
= 0;
1521 UWORD patmask
, maskmask
;
1522 OOP_Object
*gc
= msg
->gc
;
1523 ULONG fg
= GC_FG(gc
);
1524 ULONG bg
= GC_BG(gc
);
1527 if (msg
->width
<= 0 || msg
->height
<= 0)
1530 if (msg
->patterndepth
> 1)
1536 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1540 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1549 if (msg
->invertpattern
) type
++;
1552 patarray
= msg
->pattern
;
1553 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
1555 if ((maskarray
= msg
->mask
))
1557 maskarray
+= (msg
->masksrcx
/ 16) * 2;
1558 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
1561 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
;
1563 for(y
= 0; y
< msg
->height
; y
++)
1565 UWORD pmask
= patmask
;
1566 UWORD mmask
= maskmask
;
1567 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
1568 UWORD patword
= AROS_BE2WORD(*parray
);
1571 UBYTE
*xbuf
= (UBYTE
*)buf
;
1575 marray
= (UWORD
*)maskarray
;
1576 maskword
= AROS_BE2WORD(*marray
);
1582 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1584 if (!maskarray
|| (maskword
& mmask
))
1586 if (patword
& pmask
) *xbuf
= fg
;
1596 maskword
= AROS_BE2WORD(*marray
);
1601 if (!pmask
) pmask
= 0x8000;
1603 } /* for(x = 0; x < msg->width; x++) */
1606 case 1: /* JAM1 | INVERSVID */
1607 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1609 if (!maskarray
|| (maskword
& mmask
))
1611 if (!(patword
& pmask
)) *xbuf
= fg
;
1621 maskword
= AROS_BE2WORD(*marray
);
1626 if (!pmask
) pmask
= 0x8000;
1627 } /* for(x = 0; x < msg->width; x++) */
1630 case 2: /* COMPLEMENT */
1631 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1633 if (!maskarray
|| (maskword
& mmask
))
1635 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
1645 maskword
= AROS_BE2WORD(*marray
);
1650 if (!pmask
) pmask
= 0x8000;
1652 } /* for(x = 0; x < msg->width; x++) */
1655 case 3: /* COMPLEMENT | INVERSVID*/
1656 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1658 if (!maskarray
|| (maskword
& mmask
))
1660 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
1670 maskword
= AROS_BE2WORD(*marray
);
1675 if (!pmask
) pmask
= 0x8000;
1677 } /* for(x = 0; x < msg->width; x++) */
1681 for(x
= 0; x
< msg
->width
; x
++)
1683 if (!maskarray
|| (maskword
& mmask
))
1685 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
1695 maskword
= AROS_BE2WORD(*marray
);
1700 if (!pmask
) pmask
= 0x8000;
1702 } /* for(x = 0; x < msg->width; x++) */
1705 case 5: /* JAM2 | INVERSVID */
1706 for(x
= 0; x
< msg
->width
; x
++)
1708 if (!maskarray
|| (maskword
& mmask
))
1710 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
1720 maskword
= AROS_BE2WORD(*marray
);
1725 if (!pmask
) pmask
= 0x8000;
1727 } /* for(x = 0; x < msg->width; x++) */
1730 case 6: /* multi color pattern */
1731 for(x
= 0; x
< msg
->width
; x
++)
1733 if (!maskarray
|| (maskword
& mmask
))
1736 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
1738 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
1740 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
1741 UWORD _patword
= AROS_BE2WORD(*_parray
);
1743 if (_patword
& pmask
) pixel
|= 1L << plane
;
1746 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
1758 maskword
= AROS_BE2WORD(*marray
);
1763 if (!pmask
) pmask
= 0x8000;
1765 } /* for(x = 0; x < msg->width; x++) */
1768 } /* switch(type) */
1771 if (maskarray
) maskarray
+= msg
->maskmodulo
;
1773 } /* for(y = 0; y < msg->height; y++) */
1777 /****************************************************************************************/
1779 VOID
BM__Hidd_BitMap__PutMemPattern16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern16
*msg
)
1782 UBYTE
*patarray
, *buf
, *maskarray
= 0;
1783 UWORD patmask
, maskmask
;
1784 OOP_Object
*gc
= msg
->gc
;
1785 ULONG fg
= GC_FG(gc
);
1786 ULONG bg
= GC_BG(gc
);
1789 if (msg
->width
<= 0 || msg
->height
<= 0)
1792 if (msg
->patterndepth
> 1)
1798 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1802 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1811 if (msg
->invertpattern
) type
++;
1814 patarray
= msg
->pattern
;
1815 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
1817 if ((maskarray
= msg
->mask
))
1819 maskarray
+= (msg
->masksrcx
/ 16) * 2;
1820 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
1823 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 2;
1825 for(y
= 0; y
< msg
->height
; y
++)
1827 UWORD pmask
= patmask
;
1828 UWORD mmask
= maskmask
;
1829 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
1830 UWORD patword
= AROS_BE2WORD(*parray
);
1833 UWORD
*xbuf
= (UWORD
*)buf
;
1837 marray
= (UWORD
*)maskarray
;
1838 maskword
= AROS_BE2WORD(*marray
);
1844 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1846 if (!maskarray
|| (maskword
& mmask
))
1848 if (patword
& pmask
) *xbuf
= fg
;
1858 maskword
= AROS_BE2WORD(*marray
);
1863 if (!pmask
) pmask
= 0x8000;
1865 } /* for(x = 0; x < msg->width; x++) */
1868 case 1: /* JAM1 | INVERSVID */
1869 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1871 if (!maskarray
|| (maskword
& mmask
))
1873 if (!(patword
& pmask
)) *xbuf
= fg
;
1883 maskword
= AROS_BE2WORD(*marray
);
1888 if (!pmask
) pmask
= 0x8000;
1889 } /* for(x = 0; x < msg->width; x++) */
1892 case 2: /* COMPLEMENT */
1893 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1895 if (!maskarray
|| (maskword
& mmask
))
1897 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
1907 maskword
= AROS_BE2WORD(*marray
);
1912 if (!pmask
) pmask
= 0x8000;
1914 } /* for(x = 0; x < msg->width; x++) */
1917 case 3: /* COMPLEMENT | INVERSVID*/
1918 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1920 if (!maskarray
|| (maskword
& mmask
))
1922 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
1932 maskword
= AROS_BE2WORD(*marray
);
1937 if (!pmask
) pmask
= 0x8000;
1939 } /* for(x = 0; x < msg->width; x++) */
1943 for(x
= 0; x
< msg
->width
; x
++)
1945 if (!maskarray
|| (maskword
& mmask
))
1947 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
1957 maskword
= AROS_BE2WORD(*marray
);
1962 if (!pmask
) pmask
= 0x8000;
1964 } /* for(x = 0; x < msg->width; x++) */
1967 case 5: /* JAM2 | INVERSVID */
1968 for(x
= 0; x
< msg
->width
; x
++)
1970 if (!maskarray
|| (maskword
& mmask
))
1972 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
1982 maskword
= AROS_BE2WORD(*marray
);
1987 if (!pmask
) pmask
= 0x8000;
1989 } /* for(x = 0; x < msg->width; x++) */
1992 case 6: /* multi color pattern */
1993 for(x
= 0; x
< msg
->width
; x
++)
1995 if (!maskarray
|| (maskword
& mmask
))
1998 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
2000 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2002 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2003 UWORD _patword
= AROS_BE2WORD(*_parray
);
2005 if (_patword
& pmask
) pixel
|= 1L << plane
;
2008 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2020 maskword
= AROS_BE2WORD(*marray
);
2025 if (!pmask
) pmask
= 0x8000;
2027 } /* for(x = 0; x < msg->width; x++) */
2030 } /* switch(type) */
2033 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2035 } /* for(y = 0; y < msg->height; y++) */
2038 /****************************************************************************************/
2040 VOID
BM__Hidd_BitMap__PutMemPattern24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern24
*msg
)
2043 UBYTE
*patarray
, *buf
, *maskarray
= 0;
2044 UWORD patmask
, maskmask
;
2045 OOP_Object
*gc
= msg
->gc
;
2046 ULONG fg
= GC_FG(gc
);
2047 UBYTE fg1
, fg2
, fg3
;
2048 ULONG bg
= GC_BG(gc
);
2049 UBYTE bg1
, bg2
, bg3
;
2052 if (msg
->width
<= 0 || msg
->height
<= 0)
2056 fg1
= (fg
>> 16) & 0xFF;
2057 fg2
= (fg
>> 8) & 0xFF;
2060 bg1
= (bg
>> 16) & 0xFF;
2061 bg2
= (bg
>> 8) & 0xFF;
2065 fg2
= (fg
>> 8) & 0xFF;
2066 fg3
= (fg
>> 16) & 0xFF;
2069 bg2
= (bg
>> 8) & 0xFF;
2070 bg3
= (bg
>> 16) & 0xFF;
2073 if (msg
->patterndepth
> 1)
2079 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
2083 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
2092 if (msg
->invertpattern
) type
++;
2095 patarray
= msg
->pattern
;
2096 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
2098 if ((maskarray
= msg
->mask
))
2100 maskarray
+= (msg
->masksrcx
/ 16) * 2;
2101 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
2104 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 3;
2106 for(y
= 0; y
< msg
->height
; y
++)
2108 UWORD pmask
= patmask
;
2109 UWORD mmask
= maskmask
;
2110 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
2111 UWORD patword
= AROS_BE2WORD(*parray
);
2114 UBYTE
*xbuf
= (UBYTE
*)buf
;
2118 marray
= (UWORD
*)maskarray
;
2119 maskword
= AROS_BE2WORD(*marray
);
2125 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2127 if (!maskarray
|| (maskword
& mmask
))
2129 if (patword
& pmask
)
2144 maskword
= AROS_BE2WORD(*marray
);
2149 if (!pmask
) pmask
= 0x8000;
2151 } /* for(x = 0; x < msg->width; x++) */
2154 case 1: /* JAM1 | INVERSVID */
2155 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2157 if (!maskarray
|| (maskword
& mmask
))
2159 if (!(patword
& pmask
))
2175 maskword
= AROS_BE2WORD(*marray
);
2180 if (!pmask
) pmask
= 0x8000;
2181 } /* for(x = 0; x < msg->width; x++) */
2184 case 2: /* COMPLEMENT */
2185 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2187 if (!maskarray
|| (maskword
& mmask
))
2189 if (patword
& pmask
)
2204 maskword
= AROS_BE2WORD(*marray
);
2209 if (!pmask
) pmask
= 0x8000;
2211 } /* for(x = 0; x < msg->width; x++) */
2214 case 3: /* COMPLEMENT | INVERSVID*/
2215 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2217 if (!maskarray
|| (maskword
& mmask
))
2219 if (!(patword
& pmask
))
2234 maskword
= AROS_BE2WORD(*marray
);
2239 if (!pmask
) pmask
= 0x8000;
2241 } /* for(x = 0; x < msg->width; x++) */
2245 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2247 if (!maskarray
|| (maskword
& mmask
))
2249 if (patword
& pmask
)
2271 maskword
= AROS_BE2WORD(*marray
);
2276 if (!pmask
) pmask
= 0x8000;
2278 } /* for(x = 0; x < msg->width; x++) */
2281 case 5: /* JAM2 | INVERSVID */
2282 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2284 if (!maskarray
|| (maskword
& mmask
))
2286 if (patword
& pmask
)
2308 maskword
= AROS_BE2WORD(*marray
);
2313 if (!pmask
) pmask
= 0x8000;
2315 } /* for(x = 0; x < msg->width; x++) */
2318 case 6: /* multi color pattern */
2319 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2321 if (!maskarray
|| (maskword
& mmask
))
2324 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
2326 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2328 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2329 UWORD _patword
= AROS_BE2WORD(*_parray
);
2331 if (_patword
& pmask
) pixel
|= 1L << plane
;
2334 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2337 xbuf
[0] = (pixel
>> 16) & 0xFF;
2338 xbuf
[1] = (pixel
>> 8) & 0xFF;
2339 xbuf
[2] = (pixel
) & 0xFF;
2341 xbuf
[0] = (pixel
) & 0xFF;
2342 xbuf
[1] = (pixel
>> 8) & 0xFF;
2343 xbuf
[2] = (pixel
>> 16) & 0xFF;
2354 maskword
= AROS_BE2WORD(*marray
);
2359 if (!pmask
) pmask
= 0x8000;
2361 } /* for(x = 0; x < msg->width; x++) */
2364 } /* switch(type) */
2367 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2369 } /* for(y = 0; y < msg->height; y++) */
2373 /****************************************************************************************/
2375 VOID
BM__Hidd_BitMap__PutMemPattern32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern32
*msg
)
2378 UBYTE
*patarray
, *buf
, *maskarray
= 0;
2379 UWORD patmask
, maskmask
;
2380 OOP_Object
*gc
= msg
->gc
;
2381 ULONG fg
= GC_FG(gc
);
2382 ULONG bg
= GC_BG(gc
);
2385 if (msg
->width
<= 0 || msg
->height
<= 0)
2388 if (msg
->patterndepth
> 1)
2394 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
2398 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
2407 if (msg
->invertpattern
) type
++;
2410 patarray
= msg
->pattern
;
2411 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
2413 if ((maskarray
= msg
->mask
))
2415 maskarray
+= (msg
->masksrcx
/ 16) * 2;
2416 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
2419 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 4;
2421 for(y
= 0; y
< msg
->height
; y
++)
2423 UWORD pmask
= patmask
;
2424 UWORD mmask
= maskmask
;
2425 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
2426 UWORD patword
= AROS_BE2WORD(*parray
);
2429 ULONG
*xbuf
= (ULONG
*)buf
;
2433 marray
= (UWORD
*)maskarray
;
2434 maskword
= AROS_BE2WORD(*marray
);
2440 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2442 if (!maskarray
|| (maskword
& mmask
))
2444 if (patword
& pmask
) *xbuf
= fg
;
2454 maskword
= AROS_BE2WORD(*marray
);
2459 if (!pmask
) pmask
= 0x8000;
2461 } /* for(x = 0; x < msg->width; x++) */
2464 case 1: /* JAM1 | INVERSVID */
2465 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2467 if (!maskarray
|| (maskword
& mmask
))
2469 if (!(patword
& pmask
)) *xbuf
= fg
;
2479 maskword
= AROS_BE2WORD(*marray
);
2484 if (!pmask
) pmask
= 0x8000;
2485 } /* for(x = 0; x < msg->width; x++) */
2488 case 2: /* COMPLEMENT */
2489 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2491 if (!maskarray
|| (maskword
& mmask
))
2493 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
2503 maskword
= AROS_BE2WORD(*marray
);
2508 if (!pmask
) pmask
= 0x8000;
2510 } /* for(x = 0; x < msg->width; x++) */
2513 case 3: /* COMPLEMENT | INVERSVID*/
2514 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2516 if (!maskarray
|| (maskword
& mmask
))
2518 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
2528 maskword
= AROS_BE2WORD(*marray
);
2533 if (!pmask
) pmask
= 0x8000;
2535 } /* for(x = 0; x < msg->width; x++) */
2539 for(x
= 0; x
< msg
->width
; x
++)
2541 if (!maskarray
|| (maskword
& mmask
))
2543 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
2553 maskword
= AROS_BE2WORD(*marray
);
2558 if (!pmask
) pmask
= 0x8000;
2560 } /* for(x = 0; x < msg->width; x++) */
2563 case 5: /* JAM2 | INVERSVID */
2564 for(x
= 0; x
< msg
->width
; x
++)
2566 if (!maskarray
|| (maskword
& mmask
))
2568 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
2578 maskword
= AROS_BE2WORD(*marray
);
2583 if (!pmask
) pmask
= 0x8000;
2585 } /* for(x = 0; x < msg->width; x++) */
2588 case 6: /* multi color pattern */
2589 for(x
= 0; x
< msg
->width
; x
++)
2591 if (!maskarray
|| (maskword
& mmask
))
2594 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
2596 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2598 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2599 UWORD _patword
= AROS_BE2WORD(*_parray
);
2601 if (_patword
& pmask
) pixel
|= 1L << plane
;
2604 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2616 maskword
= AROS_BE2WORD(*marray
);
2621 if (!pmask
) pmask
= 0x8000;
2623 } /* for(x = 0; x < msg->width; x++) */
2626 } /* switch(type) */
2629 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2631 } /* for(y = 0; y < msg->height; y++) */
2635 /****************************************************************************************/