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
This commit is contained in:
Matthias Melcher 2018-03-23 23:09:24 +00:00
parent d695ccb2d2
commit 5843a450bc
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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