2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <proto/graphics.h>
11 #include <proto/oop.h>
12 #include "graphics_intern.h"
13 #include "gfxfuncsupport.h"
14 #include <proto/oop.h>
16 static ULONG
bltpattern_render(APTR bpr_data
, LONG srcx
, LONG srcy
,
17 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
18 LONG x1
, LONG y1
, LONG x2
, LONG y2
,
19 struct GfxBase
*GfxBase
);
23 HIDDT_PixelLUT pixlut
;
34 /*****************************************************************************
37 #include <clib/graphics_protos.h>
39 AROS_LH7(void, BltPattern
,
42 AROS_LHA(struct RastPort
*, rp
, A1
),
43 AROS_LHA(PLANEPTR
, mask
, A0
),
44 AROS_LHA(LONG
, xMin
, D0
),
45 AROS_LHA(LONG
, yMin
, D1
),
46 AROS_LHA(LONG
, xMax
, D2
),
47 AROS_LHA(LONG
, yMax
, D3
),
48 AROS_LHA(ULONG
, byteCnt
, D4
),
51 struct GfxBase
*, GfxBase
, 52, Graphics
)
54 Blit using drawmode, areafill pattern and mask.
57 rp - destination RastPort for blit.
58 mask - Mask bitplane. Set this to NULL for a rectangle.
59 xMin, yMin - upper left corner.
60 xMax, yMax - lower right corner.
61 byteCnt - BytesPerRow for mask.
76 27-11-96 digulla automatically created from
77 graphics_lib.fd and clib/graphics_protos.h
79 *****************************************************************************/
85 struct bp_render_data bprd
;
91 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
94 bprd
.pattern
= (UBYTE
*)rp
->AreaPtrn
;
96 bprd
.maskmodulo
= byteCnt
;
97 bprd
.patterndepth
= (rp
->AreaPtSz
>= 0) ? 1 : rp
->BitMap
->Depth
;
98 bprd
.patternheight
= 1L << ((rp
->AreaPtSz
>= 0) ? rp
->AreaPtSz
: -rp
->AreaPtSz
);
99 bprd
.renderx1
= xMin
- RP_PATORIGINX(rp
);
100 bprd
.rendery1
= yMin
- RP_PATORIGINY(rp
);
101 bprd
.invertpattern
= (rp
->DrawMode
& INVERSVID
) ? TRUE
: FALSE
;
102 bprd
.pixlut
.entries
= bprd
.patterndepth
;
103 bprd
.pixlut
.pixels
= IS_HIDD_BM(rp
->BitMap
) ? HIDD_BM_PIXTAB(rp
->BitMap
) : NULL
;
110 do_render_func(rp
, NULL
, &rr
, bltpattern_render
, &bprd
, FALSE
, GfxBase
);
112 RELEASE_DRIVERDATA(rp
, GfxBase
);
120 ULONG old_drawmode
= GetDrMd(rp
);
122 if ((old_drawmode
& ~INVERSVID
) == JAM2
)
123 SetDrMd(rp
, JAM1
| (old_drawmode
& INVERSVID
));
125 BltTemplate(mask
, 0, byteCnt
, rp
, xMin
, yMin
, xMax
- xMin
+ 1, yMax
- yMin
+ 1);
127 SetDrMd(rp
, old_drawmode
);
131 RectFill(rp
, xMin
, yMin
, xMax
, yMax
);
139 /****************************************************************************************/
141 static ULONG
bltpattern_render(APTR bpr_data
, LONG srcx
, LONG srcy
,
142 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
143 LONG x1
, LONG y1
, LONG x2
, LONG y2
,
144 struct GfxBase
*GfxBase
)
146 struct bp_render_data
*bprd
;
148 WORD patsrcx
, patsrcy
;
152 height
= y2
- y1
+ 1;
154 bprd
= (struct bp_render_data
*)bpr_data
;
156 mask
= bprd
->mask
+ bprd
->maskmodulo
* srcy
;
158 patsrcx
= (srcx
+ bprd
->renderx1
) % 16;
159 patsrcy
= (srcy
+ bprd
->rendery1
) % bprd
->patternheight
;
160 if (patsrcx
< 0) patsrcx
+= 16;
161 if (patsrcy
< 0) patsrcy
+= bprd
->patternheight
;
163 HIDD_BM_PutPattern(dstbm_obj
, dst_gc
, bprd
->pattern
,
166 bprd
->patternheight
, bprd
->patterndepth
,
178 return width
* height
;