Fix Fl_GDI_Graphics_Driver::rect_unscaled() (#1052)

This commit is contained in:
ManoloFLTK 2024-08-27 16:52:20 +02:00
parent ec05f78d98
commit 5fae7b36bb
4 changed files with 11 additions and 9 deletions

View File

@ -60,6 +60,8 @@ protected:
uchar *mask_bitmap_;
uchar **mask_bitmap() FL_OVERRIDE {return &mask_bitmap_;}
POINT *long_point;
bool is_solid_;
int style_;
public:
Fl_GDI_Graphics_Driver();
~Fl_GDI_Graphics_Driver() FL_OVERRIDE;

View File

@ -96,6 +96,8 @@ Fl_GDI_Graphics_Driver::Fl_GDI_Graphics_Driver() {
long_point = NULL;
depth = -1;
origins = NULL;
is_solid_ = true;
style_ = FL_SOLID;
}
Fl_GDI_Graphics_Driver::~Fl_GDI_Graphics_Driver() {

View File

@ -58,6 +58,8 @@ 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;
is_solid_ = ((style & 0xff) == FL_SOLID && (!dashes || !*dashes));
style_ = style;
}
#if USE_GDIPLUS

View File

@ -62,21 +62,17 @@ void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
}
void Fl_GDI_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {
HPEN oldpen, newpen;
if (line_width_ > 1) {
LOGBRUSH penbrush = {BS_SOLID, fl_RGB(), 0};
newpen = ExtCreatePen(PS_GEOMETRIC | PS_ENDCAP_SQUARE, line_width_, &penbrush, 0, 0);
oldpen = (HPEN)SelectObject(gc_, newpen);
if (is_solid_ && line_width_ > 1) {
line_style_unscaled(FL_CAP_SQUARE, line_width_, 0); // see issue #1052
}
MoveToEx(gc_, x, y, 0L);
LineTo(gc_, x+w, y);
if (line_width_ <= 1) LineTo(gc_, x+w, y+h+1); // see issue #1052
if (is_solid_ && line_width_ <= 1) LineTo(gc_, x+w, y+h+1); // see issue #1052
LineTo(gc_, x+w, y+h);
LineTo(gc_, x, y+h);
LineTo(gc_, x, y);
if (line_width_ > 1) {
SelectObject(gc_, oldpen);
DeleteObject(newpen);
if (is_solid_ && line_width_ > 1) {
line_style_unscaled(style_, line_width_, 0);
}
}