diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-15 11:30:19 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-15 11:30:19 +0200 |
| commit | fd6accec247c6749a31f15ac4b5f5ef09139ab71 (patch) | |
| tree | eb421f27605c017301b74131af6a27a60f972531 /src/fl_draw.cxx | |
| parent | 56ad8f8a78117dbd94cbc0b74c20fab4cca832bc (diff) | |
Fix small circle drawing and add doxygen \since statement
src/fl_draw.cxx: improve documentation, add \since 1.4.0,
simplify scaling code, use forgotten 'color' argument to set the
circle color.
src/fl_draw_arrow.cxx: add doxygen \since statement
Diffstat (limited to 'src/fl_draw.cxx')
| -rw-r--r-- | src/fl_draw.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 142d81257..738ed314e 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -595,15 +595,18 @@ void fl_draw_check(Fl_Rect bb, Fl_Color col) { Draw a potentially small, filled circle as a GUI element. This method draws a filled circle, using fl_pie() if the given diameter - \p d is larger than 6 pixels (aka FLTK units). + \p d is larger than 6 pixels after scaling with the current screen + scaling factor (i.e. "physical" pixels). - If \p d is 6 or smaller it approximates a filled circle by drawing several - filled rectangles, depending on the size because fl_pie() might not draw - well on many systems for smaller sizes. + If the diameter is 6 or smaller after scaling it approximates a filled circle + by drawing several filled rectangles, depending on the size because fl_pie() + might not draw well on many systems for smaller sizes. \param[in] x0,y0 coordinates of top left of the bounding box \param[in] d diameter == width and height of the bounding box \param[in] color drawing color + + \since 1.4.0 */ void fl_draw_circle(int x0, int y0, int d, Fl_Color color) { @@ -618,10 +621,12 @@ void fl_draw_circle(int x0, int y0, int d, Fl_Color color) { // make circles nice on scaled display // note: we should scale the value up even more for hidpi displays like Apple's Retina float scale = fl_graphics_driver->scale(); - int scaled_d = (scale>1.0) ? ((int)(d*fl_graphics_driver->scale())) : d; + int scaled_d = (scale > 1.0) ? int(d * scale) : d; // draw the circle + fl_color(color); + switch (scaled_d) { // Larger circles draw fine... default: |
