2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
10 #include "gfx_intern.h"
11 #include "gfx_debug.h"
13 /****************************************************************************************/
15 VOID
BM__Hidd_BitMap__FillMemRect8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect8
*msg
)
18 LONG phase
, width
, height
, w
, p
;
22 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
;
23 width
= msg
->maxX
- msg
->minX
+ 1;
24 height
= msg
->maxY
- msg
->minY
+ 1;
25 start_add
= msg
->dstMod
- width
;
27 if ((phase
= (IPTR
)start
& 3L))
30 if (phase
> width
) phase
= width
;
35 fill32
|= (fill32
<< 8);
36 fill32
|= (fill32
<< 16);
45 *start
++ = (UBYTE
)fill32
;
49 *((ULONG
*)start
) = fill32
;
54 *start
++ = (UBYTE
)fill32
;
61 /****************************************************************************************/
63 VOID
BM__Hidd_BitMap__FillMemRect16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect16
*msg
)
66 LONG phase
, width
, height
, w
, p
;
70 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 2;
71 width
= msg
->maxX
- msg
->minX
+ 1;
72 height
= msg
->maxY
- msg
->minY
+ 1;
73 start_add
= msg
->dstMod
- width
* 2;
75 if ((phase
= (IPTR
)start
& 1L))
78 if (phase
> width
) phase
= width
;
83 fill32
|= (fill32
<< 16);
92 *((UWORD
*)start
) = (UWORD
)fill32
;
97 *((ULONG
*)start
) = fill32
;
102 *((UWORD
*)start
) = (UWORD
)fill32
;
110 /****************************************************************************************/
112 VOID
BM__Hidd_BitMap__FillMemRect24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect24
*msg
)
115 LONG width
, height
, w
;
116 UBYTE fill1
, fill2
, fill3
;
119 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 3;
120 width
= msg
->maxX
- msg
->minX
+ 1;
121 height
= msg
->maxY
- msg
->minY
+ 1;
122 start_add
= msg
->dstMod
- width
* 3;
125 fill1
= (msg
->fill
>> 16) & 0xFF;
126 fill2
= (msg
->fill
>> 8) & 0xFF;
127 fill3
= msg
->fill
& 0xFF;
129 fill1
= msg
->fill
& 0xFF;
130 fill2
= (msg
->fill
>> 8) & 0xFF;
131 fill3
= (msg
->fill
>> 16) & 0xFF;
149 /****************************************************************************************/
151 VOID
BM__Hidd_BitMap__FillMemRect32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_FillMemRect32
*msg
)
154 LONG width
, height
, w
;
158 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
* 4;
159 width
= msg
->maxX
- msg
->minX
+ 1;
160 height
= msg
->maxY
- msg
->minY
+ 1;
161 start_add
= msg
->dstMod
- width
* 4;
171 *((ULONG
*)start
) = fill32
;
179 /****************************************************************************************/
181 VOID
BM__Hidd_BitMap__InvertMemRect(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_InvertMemRect
*msg
)
184 LONG phase
, width
, height
, w
, p
;
187 start
= msg
->dstBuf
+ msg
->minY
* msg
->dstMod
+ msg
->minX
;
188 width
= msg
->maxX
- msg
->minX
+ 1;
189 height
= msg
->maxY
- msg
->minY
+ 1;
190 start_add
= msg
->dstMod
- width
;
192 if ((phase
= (IPTR
)start
& 3L))
195 if (phase
> width
) phase
= width
;
214 bg32
= *(ULONG
*)start
;
215 *((ULONG
*)start
) = ~bg32
;
228 /****************************************************************************************/
230 VOID
BM__Hidd_BitMap__CopyMemBox8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox8
*msg
)
232 UBYTE
*src_start
, *dst_start
;
233 LONG phase
, width
, height
, w
, p
;
234 ULONG src_start_add
, dst_start_add
;
238 height
= msg
->height
;
240 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
241 src_start_add
= msg
->srcMod
- width
;
243 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
;
244 dst_start_add
= msg
->dstMod
- width
;
246 if ((IPTR
)src_start
> (IPTR
)dst_start
)
248 if ((phase
= (IPTR
)src_start
& 3L))
251 if (phase
> width
) phase
= width
;
258 src_start
+= (height
- 1) * msg
->srcMod
+ width
;
259 dst_start
+= (height
- 1) * msg
->dstMod
+ width
;
261 phase
= ((IPTR
)src_start
& 3L);
262 if (phase
> width
) phase
= width
;
268 /* NOTE: This can write LONGs to odd addresses, which might not work
269 on some CPUs (MC68000) */
280 *dst_start
++ = *src_start
++;
284 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
285 w
-= 4; dst_start
+= 4; src_start
+= 4;
289 *dst_start
++ = *src_start
++;
291 src_start
+= src_start_add
;
292 dst_start
+= dst_start_add
;
304 *--dst_start
= *--src_start
;
308 dst_start
-= 4; src_start
-= 4;
309 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
314 *--dst_start
= *--src_start
;
316 src_start
-= src_start_add
;
317 dst_start
-= dst_start_add
;
323 /****************************************************************************************/
325 VOID
BM__Hidd_BitMap__CopyMemBox16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox16
*msg
)
327 UBYTE
*src_start
, *dst_start
;
328 LONG phase
, width
, height
, w
, p
;
329 ULONG src_start_add
, dst_start_add
;
333 height
= msg
->height
;
335 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 2;
336 src_start_add
= msg
->srcMod
- width
* 2;
338 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
339 dst_start_add
= msg
->dstMod
- width
* 2;
341 if ((IPTR
)src_start
> (IPTR
)dst_start
)
343 if ((phase
= (IPTR
)src_start
& 1L))
346 if (phase
> width
) phase
= width
;
353 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 2;
354 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 2;
356 phase
= ((IPTR
)src_start
& 1L);
357 if (phase
> width
) phase
= width
;
372 *((UWORD
*)dst_start
) = *((UWORD
*)src_start
);
373 dst_start
+= 2; src_start
+= 2;
377 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
378 w
-= 2; dst_start
+= 4; src_start
+= 4;
382 *((UWORD
*)dst_start
) = *((UWORD
*)src_start
);
383 dst_start
+= 2; src_start
+= 2;
385 src_start
+= src_start_add
;
386 dst_start
+= dst_start_add
;
398 dst_start
-= 2; src_start
-= 2;
399 *(UWORD
*)dst_start
= *(UWORD
*)src_start
;
403 dst_start
-= 4; src_start
-= 4;
404 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
409 dst_start
-= 2; src_start
-= 2;
410 *(UWORD
*)dst_start
= *(UWORD
*)src_start
;
412 src_start
-= src_start_add
;
413 dst_start
-= dst_start_add
;
419 /****************************************************************************************/
421 VOID
BM__Hidd_BitMap__CopyMemBox24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox24
*msg
)
423 UBYTE
*src_start
, *dst_start
;
424 LONG width
, height
, w
;
425 ULONG src_start_add
, dst_start_add
;
429 height
= msg
->height
;
431 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 3;
432 src_start_add
= msg
->srcMod
- width
* 3;
434 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
435 dst_start_add
= msg
->dstMod
- width
* 3;
437 if ((IPTR
)src_start
> (IPTR
)dst_start
)
443 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 3;
444 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 3;
457 *dst_start
++ = *src_start
++;
458 *dst_start
++ = *src_start
++;
459 *dst_start
++ = *src_start
++;
462 src_start
+= src_start_add
;
463 dst_start
+= dst_start_add
;
474 *--dst_start
= *--src_start
;
475 *--dst_start
= *--src_start
;
476 *--dst_start
= *--src_start
;
479 src_start
-= src_start_add
;
480 dst_start
-= dst_start_add
;
486 /****************************************************************************************/
488 VOID
BM__Hidd_BitMap__CopyMemBox32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyMemBox32
*msg
)
490 UBYTE
*src_start
, *dst_start
;
491 LONG width
, height
, w
;
492 ULONG src_start_add
, dst_start_add
;
496 height
= msg
->height
;
498 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 4;
499 src_start_add
= msg
->srcMod
- width
* 4;
501 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 4;
502 dst_start_add
= msg
->dstMod
- width
* 4;
504 if ((IPTR
)src_start
> (IPTR
)dst_start
)
510 src_start
+= (height
- 1) * msg
->srcMod
+ width
* 4;
511 dst_start
+= (height
- 1) * msg
->dstMod
+ width
* 4;
524 *((ULONG
*)dst_start
) = *((ULONG
*)src_start
);
525 dst_start
+= 4; src_start
+= 4;
528 src_start
+= src_start_add
;
529 dst_start
+= dst_start_add
;
540 dst_start
-= 4; src_start
-= 4;
541 *(ULONG
*)dst_start
= *(ULONG
*)src_start
;
544 src_start
-= src_start_add
;
545 dst_start
-= dst_start_add
;
551 /****************************************************************************************/
553 VOID
BM__Hidd_BitMap__CopyLUTMemBox16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox16
*msg
)
555 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
556 UBYTE
*src_start
, *dst_start
;
557 LONG width
, height
, w
;
558 ULONG src_start_add
, dst_start_add
;
563 height
= msg
->height
;
565 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
566 src_start_add
= msg
->srcMod
- width
;
568 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
569 dst_start_add
= msg
->dstMod
- width
* 2;
577 *(UWORD
*)dst_start
= (UWORD
)(pixlut
[*src_start
++]);
580 src_start
+= src_start_add
;
581 dst_start
+= dst_start_add
;
585 /****************************************************************************************/
587 VOID
BM__Hidd_BitMap__CopyLUTMemBox24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox24
*msg
)
589 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
590 UBYTE
*src_start
, *dst_start
;
591 LONG width
, height
, w
;
592 ULONG src_start_add
, dst_start_add
;
597 height
= msg
->height
;
599 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
600 src_start_add
= msg
->srcMod
- width
;
602 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
603 dst_start_add
= msg
->dstMod
- width
* 3;
611 HIDDT_Pixel pix
= pixlut
[*src_start
++];
614 *dst_start
++ = (pix
>> 16) & 0xFF;
615 *dst_start
++ = (pix
>> 8) & 0xFF;
616 *dst_start
++ = pix
& 0xFF;
618 *dst_start
++ = pix
& 0xFF;
619 *dst_start
++ = (pix
>> 8) & 0xFF;
620 *dst_start
++ = (pix
>> 16) & 0xFF;
623 src_start
+= src_start_add
;
624 dst_start
+= dst_start_add
;
628 /****************************************************************************************/
630 VOID
BM__Hidd_BitMap__CopyLUTMemBox32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_CopyLUTMemBox32
*msg
)
632 HIDDT_Pixel
*pixlut
= msg
->pixlut
->pixels
;
633 UBYTE
*src_start
, *dst_start
;
634 LONG width
, height
, w
;
635 ULONG src_start_add
, dst_start_add
;
640 height
= msg
->height
;
642 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
643 src_start_add
= msg
->srcMod
- width
;
645 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 4;
646 dst_start_add
= msg
->dstMod
- width
* 4;
654 *((ULONG
*)dst_start
) = (ULONG
)(pixlut
[*src_start
++]);
657 src_start
+= src_start_add
;
658 dst_start
+= dst_start_add
;
662 /****************************************************************************************/
664 VOID
BM__Hidd_BitMap__PutMem32Image8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image8
*msg
)
666 UBYTE
*src_start
, *dst_start
;
667 LONG width
, height
, w
;
668 ULONG src_start_add
, dst_start_add
;
671 height
= msg
->height
;
673 src_start
= msg
->src
;
674 src_start_add
= msg
->srcMod
- width
* 4;
676 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
;
677 dst_start_add
= msg
->dstMod
- width
;
685 *dst_start
++ = (UBYTE
)(*(ULONG
*)src_start
);
688 src_start
+= src_start_add
;
689 dst_start
+= dst_start_add
;
693 /****************************************************************************************/
695 VOID
BM__Hidd_BitMap__PutMem32Image16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image16
*msg
)
697 UBYTE
*src_start
, *dst_start
;
698 LONG width
, height
, w
;
699 ULONG src_start_add
, dst_start_add
;
702 height
= msg
->height
;
704 src_start
= msg
->src
;
705 src_start_add
= msg
->srcMod
- width
* 4;
707 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 2;
708 dst_start_add
= msg
->dstMod
- width
* 2;
716 *(UWORD
*)dst_start
= (UWORD
)(*(ULONG
*)src_start
);
717 dst_start
+= 2; src_start
+= 4;
719 src_start
+= src_start_add
;
720 dst_start
+= dst_start_add
;
724 /****************************************************************************************/
726 VOID
BM__Hidd_BitMap__PutMem32Image24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMem32Image24
*msg
)
728 UBYTE
*src_start
, *dst_start
;
729 LONG width
, height
, w
;
730 ULONG src_start_add
, dst_start_add
;
733 height
= msg
->height
;
735 src_start
= msg
->src
;
736 src_start_add
= msg
->srcMod
- width
* 4;
738 dst_start
= msg
->dst
+ msg
->dstY
* msg
->dstMod
+ msg
->dstX
* 3;
739 dst_start_add
= msg
->dstMod
- width
* 3;
747 ULONG pix
= *(ULONG
*)src_start
;
752 *dst_start
++ = (pix
>> 16) & 0xFF;
753 *dst_start
++ = (pix
>> 8) & 0xFF;
754 *dst_start
++ = pix
& 0xFF;
756 *dst_start
++ = pix
& 0xFF;
757 *dst_start
++ = (pix
>> 8) & 0xFF;
758 *dst_start
++ = (pix
>> 16) & 0xFF;
762 src_start
+= src_start_add
;
763 dst_start
+= dst_start_add
;
767 /****************************************************************************************/
769 VOID
BM__Hidd_BitMap__GetMem32Image8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image8
*msg
)
771 UBYTE
*src_start
, *dst_start
;
772 LONG width
, height
, w
;
773 ULONG src_start_add
, dst_start_add
;
776 height
= msg
->height
;
778 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
;
779 src_start_add
= msg
->srcMod
- width
;
781 dst_start
= msg
->dst
;
782 dst_start_add
= msg
->dstMod
- width
* 4;
790 *(ULONG
*)dst_start
= (ULONG
)(*src_start
++);
793 src_start
+= src_start_add
;
794 dst_start
+= dst_start_add
;
798 /****************************************************************************************/
800 VOID
BM__Hidd_BitMap__GetMem32Image16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image16
*msg
)
802 UBYTE
*src_start
, *dst_start
;
803 LONG width
, height
, w
;
804 ULONG src_start_add
, dst_start_add
;
807 height
= msg
->height
;
809 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 2;
810 src_start_add
= msg
->srcMod
- width
* 2;
812 dst_start
= msg
->dst
;
813 dst_start_add
= msg
->dstMod
- width
* 4;
821 *(ULONG
*)dst_start
= (ULONG
)(*(UWORD
*)src_start
);
822 dst_start
+= 4; src_start
+= 2;
824 src_start
+= src_start_add
;
825 dst_start
+= dst_start_add
;
829 /****************************************************************************************/
831 VOID
BM__Hidd_BitMap__GetMem32Image24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetMem32Image24
*msg
)
833 UBYTE
*src_start
, *dst_start
;
834 LONG width
, height
, w
;
835 ULONG src_start_add
, dst_start_add
;
838 height
= msg
->height
;
840 src_start
= msg
->src
+ msg
->srcY
* msg
->srcMod
+ msg
->srcX
* 3;
841 src_start_add
= msg
->srcMod
- width
* 3;
843 dst_start
= msg
->dst
;
844 dst_start_add
= msg
->dstMod
- width
* 4;
852 UBYTE pix1
= *src_start
++;
853 UBYTE pix2
= *src_start
++;
854 UBYTE pix3
= *src_start
++;
857 *(ULONG
*)dst_start
= (pix1
<< 16) | (pix2
<< 8) | pix3
;
859 *(ULONG
*)dst_start
= (pix3
<< 16) | (pix2
<< 8) | pix1
;
864 src_start
+= src_start_add
;
865 dst_start
+= dst_start_add
;
869 /****************************************************************************************/
871 VOID
BM__Hidd_BitMap__PutMemTemplate8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate8
*msg
)
874 UBYTE
*bitarray
, *buf
;
876 OOP_Object
*gc
= msg
->gc
;
877 ULONG fg
= GC_FG(gc
);
878 ULONG bg
= GC_BG(gc
);
881 if (msg
->width
<= 0 || msg
->height
<= 0)
884 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
888 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
897 if (msg
->inverttemplate
) type
++;
899 bitarray
= msg
->masktemplate
+ ((msg
->srcx
/ 16) * 2);
900 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
902 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
;
904 for(y
= 0; y
< msg
->height
; y
++)
906 ULONG mask
= bitmask
;
907 UWORD
*array
= (UWORD
*)bitarray
;
908 UWORD bitword
= AROS_BE2WORD(*array
);
914 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
916 if (bitword
& mask
) *xbuf
= fg
;
923 bitword
= AROS_BE2WORD(*array
);
926 } /* for(x = 0; x < msg->width; x++) */
929 case 1: /* JAM1 | INVERSVID */
930 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
932 if (!(bitword
& mask
)) *xbuf
= fg
;
939 bitword
= AROS_BE2WORD(*array
);
942 } /* for(x = 0; x < msg->width; x++) */
945 case 2: /* COMPLEMENT */
946 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
948 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
955 bitword
= AROS_BE2WORD(*array
);
957 } /* for(x = 0; x < msg->width; x++) */
960 case 3: /* COMPLEMENT | INVERSVID*/
961 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
963 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
970 bitword
= AROS_BE2WORD(*array
);
972 } /* for(x = 0; x < msg->width; x++) */
976 for(x
= 0; x
< msg
->width
; x
++)
978 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
985 bitword
= AROS_BE2WORD(*array
);
988 } /* for(x = 0; x < msg->width; x++) */
991 case 5: /* JAM2 | INVERSVID */
992 for(x
= 0; x
< msg
->width
; x
++)
994 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1001 bitword
= AROS_BE2WORD(*array
);
1003 } /* for(x = 0; x < msg->width; x++) */
1006 } /* switch(type) */
1009 bitarray
+= msg
->modulo
;
1011 } /* for(y = 0; y < msg->height; y++) */
1014 /****************************************************************************************/
1016 VOID
BM__Hidd_BitMap__PutMemTemplate16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate16
*msg
)
1019 UBYTE
*bitarray
, *buf
;
1021 OOP_Object
*gc
= msg
->gc
;
1022 ULONG fg
= GC_FG(gc
);
1023 ULONG bg
= GC_BG(gc
);
1026 if (msg
->width
<= 0 || msg
->height
<= 0)
1029 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1033 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1042 if (msg
->inverttemplate
) type
++;
1044 bitarray
= msg
->masktemplate
+ ((msg
->srcx
/ 16) * 2);
1045 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1047 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 2;
1049 for(y
= 0; y
< msg
->height
; y
++)
1051 ULONG mask
= bitmask
;
1052 UWORD
*array
= (UWORD
*)bitarray
;
1053 UWORD bitword
= AROS_BE2WORD(*array
);
1054 UWORD
*xbuf
= (UWORD
*)buf
;
1059 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1061 if (bitword
& mask
) *xbuf
= fg
;
1068 bitword
= AROS_BE2WORD(*array
);
1071 } /* for(x = 0; x < msg->width; x++) */
1074 case 1: /* JAM1 | INVERSVID */
1075 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1077 if (!(bitword
& mask
)) *xbuf
= fg
;
1084 bitword
= AROS_BE2WORD(*array
);
1087 } /* for(x = 0; x < msg->width; x++) */
1090 case 2: /* COMPLEMENT */
1091 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1093 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
1100 bitword
= AROS_BE2WORD(*array
);
1102 } /* for(x = 0; x < msg->width; x++) */
1105 case 3: /* COMPLEMENT | INVERSVID*/
1106 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1108 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
1115 bitword
= AROS_BE2WORD(*array
);
1117 } /* for(x = 0; x < msg->width; x++) */
1121 for(x
= 0; x
< msg
->width
; x
++)
1123 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
1130 bitword
= AROS_BE2WORD(*array
);
1133 } /* for(x = 0; x < msg->width; x++) */
1136 case 5: /* JAM2 | INVERSVID */
1137 for(x
= 0; x
< msg
->width
; x
++)
1139 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1146 bitword
= AROS_BE2WORD(*array
);
1148 } /* for(x = 0; x < msg->width; x++) */
1151 } /* switch(type) */
1154 bitarray
+= msg
->modulo
;
1156 } /* for(y = 0; y < msg->height; y++) */
1160 /****************************************************************************************/
1162 VOID
BM__Hidd_BitMap__PutMemTemplate24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate24
*msg
)
1165 UBYTE
*bitarray
, *buf
;
1167 OOP_Object
*gc
= msg
->gc
;
1168 ULONG fg
= GC_FG(gc
);
1169 UBYTE fg1
, fg2
, fg3
;
1170 ULONG bg
= GC_BG(gc
);
1171 UBYTE bg1
, bg2
, bg3
;
1174 if (msg
->width
<= 0 || msg
->height
<= 0)
1178 fg1
= (fg
>> 16) & 0xFF;
1179 fg2
= (fg
>> 8) & 0xFF;
1182 bg1
= (bg
>> 16) & 0xFF;
1183 bg2
= (bg
>> 8) & 0xFF;
1187 fg2
= (fg
>> 8) & 0xFF;
1188 fg3
= (fg
>> 16) & 0xFF;
1191 bg2
= (bg
>> 8) & 0xFF;
1192 bg3
= (bg
>> 16) & 0xFF;
1195 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1199 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1208 if (msg
->inverttemplate
) type
++;
1210 bitarray
= msg
->masktemplate
+ ((msg
->srcx
/ 16) * 2);
1211 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1213 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 3;
1215 for(y
= 0; y
< msg
->height
; y
++)
1217 ULONG mask
= bitmask
;
1218 UWORD
*array
= (UWORD
*)bitarray
;
1219 UWORD bitword
= AROS_BE2WORD(*array
);
1225 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1239 bitword
= AROS_BE2WORD(*array
);
1242 } /* for(x = 0; x < msg->width; x++) */
1245 case 1: /* JAM1 | INVERSVID */
1246 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1248 if (!(bitword
& mask
))
1260 bitword
= AROS_BE2WORD(*array
);
1263 } /* for(x = 0; x < msg->width; x++) */
1266 case 2: /* COMPLEMENT */
1267 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1281 bitword
= AROS_BE2WORD(*array
);
1283 } /* for(x = 0; x < msg->width; x++) */
1286 case 3: /* COMPLEMENT | INVERSVID*/
1287 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
1289 if (!(bitword
& mask
))
1301 bitword
= AROS_BE2WORD(*array
);
1303 } /* for(x = 0; x < msg->width; x++) */
1307 for(x
= 0; x
< msg
->width
; x
++)
1327 bitword
= AROS_BE2WORD(*array
);
1330 } /* for(x = 0; x < msg->width; x++) */
1333 case 5: /* JAM2 | INVERSVID */
1334 for(x
= 0; x
< msg
->width
; x
++)
1354 bitword
= AROS_BE2WORD(*array
);
1356 } /* for(x = 0; x < msg->width; x++) */
1359 } /* switch(type) */
1362 bitarray
+= msg
->modulo
;
1364 } /* for(y = 0; y < msg->height; y++) */
1368 /****************************************************************************************/
1370 VOID
BM__Hidd_BitMap__PutMemTemplate32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemTemplate32
*msg
)
1373 UBYTE
*bitarray
, *buf
;
1375 OOP_Object
*gc
= msg
->gc
;
1376 ULONG fg
= GC_FG(gc
);
1377 ULONG bg
= GC_BG(gc
);
1380 if (msg
->width
<= 0 || msg
->height
<= 0)
1383 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1387 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1396 if (msg
->inverttemplate
) type
++;
1398 bitarray
= msg
->masktemplate
+ ((msg
->srcx
/ 16) * 2);
1399 bitmask
= 0x8000 >> (msg
->srcx
& 0xF);
1401 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 4;
1403 for(y
= 0; y
< msg
->height
; y
++)
1405 ULONG mask
= bitmask
;
1406 UWORD
*array
= (UWORD
*)bitarray
;
1407 UWORD bitword
= AROS_BE2WORD(*array
);
1408 ULONG
*xbuf
= (ULONG
*)buf
;
1413 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1415 if (bitword
& mask
) *xbuf
= fg
;
1422 bitword
= AROS_BE2WORD(*array
);
1425 } /* for(x = 0; x < msg->width; x++) */
1428 case 1: /* JAM1 | INVERSVID */
1429 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1431 if (!(bitword
& mask
)) *xbuf
= fg
;
1438 bitword
= AROS_BE2WORD(*array
);
1441 } /* for(x = 0; x < msg->width; x++) */
1444 case 2: /* COMPLEMENT */
1445 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1447 if (bitword
& mask
) *xbuf
= ~(*xbuf
);
1454 bitword
= AROS_BE2WORD(*array
);
1456 } /* for(x = 0; x < msg->width; x++) */
1459 case 3: /* COMPLEMENT | INVERSVID*/
1460 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1462 if (!(bitword
& mask
)) *xbuf
= ~(*xbuf
);
1469 bitword
= AROS_BE2WORD(*array
);
1471 } /* for(x = 0; x < msg->width; x++) */
1475 for(x
= 0; x
< msg
->width
; x
++)
1477 *xbuf
++ = (bitword
& mask
) ? fg
: bg
;
1484 bitword
= AROS_BE2WORD(*array
);
1487 } /* for(x = 0; x < msg->width; x++) */
1490 case 5: /* JAM2 | INVERSVID */
1491 for(x
= 0; x
< msg
->width
; x
++)
1493 *xbuf
++ = (bitword
& mask
) ? bg
: fg
;
1500 bitword
= AROS_BE2WORD(*array
);
1502 } /* for(x = 0; x < msg->width; x++) */
1505 } /* switch(type) */
1508 bitarray
+= msg
->modulo
;
1510 } /* for(y = 0; y < msg->height; y++) */
1514 /****************************************************************************************/
1516 VOID
BM__Hidd_BitMap__PutMemPattern8(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern8
*msg
)
1519 UBYTE
*patarray
, *buf
, *maskarray
= 0;
1520 UWORD patmask
, maskmask
= 0;
1521 OOP_Object
*gc
= msg
->gc
;
1522 ULONG fg
= GC_FG(gc
);
1523 ULONG bg
= GC_BG(gc
);
1526 if (msg
->width
<= 0 || msg
->height
<= 0)
1529 if (msg
->patterndepth
> 1)
1535 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1539 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1548 if (msg
->invertpattern
) type
++;
1551 patarray
= msg
->pattern
;
1552 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
1554 if ((maskarray
= msg
->mask
))
1556 maskarray
+= (msg
->masksrcx
/ 16) * 2;
1557 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
1560 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
;
1562 for(y
= 0; y
< msg
->height
; y
++)
1564 UWORD pmask
= patmask
;
1565 UWORD mmask
= maskmask
;
1566 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
1567 UWORD patword
= AROS_BE2WORD(*parray
);
1568 UWORD
*marray
= NULL
;
1570 UBYTE
*xbuf
= (UBYTE
*)buf
;
1574 marray
= (UWORD
*)maskarray
;
1575 maskword
= AROS_BE2WORD(*marray
);
1581 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1583 if (!maskarray
|| (maskword
& mmask
))
1585 if (patword
& pmask
) *xbuf
= fg
;
1595 maskword
= AROS_BE2WORD(*marray
);
1600 if (!pmask
) pmask
= 0x8000;
1602 } /* for(x = 0; x < msg->width; x++) */
1605 case 1: /* JAM1 | INVERSVID */
1606 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1608 if (!maskarray
|| (maskword
& mmask
))
1610 if (!(patword
& pmask
)) *xbuf
= fg
;
1620 maskword
= AROS_BE2WORD(*marray
);
1625 if (!pmask
) pmask
= 0x8000;
1626 } /* for(x = 0; x < msg->width; x++) */
1629 case 2: /* COMPLEMENT */
1630 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1632 if (!maskarray
|| (maskword
& mmask
))
1634 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
1644 maskword
= AROS_BE2WORD(*marray
);
1649 if (!pmask
) pmask
= 0x8000;
1651 } /* for(x = 0; x < msg->width; x++) */
1654 case 3: /* COMPLEMENT | INVERSVID*/
1655 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1657 if (!maskarray
|| (maskword
& mmask
))
1659 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
1669 maskword
= AROS_BE2WORD(*marray
);
1674 if (!pmask
) pmask
= 0x8000;
1676 } /* for(x = 0; x < msg->width; x++) */
1680 for(x
= 0; x
< msg
->width
; x
++)
1682 if (!maskarray
|| (maskword
& mmask
))
1684 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
1694 maskword
= AROS_BE2WORD(*marray
);
1699 if (!pmask
) pmask
= 0x8000;
1701 } /* for(x = 0; x < msg->width; x++) */
1704 case 5: /* JAM2 | INVERSVID */
1705 for(x
= 0; x
< msg
->width
; x
++)
1707 if (!maskarray
|| (maskword
& mmask
))
1709 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
1719 maskword
= AROS_BE2WORD(*marray
);
1724 if (!pmask
) pmask
= 0x8000;
1726 } /* for(x = 0; x < msg->width; x++) */
1729 case 6: /* multi color pattern */
1730 for(x
= 0; x
< msg
->width
; x
++)
1732 if (!maskarray
|| (maskword
& mmask
))
1735 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
1737 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
1739 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
1740 UWORD _patword
= AROS_BE2WORD(*_parray
);
1742 if (_patword
& pmask
) pixel
|= 1L << plane
;
1745 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
1757 maskword
= AROS_BE2WORD(*marray
);
1762 if (!pmask
) pmask
= 0x8000;
1764 } /* for(x = 0; x < msg->width; x++) */
1767 } /* switch(type) */
1770 if (maskarray
) maskarray
+= msg
->maskmodulo
;
1772 } /* for(y = 0; y < msg->height; y++) */
1776 /****************************************************************************************/
1778 VOID
BM__Hidd_BitMap__PutMemPattern16(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern16
*msg
)
1781 UBYTE
*patarray
, *buf
, *maskarray
= 0;
1782 UWORD patmask
, maskmask
= 0;
1783 OOP_Object
*gc
= msg
->gc
;
1784 ULONG fg
= GC_FG(gc
);
1785 ULONG bg
= GC_BG(gc
);
1788 if (msg
->width
<= 0 || msg
->height
<= 0)
1791 if (msg
->patterndepth
> 1)
1797 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
1801 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
1810 if (msg
->invertpattern
) type
++;
1813 patarray
= msg
->pattern
;
1814 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
1816 if ((maskarray
= msg
->mask
))
1818 maskarray
+= (msg
->masksrcx
/ 16) * 2;
1819 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
1822 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 2;
1824 for(y
= 0; y
< msg
->height
; y
++)
1826 UWORD pmask
= patmask
;
1827 UWORD mmask
= maskmask
;
1828 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
1829 UWORD patword
= AROS_BE2WORD(*parray
);
1830 UWORD
*marray
= NULL
;
1832 UWORD
*xbuf
= (UWORD
*)buf
;
1836 marray
= (UWORD
*)maskarray
;
1837 maskword
= AROS_BE2WORD(*marray
);
1843 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1845 if (!maskarray
|| (maskword
& mmask
))
1847 if (patword
& pmask
) *xbuf
= fg
;
1857 maskword
= AROS_BE2WORD(*marray
);
1862 if (!pmask
) pmask
= 0x8000;
1864 } /* for(x = 0; x < msg->width; x++) */
1867 case 1: /* JAM1 | INVERSVID */
1868 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1870 if (!maskarray
|| (maskword
& mmask
))
1872 if (!(patword
& pmask
)) *xbuf
= fg
;
1882 maskword
= AROS_BE2WORD(*marray
);
1887 if (!pmask
) pmask
= 0x8000;
1888 } /* for(x = 0; x < msg->width; x++) */
1891 case 2: /* COMPLEMENT */
1892 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1894 if (!maskarray
|| (maskword
& mmask
))
1896 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
1906 maskword
= AROS_BE2WORD(*marray
);
1911 if (!pmask
) pmask
= 0x8000;
1913 } /* for(x = 0; x < msg->width; x++) */
1916 case 3: /* COMPLEMENT | INVERSVID*/
1917 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
1919 if (!maskarray
|| (maskword
& mmask
))
1921 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
1931 maskword
= AROS_BE2WORD(*marray
);
1936 if (!pmask
) pmask
= 0x8000;
1938 } /* for(x = 0; x < msg->width; x++) */
1942 for(x
= 0; x
< msg
->width
; x
++)
1944 if (!maskarray
|| (maskword
& mmask
))
1946 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
1956 maskword
= AROS_BE2WORD(*marray
);
1961 if (!pmask
) pmask
= 0x8000;
1963 } /* for(x = 0; x < msg->width; x++) */
1966 case 5: /* JAM2 | INVERSVID */
1967 for(x
= 0; x
< msg
->width
; x
++)
1969 if (!maskarray
|| (maskword
& mmask
))
1971 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
1981 maskword
= AROS_BE2WORD(*marray
);
1986 if (!pmask
) pmask
= 0x8000;
1988 } /* for(x = 0; x < msg->width; x++) */
1991 case 6: /* multi color pattern */
1992 for(x
= 0; x
< msg
->width
; x
++)
1994 if (!maskarray
|| (maskword
& mmask
))
1997 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
1999 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2001 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2002 UWORD _patword
= AROS_BE2WORD(*_parray
);
2004 if (_patword
& pmask
) pixel
|= 1L << plane
;
2007 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2019 maskword
= AROS_BE2WORD(*marray
);
2024 if (!pmask
) pmask
= 0x8000;
2026 } /* for(x = 0; x < msg->width; x++) */
2029 } /* switch(type) */
2032 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2034 } /* for(y = 0; y < msg->height; y++) */
2037 /****************************************************************************************/
2039 VOID
BM__Hidd_BitMap__PutMemPattern24(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern24
*msg
)
2042 UBYTE
*patarray
, *buf
, *maskarray
= 0;
2043 UWORD patmask
, maskmask
= 0;
2044 OOP_Object
*gc
= msg
->gc
;
2045 ULONG fg
= GC_FG(gc
);
2046 UBYTE fg1
, fg2
, fg3
;
2047 ULONG bg
= GC_BG(gc
);
2048 UBYTE bg1
, bg2
, bg3
;
2051 if (msg
->width
<= 0 || msg
->height
<= 0)
2055 fg1
= (fg
>> 16) & 0xFF;
2056 fg2
= (fg
>> 8) & 0xFF;
2059 bg1
= (bg
>> 16) & 0xFF;
2060 bg2
= (bg
>> 8) & 0xFF;
2064 fg2
= (fg
>> 8) & 0xFF;
2065 fg3
= (fg
>> 16) & 0xFF;
2068 bg2
= (bg
>> 8) & 0xFF;
2069 bg3
= (bg
>> 16) & 0xFF;
2072 if (msg
->patterndepth
> 1)
2078 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
2082 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
2091 if (msg
->invertpattern
) type
++;
2094 patarray
= msg
->pattern
;
2095 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
2097 if ((maskarray
= msg
->mask
))
2099 maskarray
+= (msg
->masksrcx
/ 16) * 2;
2100 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
2103 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 3;
2105 for(y
= 0; y
< msg
->height
; y
++)
2107 UWORD pmask
= patmask
;
2108 UWORD mmask
= maskmask
;
2109 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
2110 UWORD patword
= AROS_BE2WORD(*parray
);
2111 UWORD
*marray
= NULL
;
2113 UBYTE
*xbuf
= (UBYTE
*)buf
;
2117 marray
= (UWORD
*)maskarray
;
2118 maskword
= AROS_BE2WORD(*marray
);
2124 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2126 if (!maskarray
|| (maskword
& mmask
))
2128 if (patword
& pmask
)
2143 maskword
= AROS_BE2WORD(*marray
);
2148 if (!pmask
) pmask
= 0x8000;
2150 } /* for(x = 0; x < msg->width; x++) */
2153 case 1: /* JAM1 | INVERSVID */
2154 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2156 if (!maskarray
|| (maskword
& mmask
))
2158 if (!(patword
& pmask
))
2174 maskword
= AROS_BE2WORD(*marray
);
2179 if (!pmask
) pmask
= 0x8000;
2180 } /* for(x = 0; x < msg->width; x++) */
2183 case 2: /* COMPLEMENT */
2184 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2186 if (!maskarray
|| (maskword
& mmask
))
2188 if (patword
& pmask
)
2203 maskword
= AROS_BE2WORD(*marray
);
2208 if (!pmask
) pmask
= 0x8000;
2210 } /* for(x = 0; x < msg->width; x++) */
2213 case 3: /* COMPLEMENT | INVERSVID*/
2214 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2216 if (!maskarray
|| (maskword
& mmask
))
2218 if (!(patword
& pmask
))
2233 maskword
= AROS_BE2WORD(*marray
);
2238 if (!pmask
) pmask
= 0x8000;
2240 } /* for(x = 0; x < msg->width; x++) */
2244 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2246 if (!maskarray
|| (maskword
& mmask
))
2248 if (patword
& pmask
)
2270 maskword
= AROS_BE2WORD(*marray
);
2275 if (!pmask
) pmask
= 0x8000;
2277 } /* for(x = 0; x < msg->width; x++) */
2280 case 5: /* JAM2 | INVERSVID */
2281 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2283 if (!maskarray
|| (maskword
& mmask
))
2285 if (patword
& pmask
)
2307 maskword
= AROS_BE2WORD(*marray
);
2312 if (!pmask
) pmask
= 0x8000;
2314 } /* for(x = 0; x < msg->width; x++) */
2317 case 6: /* multi color pattern */
2318 for(x
= 0; x
< msg
->width
; x
++, xbuf
+= 3)
2320 if (!maskarray
|| (maskword
& mmask
))
2323 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
2325 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2327 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2328 UWORD _patword
= AROS_BE2WORD(*_parray
);
2330 if (_patword
& pmask
) pixel
|= 1L << plane
;
2333 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2336 xbuf
[0] = (pixel
>> 16) & 0xFF;
2337 xbuf
[1] = (pixel
>> 8) & 0xFF;
2338 xbuf
[2] = (pixel
) & 0xFF;
2340 xbuf
[0] = (pixel
) & 0xFF;
2341 xbuf
[1] = (pixel
>> 8) & 0xFF;
2342 xbuf
[2] = (pixel
>> 16) & 0xFF;
2353 maskword
= AROS_BE2WORD(*marray
);
2358 if (!pmask
) pmask
= 0x8000;
2360 } /* for(x = 0; x < msg->width; x++) */
2363 } /* switch(type) */
2366 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2368 } /* for(y = 0; y < msg->height; y++) */
2372 /****************************************************************************************/
2374 VOID
BM__Hidd_BitMap__PutMemPattern32(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutMemPattern32
*msg
)
2377 UBYTE
*patarray
, *buf
, *maskarray
= 0;
2378 UWORD patmask
, maskmask
= 0;
2379 OOP_Object
*gc
= msg
->gc
;
2380 ULONG fg
= GC_FG(gc
);
2381 ULONG bg
= GC_BG(gc
);
2384 if (msg
->width
<= 0 || msg
->height
<= 0)
2387 if (msg
->patterndepth
> 1)
2393 if (GC_COLEXP(gc
) == vHidd_GC_ColExp_Transparent
)
2397 else if (GC_DRMD(gc
) == vHidd_GC_DrawMode_Invert
)
2406 if (msg
->invertpattern
) type
++;
2409 patarray
= msg
->pattern
;
2410 patmask
= 0x8000 >> (msg
->patternsrcx
& 0xF);
2412 if ((maskarray
= msg
->mask
))
2414 maskarray
+= (msg
->masksrcx
/ 16) * 2;
2415 maskmask
= 0x8000 >> (msg
->masksrcx
& 0xF);
2418 buf
= msg
->dst
+ msg
->y
* msg
->dstMod
+ msg
->x
* 4;
2420 for(y
= 0; y
< msg
->height
; y
++)
2422 UWORD pmask
= patmask
;
2423 UWORD mmask
= maskmask
;
2424 UWORD
*parray
= ((UWORD
*)patarray
) + ((y
+ msg
->patternsrcy
) % msg
->patternheight
);
2425 UWORD patword
= AROS_BE2WORD(*parray
);
2426 UWORD
*marray
= NULL
;
2428 ULONG
*xbuf
= (ULONG
*)buf
;
2432 marray
= (UWORD
*)maskarray
;
2433 maskword
= AROS_BE2WORD(*marray
);
2439 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2441 if (!maskarray
|| (maskword
& mmask
))
2443 if (patword
& pmask
) *xbuf
= fg
;
2453 maskword
= AROS_BE2WORD(*marray
);
2458 if (!pmask
) pmask
= 0x8000;
2460 } /* for(x = 0; x < msg->width; x++) */
2463 case 1: /* JAM1 | INVERSVID */
2464 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2466 if (!maskarray
|| (maskword
& mmask
))
2468 if (!(patword
& pmask
)) *xbuf
= fg
;
2478 maskword
= AROS_BE2WORD(*marray
);
2483 if (!pmask
) pmask
= 0x8000;
2484 } /* for(x = 0; x < msg->width; x++) */
2487 case 2: /* COMPLEMENT */
2488 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2490 if (!maskarray
|| (maskword
& mmask
))
2492 if (patword
& pmask
) *xbuf
= ~(*xbuf
);
2502 maskword
= AROS_BE2WORD(*marray
);
2507 if (!pmask
) pmask
= 0x8000;
2509 } /* for(x = 0; x < msg->width; x++) */
2512 case 3: /* COMPLEMENT | INVERSVID*/
2513 for(x
= 0; x
< msg
->width
; x
++, xbuf
++)
2515 if (!maskarray
|| (maskword
& mmask
))
2517 if (!(patword
& pmask
)) *xbuf
= ~(*xbuf
);
2527 maskword
= AROS_BE2WORD(*marray
);
2532 if (!pmask
) pmask
= 0x8000;
2534 } /* for(x = 0; x < msg->width; x++) */
2538 for(x
= 0; x
< msg
->width
; x
++)
2540 if (!maskarray
|| (maskword
& mmask
))
2542 xbuf
[x
] = (patword
& pmask
) ? fg
: bg
;
2552 maskword
= AROS_BE2WORD(*marray
);
2557 if (!pmask
) pmask
= 0x8000;
2559 } /* for(x = 0; x < msg->width; x++) */
2562 case 5: /* JAM2 | INVERSVID */
2563 for(x
= 0; x
< msg
->width
; x
++)
2565 if (!maskarray
|| (maskword
& mmask
))
2567 xbuf
[x
] = (patword
& pmask
) ? bg
: fg
;
2577 maskword
= AROS_BE2WORD(*marray
);
2582 if (!pmask
) pmask
= 0x8000;
2584 } /* for(x = 0; x < msg->width; x++) */
2587 case 6: /* multi color pattern */
2588 for(x
= 0; x
< msg
->width
; x
++)
2590 if (!maskarray
|| (maskword
& mmask
))
2593 ULONG pixel
= (patword
& pmask
) ? 1 : 0;
2595 for(plane
= 1; plane
< msg
->patterndepth
; plane
++)
2597 UWORD
*_parray
= parray
+ plane
* msg
->patternheight
;
2598 UWORD _patword
= AROS_BE2WORD(*_parray
);
2600 if (_patword
& pmask
) pixel
|= 1L << plane
;
2603 if (msg
->patternlut
) pixel
= msg
->patternlut
->pixels
[pixel
];
2615 maskword
= AROS_BE2WORD(*marray
);
2620 if (!pmask
) pmask
= 0x8000;
2622 } /* for(x = 0; x < msg->width; x++) */
2625 } /* switch(type) */
2628 if (maskarray
) maskarray
+= msg
->maskmodulo
;
2630 } /* for(y = 0; y < msg->height; y++) */
2634 /****************************************************************************************/