Put fix for issue #1214 (Windows "solid lines") under ABI guards

Original issue title:
  "Windows: dotted lines may be drawn solid when GUI is rescaled"

Unfortunately commit 880636eb12 broke
  the ABI because it added a variable to a public header. This commit
  uses ABI guards '#if FL_ABI_VERSION >= 10403" for the same fix.

Note: The full fix w/o ABI guards is already available in FLTK 1.5.
This commit is contained in:
Albrecht Schlosser 2025-04-26 17:55:43 +02:00
parent 82d5679f9c
commit 8d940f3581
5 changed files with 34 additions and 5 deletions

View File

@ -2,7 +2,7 @@
// Declaration of classes Fl_Graphics_Driver, Fl_Scalable_Graphics_Driver,
// and Fl_Font_Descriptor for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2024 by Bill Spitzak and others.
// Copyright 2010-2025 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
@ -430,7 +430,9 @@ public:
inline int floor(int x) { return Fl_Scalable_Graphics_Driver::floor(x, scale()); }
protected:
int line_width_;
#if FL_ABI_VERSION >= 10403 // Issue #1214
bool is_solid_;
#endif
virtual Fl_Region scale_clip(float f);
void unscale_clip(Fl_Region r);
void point(int x, int y) FL_OVERRIDE;

View File

@ -1,7 +1,7 @@
//
// Fl_Graphics_Driver class for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2023 by Bill Spitzak and others.
// Copyright 2010-2025 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
@ -800,7 +800,9 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver() {
line_width_ = 0;
fontsize_ = -1;
#if FL_ABI_VERSION >= 10403 // Issue #1214
is_solid_ = true;
#endif
}
void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h)
@ -851,7 +853,11 @@ void Fl_Scalable_Graphics_Driver::xyline(int x, int y, int x1) {
int xx1 = (x < x1 ? x1 : x);
if (s != s_int && line_width_ <= s_int) {
int lwidth = this->floor((y+1)) - this->floor(y);
#if FL_ABI_VERSION >= 10403 // Issue #1214
bool need_change_width = (lwidth != s_int && is_solid_);
#else
bool need_change_width = (lwidth != s_int);
#endif
void *data = NULL;
if (need_change_width) data = change_pen_width(lwidth);
xyline_unscaled(this->floor(xx), this->floor(y) + int(lwidth/2.f), this->floor(xx1+1)-1);
@ -871,7 +877,11 @@ void Fl_Scalable_Graphics_Driver::yxline(int x, int y, int y1) {
int yy1 = (y < y1 ? y1 : y);
if (s != s_int && line_width_ <= s_int) {
int lwidth = (this->floor((x+1)) - this->floor(x));
#if FL_ABI_VERSION >= 10403 // Issue #1214
bool need_change_width = (lwidth != s_int && is_solid_);
#else
bool need_change_width = (lwidth != s_int);
#endif
void *data = NULL;
if (need_change_width) data = change_pen_width(lwidth);
yxline_unscaled(this->floor(x) + int(lwidth/2.f), this->floor(yy), this->floor(yy1+1) - 1);
@ -1051,7 +1061,9 @@ void Fl_Scalable_Graphics_Driver::draw_circle(int x0, int y0, int d, Fl_Color c)
void Fl_Scalable_Graphics_Driver::line_style(int style, int width, char* dashes) {
if (width == 0) line_width_ = int(scale() < 2 ? 0 : scale());
else line_width_ = int(width>0 ? width*scale() : -width*scale());
#if FL_ABI_VERSION >= 10403 // Issue #1214
is_solid_ = ((style & 0xff) == FL_SOLID && (!dashes || !*dashes));
#endif
line_style_unscaled(style, line_width_, dashes);
}

View File

@ -2,7 +2,7 @@
// Definition of classes Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2023 by Bill Spitzak and others.
// Copyright 2010-2025 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
@ -60,6 +60,11 @@ protected:
uchar *mask_bitmap_;
uchar **mask_bitmap() FL_OVERRIDE {return &mask_bitmap_;}
POINT *long_point;
#if FL_ABI_VERSION >= 10403 // Issue #1214
// empty
#else
bool is_solid_;
#endif
int style_;
public:
Fl_GDI_Graphics_Driver();

View File

@ -1,7 +1,7 @@
//
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
// Copyright 1998-2025 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
@ -96,6 +96,11 @@ Fl_GDI_Graphics_Driver::Fl_GDI_Graphics_Driver() {
long_point = NULL;
depth = -1;
origins = NULL;
#if FL_ABI_VERSION >= 10403 // Issue #1214
// empty
#else
is_solid_ = true;
#endif
style_ = FL_SOLID;
}

View File

@ -1,7 +1,7 @@
//
// Line style code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
// Copyright 1998-2025 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
@ -58,6 +58,11 @@ void Fl_GDI_Graphics_Driver::line_style_unscaled(int style, int width, char* das
DeleteObject(oldpen);
DeleteObject(fl_current_xmap->pen);
fl_current_xmap->pen = newpen;
#if FL_ABI_VERSION >= 10403 // Issue #1214
// empty
#else
is_solid_ = ((style & 0xff) == FL_SOLID && (!dashes || !*dashes));
#endif
style_ = style;
}