diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 3adf6d6c9..24246621c 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -426,6 +426,7 @@ protected: virtual void point_unscaled(float x, float y); void rect(int x, int y, int w, int h) FL_OVERRIDE; void rectf(int x, int y, int w, int h) FL_OVERRIDE; + virtual void rect_unscaled(int x, int y, int w, int h); virtual void rectf_unscaled(int x, int y, int w, int h); void line(int x, int y, int x1, int y1) FL_OVERRIDE; virtual void line_unscaled(int x, int y, int x1, int y1); diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 6f54b32ca..5af14a2c2 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -751,10 +751,10 @@ Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver( void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h) { if (w > 0 && h > 0) { - xyline(x, y, x+w-1); - yxline(x, y, y+h-1); - yxline(x+w-1, y, y+h-1); - xyline(x, y+h-1, x+w-1); + int s = (int)scale()/2; + rect_unscaled(this->floor(x) + s, this->floor(y) + s, + this->floor(x + w - 1) - this->floor(x), + this->floor(y + h - 1) - this->floor(y)); } } @@ -794,6 +794,7 @@ void Fl_Scalable_Graphics_Driver::xyline(int x, int y, int x1) { } else { y = this->floor(y); if (line_width_ <= s_int) y += int(s/2.f); + else y += s_int/2; xyline_unscaled(this->floor(xx), y, this->floor(xx1+1) - 1); } } @@ -813,6 +814,7 @@ void Fl_Scalable_Graphics_Driver::yxline(int x, int y, int y1) { } else { x = this->floor(x); if (line_width_ <= s_int) x += int(s/2.f); + else x += s_int/2; yxline_unscaled(x, this->floor(yy), this->floor(yy1+1) - 1); } } @@ -1074,6 +1076,8 @@ Fl_Region Fl_Scalable_Graphics_Driver::scale_clip(float f) { return 0; } void Fl_Scalable_Graphics_Driver::point_unscaled(float x, float y) {} +void Fl_Scalable_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {} + void Fl_Scalable_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {} void Fl_Scalable_Graphics_Driver::line_unscaled(int x, int y, int x1, int y1) {} diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 03371c8c4..38fce606d 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -109,6 +109,7 @@ protected: void fixloop() FL_OVERRIDE; void point(int x, int y) FL_OVERRIDE; void focus_rect(int x, int y, int w, int h) FL_OVERRIDE; + void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE; void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE; #if USE_COLORMAP void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE; diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 1b13ff0a9..4527ee920 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -61,6 +61,14 @@ void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) { for (yy = h; yy > 0; yy--, i++) if (i & 1) SetPixel(gc_, x, y+yy, c); } +void Fl_GDI_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) { + MoveToEx(fl_gc, x, y, 0L); + LineTo(fl_gc, x+w, y); + LineTo(fl_gc, x+w, y+h); + LineTo(fl_gc, x, y+h); + LineTo(fl_gc, x, y); +} + void Fl_GDI_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) { RECT rect; rect.left = x; rect.top = y; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index 4116b79b9..b3e9ad444 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -141,6 +141,7 @@ protected: void transformed_vertex0(float x, float y) FL_OVERRIDE; void fixloop() FL_OVERRIDE; void focus_rect(int x, int y, int w, int h) FL_OVERRIDE; + void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE; void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE; void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE; void line_unscaled(int x, int y, int x1, int y1) FL_OVERRIDE; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx index 6693dc460..689f0eccf 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx @@ -227,6 +227,10 @@ void Fl_Xlib_Graphics_Driver::focus_rect(int x, int y, int w, int h) { } } +void Fl_Xlib_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) { + XDrawRectangle(fl_display, fl_window, gc_, x, y, w, h); +} + void Fl_Xlib_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) { x += floor(offset_x_); y += floor(offset_y_);