]> git.sur5r.net Git - cc65/blobdiff - libsrc/tgi/tgi_arc.c
Added '_' prefix to sin and cos.
[cc65] / libsrc / tgi / tgi_arc.c
index 1ce239fc499c067bbb31f94b534c3eba4fa3efe6..c0baabbde9c47daa0cdc62092a9f010052fd9d3b 100644 (file)
@@ -34,6 +34,7 @@
 
 
 #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;
@@ -81,16 +70,16 @@ void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
     }
 
     /* 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;