diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 38fce606d..c3449f1c9 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -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; diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index fac835d5f..a7825e821 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -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() { diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx index 8e56a7cc1..8b2eb47fb 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx @@ -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 diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 1e70b7929..a86242e12 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -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); } }