2 Copyright © 1995-2011, 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>
14 #include "gfxfuncsupport.h"
15 #include "graphics_intern.h"
16 #include "graphics_driver.h"
17 #include "intregions.h"
19 /****************************************************************************************/
21 struct draw_render_data
26 static ULONG
draw_render(APTR draw_rd
, WORD srcx
, WORD srcy
,
27 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
28 struct Rectangle
*rect
, struct GfxBase
*GfxBase
)
30 struct draw_render_data
*drd
= draw_rd
;
33 * This is a quick way to install ClipRect on a GC. Just set one pointer.
34 * This is why we have a struct Rectangle * in the GC.
36 GC_DOCLIP(dst_gc
) = rect
;
38 HIDD_BM_DrawLine(dstbm_obj
, dst_gc
, drd
->x1
+ rect
->MinX
- srcx
,
39 drd
->y1
+ rect
->MinY
- srcy
,
40 drd
->x2
+ rect
->MinX
- srcx
,
41 drd
->y2
+ rect
->MinY
- srcy
);
44 * After we exit this routine, 'rect' will be not valid any more.
45 * So do not forget to reset the pointer!
47 GC_DOCLIP(dst_gc
) = NULL
;
52 /*****************************************************************************
59 AROS_LHA(struct RastPort
*, rp
, A1
),
60 AROS_LHA(WORD
, x
, D0
),
61 AROS_LHA(WORD
, y
, D1
),
64 struct GfxBase
*, GfxBase
, 41, Graphics
)
67 Draw a line from the current pen position to the given coordinate.
70 rp - destination RastPort.
71 x,y - line end coordinate.
78 - handle layer->Scroll_X/Scroll_Y.
80 - handle FRST_DOT which indicates whether to draw
81 or to don't draw first pixel of line. Important
82 for COMPLEMENT drawmode.
93 29-10-95 digulla automatically created from
94 graphics_lib.fd and clib/graphics_protos.h
96 *****************************************************************************/
102 struct draw_render_data drd
;
134 gc
= GetDriverData(rp
, GfxBase
);
136 /* Only Draw() uses line pattern attributes, so we set them only here */
137 GC_LINEPAT(gc
) = (rp
->DrawMode
& INVERSVID
) ? ~rp
->LinePtrn
: rp
->LinePtrn
;
138 GC_LINEPATCNT(gc
) = rp
->linpatcnt
;
140 drd
.x1
= x1
- rr
.MinX
;
141 drd
.y1
= y1
- rr
.MinY
;
142 drd
.x2
= x
- rr
.MinX
;
143 drd
.y2
= y
- rr
.MinY
;
145 D(bug("[Draw] (%d, %d) to (%d, %d)\n", rp
->cp_x
, rp
->cp_y
, x
, y
));
146 D(bug("[Draw] RastPort 0x%p, Flags 0x%04X, GC 0x%p, FG 0x%08lX, BG 0x%08lX\n", rp
, rp
->Flags
, gc
, GC_FG(gc
), GC_BG(gc
)));
148 do_render_with_gc(rp
, NULL
, &rr
, draw_render
, &drd
, gc
, TRUE
, FALSE
, GfxBase
);
150 dx
= (drd
.x2
> drd
.y2
) ? drd
.x2
: drd
.y2
;
152 rp
->linpatcnt
= ((LONG
)rp
->linpatcnt
- dx
) & 15;