Skip to content

Commit

Permalink
Android: Using xlib shortcut to draw circles and ellipses.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12790 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Matthias Melcher committed Mar 23, 2018
1 parent d695ccb commit 5843a45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/drivers/Android/Fl_Android_Graphics_Driver.H
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/drivers/Android/Fl_Android_Graphics_Driver.cxx
Expand Up @@ -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
Expand Down

0 comments on commit 5843a45

Please sign in to comment.