#include <tgi.h>
+#include <tgi/tgi-kernel.h>
#include <cc65.h>
-static int RoundMul (int rhs, int lhs)
-{
- long res = cc65_imul16x16r32 (rhs, lhs);
- if ((unsigned char)res & 0x80) {
- return (int)(res >> 8) + 1;
- } else {
- return (int)(res >> 8);
- }
-}
-
-
-
void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
unsigned sa, unsigned ea)
/* Draw an ellipse arc with center at x/y and radii rx/ry using the current
- * drawing color. The arc covers the angle between sa and ea (startangle and
- * endangle), which must be in the range 0..360 (otherwise the function may
- * bevave unextectedly).
- */
+** drawing color. The arc covers the angle between sa and ea (startangle and
+** endangle), which must be in the range 0..360 (otherwise the function may
+** bevave unextectedly).
+*/
{
int x1, y1, x2, y2;
unsigned char inc;
}
/* Calculate the start coords */
- x1 = x + RoundMul (rx, cc65_cos (sa));
- y1 = y + RoundMul (ry, cc65_sin (sa));
+ x1 = x + tgi_imulround (rx, _cos (sa));
+ y1 = y - tgi_imulround (ry, _sin (sa));
do {
sa += inc;
if (sa >= ea) {
sa = ea;
done = 1;
}
- x2 = x + RoundMul (rx, cc65_cos (sa));
- y2 = y - RoundMul (ry, cc65_sin (sa));
+ x2 = x + tgi_imulround (rx, _cos (sa));
+ y2 = y - tgi_imulround (ry, _sin (sa));
tgi_line (x1, y1, x2, y2);
x1 = x2;
y1 = y2;