2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function Draw()
9 #include <aros/debug.h>
10 #include <clib/macros.h>
11 #include <graphics/rastport.h>
12 #include <proto/graphics.h>
13 #include <proto/oop.h>
14 #include "gfxfuncsupport.h"
15 #include "graphics_intern.h"
16 #include "intregions.h"
19 struct draw_render_data
21 struct render_special_info rsi
;
25 static ULONG
draw_render(APTR draw_rd
, LONG srcx
, LONG srcy
,
26 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
27 LONG x1
, LONG y1
, LONG x2
, LONG y2
, struct GfxBase
*GfxBase
);
29 /*****************************************************************************
36 AROS_LHA(struct RastPort
*, rp
, A1
),
37 AROS_LHA(LONG
, x
, D0
),
38 AROS_LHA(LONG
, y
, D1
),
41 struct GfxBase
*, GfxBase
, 41, Graphics
)
44 Draw a line from the current pen position to the given coordinate.
47 rp - destination RastPort.
48 x,y - line end coordinate.
55 - handle layer->Scroll_X/Scroll_Y.
57 - handle FRST_DOT which indicates whether to draw
58 or to don't draw first pixel of line. Important
59 for COMPLEMENT drawmode.
70 29-10-95 digulla automatically created from
71 graphics_lib.fd and clib/graphics_protos.h
73 *****************************************************************************/
80 struct draw_render_data drd
;
84 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
93 gc
= GetDriverData(rp
)->dd_GC
;
118 UWORD lineptrn
= rp
->LinePtrn
;
120 if (rp
->DrawMode
& INVERSVID
) lineptrn
= ~lineptrn
;
123 struct TagItem gctags
[] =
125 {aHidd_GC_LinePattern
, lineptrn
},
126 {aHidd_GC_LinePatternCnt
, rp
->linpatcnt
},
130 OOP_SetAttrs( gc
, gctags
);
134 drd
.x1
= x1
- rr
.MinX
;
135 drd
.y1
= y1
- rr
.MinY
;
136 drd
.x2
= x
- rr
.MinX
;
137 drd
.y2
= y
- rr
.MinY
;
139 do_render_func(rp
, NULL
, &rr
, draw_render
, &drd
, TRUE
, TRUE
, GfxBase
);
141 dx
= (drd
.x2
> drd
.y2
) ? drd
.x2
: drd
.y2
;
143 rp
->linpatcnt
= ((LONG
)rp
->linpatcnt
- dx
) & 15;
148 RELEASE_DRIVERDATA(rp
, GfxBase
);
154 /****************************************************************************************/
156 static ULONG
draw_render(APTR draw_rd
, LONG srcx
, LONG srcy
,
157 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
158 LONG x1
, LONG y1
, LONG x2
, LONG y2
, struct GfxBase
*GfxBase
)
160 struct draw_render_data
*drd
;
164 height
= y2
- y1
+ 1;
166 drd
= (struct draw_render_data
*)draw_rd
;
168 HIDD_GC_SetClipRect(dst_gc
, x1
, y1
, x2
, y2
);
170 HIDD_BM_DrawLine(dstbm_obj
, dst_gc
, drd
->x1
+ x1
- srcx
,
173 drd
->y2
+ y1
- srcy
);
175 HIDD_GC_UnsetClipRect(dst_gc
);
180 /****************************************************************************************/