From 5843a450bc27de3118808c1aece5accfab7b3ef0 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 23 Mar 2018 23:09:24 +0000 Subject: Android: Using xlib shortcut to draw circles and ellipses. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12790 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Android/Fl_Android_Graphics_Driver.H | 2 +- src/drivers/Android/Fl_Android_Graphics_Driver.cxx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.H b/src/drivers/Android/Fl_Android_Graphics_Driver.H index 2458d6569..eebd05db1 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Driver.H +++ b/src/drivers/Android/Fl_Android_Graphics_Driver.H @@ -86,6 +86,7 @@ public: virtual void polygon_unscaled(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) override; virtual void arc_unscaled(float x, float y, float w, float h, double a1, double a2) override; virtual void pie_unscaled(float x, float y, float w, float h, double a1, double a2) override; + virtual void ellipse_unscaled(double xt, double yt, double rx, double ry) override; // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx virtual void begin_points() override; @@ -151,7 +152,6 @@ protected: void fixloop(); // --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/gdi_rect.cxx virtual Fl_Region scale_clip(float f); - virtual void ellipse_unscaled(double xt, double yt, double rx, double ry); // --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed // using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end); // --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx index 46d638767..908b7f5bd 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx @@ -887,6 +887,23 @@ void Fl_Android_Graphics_Driver::pie_unscaled(float xi, float yi, float w, float } } +/** + * shortcut the closed circles so they use XDrawArc: + * FIXME: these do not draw rotated ellipses correctly! + * */ +void Fl_Android_Graphics_Driver::ellipse_unscaled(double xt, double yt, double rx, double ry) { + int llx = (int)rint(xt-rx); + int w = (int)rint(xt+rx)-llx; + int lly = (int)rint(yt-ry); + int h = (int)rint(yt+ry)-lly; + + if (what==POLYGON) + fl_pie(llx, lly, w, h, 0.0, 360.0); + else + fl_arc(llx, lly, w, h, 0.0, 360.0); +} + + #if 0 // Code used to switch output to an off-screen window. See macros in -- cgit v1.2.3