summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-10-16 12:47:06 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-10-16 12:47:06 +0200
commitda5331b59210769b4e15f24a0b5237a7ec5bfc4d (patch)
tree6a145fe9b6da92ff7bdcf7c9151c733ef9edd32c
parent52f56535454744473b0a2630f251f3527c863f73 (diff)
Open
Fix Drawing artifact with round check buttons in menu under Cairo (#792)
-rw-r--r--src/fl_gtk.cxx11
-rw-r--r--src/fl_oxy.cxx6
-rw-r--r--src/fl_round_box.cxx9
3 files changed, 13 insertions, 13 deletions
diff --git a/src/fl_gtk.cxx b/src/fl_gtk.cxx
index 65ded73d7..5be58235e 100644
--- a/src/fl_gtk.cxx
+++ b/src/fl_gtk.cxx
@@ -174,9 +174,12 @@ static void draw(int which, int x,int y,int w,int h, int inset)
void (*f)(int,int,int,int,double,double);
f = (which==FILL) ? fl_pie : fl_arc_i;
if (which >= CLOSED) {
- f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
- f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
- } else if (which == UPPER_LEFT) {
+ if (w == h) f(x, y, d, d, 0, 360);
+ else {
+ f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
+ f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
+ }
+ } else if (which == UPPER_LEFT) {
f(x+w-d, y, d, d, 45, w<=h ? 180 : 90);
f(x, y+h-d, d, d, w<=h ? 180 : 90, 225);
} else { // LOWER_RIGHT
@@ -232,9 +235,7 @@ static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) {
static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) {
gtk_color(c);
- fl_antialias(0); // fix for issue #792
draw(FILL, x, y, w, h, 2);
- fl_antialias(1); // fix for issue #792
gtk_color(fl_color_average(FL_WHITE, c, 0.1f));
draw(LOWER_RIGHT, x+1, y, w-2, h, 2);
diff --git a/src/fl_oxy.cxx b/src/fl_oxy.cxx
index 86fb4d79f..59909fdf9 100644
--- a/src/fl_oxy.cxx
+++ b/src/fl_oxy.cxx
@@ -216,14 +216,12 @@ static void _oxy_rounded_box_(int x, int y, int w, int h, Fl_Color bg) {
fl_rectf(x + h / 2, y, w - h, h); // rectangle between left and right half-circle
fl_pie(x + w - h, y, h, h, 0.0, 90.0); // top-left quarter of circle
fl_pie(x + w - h, y, h, h, 270.0, 360.0); // bottom-left quarter of circle
+ } else if (w == h) {
+ fl_pie(x, y, w, w, 0.0, 360.0);
} else {
- fl_antialias(0); // fix for issue #792
fl_pie(x, y, w, w, 0.0, 180.0); // top half of circle
- fl_antialias(1); // fix for issue #792
fl_rectf(x, y + w / 2, w, h - w); // rectangle between top and bottom half-circle
- fl_antialias(0); // fix for issue #792
fl_pie(x, y + h - w, w, w, 180.0, 360.0); // bottom half of circle
- fl_antialias(1); // fix for issue #792
}
}
diff --git a/src/fl_round_box.cxx b/src/fl_round_box.cxx
index ea46c7737..d1ebdcb25 100644
--- a/src/fl_round_box.cxx
+++ b/src/fl_round_box.cxx
@@ -44,8 +44,11 @@ static void draw(int which, int x,int y,int w,int h, int inset, Fl_Color color)
void (*f)(int,int,int,int,double,double);
f = (which==FILL) ? fl_pie : fl_arc_i;
if (which >= CLOSED) {
- f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
- f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
+ if (w == h) f(x, y, d, d, 0, 360);
+ else {
+ f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
+ f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
+ }
} else if (which == UPPER_LEFT) {
f(x+w-d, y, d, d, 45, w<=h ? 180 : 90);
f(x, y+h-d, d, d, w<=h ? 180 : 90, 225);
@@ -73,9 +76,7 @@ extern const uchar* fl_gray_ramp();
void fl_round_down_box(int x, int y, int w, int h, Fl_Color bgcolor) {
const uchar *g = fl_gray_ramp();
- fl_antialias(0); // fix for issue #792
draw(FILL, x, y, w, h, 2, Fl::box_color(bgcolor));
- fl_antialias(1); // fix for issue #792
draw(UPPER_LEFT, x+1, y, w-2, h, 0, (Fl_Color)g[(int)'N']);
draw(UPPER_LEFT, x+1, y, w-2, h, 1, (Fl_Color)g[(int)'H']);
draw(UPPER_LEFT, x, y, w, h, 0, (Fl_Color)g[(int)'N']);