summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-15 11:30:19 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-15 11:30:19 +0200
commitfd6accec247c6749a31f15ac4b5f5ef09139ab71 (patch)
treeeb421f27605c017301b74131af6a27a60f972531 /src
parent56ad8f8a78117dbd94cbc0b74c20fab4cca832bc (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')
-rw-r--r--src/fl_draw.cxx15
-rw-r--r--src/fl_draw_arrow.cxx4
2 files changed, 13 insertions, 6 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:
diff --git a/src/fl_draw_arrow.cxx b/src/fl_draw_arrow.cxx
index 16ee4361d..3af5c6875 100644
--- a/src/fl_draw_arrow.cxx
+++ b/src/fl_draw_arrow.cxx
@@ -1,7 +1,7 @@
//
// Arrow drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -220,6 +220,8 @@ static int fl_draw_arrow_choice(Fl_Rect r, Fl_Color col) {
\param[in] t arrow type
\param[in] o orientation
\param[in] col arrow color
+
+ \since 1.4.0
*/
void fl_draw_arrow(Fl_Rect r, Fl_Arrow_Type t, Fl_Orientation o, Fl_Color col) {