Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / drawellipse.c
blobe15c09aee782fa46f6e559e94bb525b7df930b4d
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$ $Log
5 Desc: Graphics function DrawEllipse
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <clib/macros.h>
10 #include "graphics_intern.h"
11 #include <graphics/rastport.h>
12 #include "gfxfuncsupport.h"
13 #include "intregions.h"
15 struct ellipse_render_data
17 struct render_special_info rsi;
18 LONG a, b;
21 static ULONG ellipse_render(APTR ellipse_rd, LONG srcx, LONG srcy,
22 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
23 LONG x1, LONG y1, LONG x2, LONG y2, struct GfxBase *GfxBase);
25 /*****************************************************************************
27 NAME */
28 #include <graphics/rastport.h>
29 #include <proto/graphics.h>
31 AROS_LH5(void, DrawEllipse,
33 /* SYNOPSIS */
34 AROS_LHA(struct RastPort *, rp, A1),
35 AROS_LHA(LONG , xCenter, D0),
36 AROS_LHA(LONG , yCenter, D1),
37 AROS_LHA(LONG , a, D2),
38 AROS_LHA(LONG , b, D3),
40 /* LOCATION */
41 struct GfxBase *, GfxBase, 30, Graphics)
43 /* FUNCTION
44 Draw an ellipse
46 INPUTS
47 rp - destination RastPort
48 xCenter,yCenter - coordinate of centerpoint
49 a - radius in x direction
50 b - radius in y direction
52 RESULT
54 NOTES
56 EXAMPLE
58 BUGS
60 SEE ALSO
62 INTERNALS
64 HISTORY
65 29-10-95 digulla automatically created from
66 graphics_lib.fd and clib/graphics_protos.h
68 *****************************************************************************/
70 AROS_LIBFUNC_INIT
72 struct Rectangle rr;
73 struct ellipse_render_data erd;
75 if (!OBTAIN_DRIVERDATA(rp, GfxBase))
76 return;
78 FIX_GFXCOORD(xCenter);
79 FIX_GFXCOORD(yCenter);
80 FIX_GFXCOORD(a);
81 FIX_GFXCOORD(b);
83 /* bug("driver_DrawEllipse(%d %d %d %d)\n", xCenter, yCenter, a, b);
85 rr.MinX = xCenter - a;
86 rr.MinY = yCenter - b;
87 rr.MaxX = xCenter + a;
88 rr.MaxY = yCenter + b;
90 erd.a = a;
91 erd.b = b;
93 do_render_func(rp, NULL, &rr, ellipse_render, &erd, TRUE, TRUE, GfxBase);
95 RELEASE_DRIVERDATA(rp, GfxBase);
97 AROS_LIBFUNC_EXIT
99 } /* DrawEllipse */
101 /****************************************************************************************/
103 static ULONG ellipse_render(APTR ellipse_rd, LONG srcx, LONG srcy,
104 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
105 LONG x1, LONG y1, LONG x2, LONG y2, struct GfxBase *GfxBase)
107 struct ellipse_render_data *erd;
109 erd = (struct ellipse_render_data *)ellipse_rd;
111 HIDD_GC_SetClipRect(dst_gc, x1, y1, x2, y2);
113 HIDD_BM_DrawEllipse(dstbm_obj, dst_gc, erd->a + x1 - srcx, erd->b + y1 - srcy,
114 erd->a, erd->b);
116 HIDD_GC_UnsetClipRect(dst_gc);
118 return 0;
121 /****************************************************************************************/