diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-11-30 18:50:11 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-11-30 18:50:19 +0100 |
| commit | 67bb631bd9d3b32e83fabe254a7a413034a13a96 (patch) | |
| tree | 2a2c419cef687c1d0e8915d30351861fe45468ad /src/drivers | |
| parent | ff372c86d8ef225ce87d1ff5539f2000e1849250 (diff) | |
Scaling for Windows and X11: support rectangular loops.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 22 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 36750f7d7..01014f49b 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -96,9 +96,8 @@ public: protected: void transformed_vertex0(float x, float y); void fixloop(); - // --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/gdi_rect.cxx virtual void point_unscaled(float x, float y); - void rect_unscaled(float x, float y, float w, float h); + virtual void rect(int x, int y, int w, int h); void focus_rect(int x, int y, int w, int h); void rectf_unscaled(float x, float y, float w, float h); virtual void line_unscaled(float x, float y, float x1, float y1); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 6bb526b6c..fba77eb17 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -46,16 +46,15 @@ void Fl_GDI_Graphics_Driver::overlay_rect(int x, int y, int w , int h) { loop(x, y, x+w-1, y, x+w-1, y+h-1, x, y+h-1); } -void Fl_GDI_Graphics_Driver::rect_unscaled(float x, float y, float w, float h) { - if (w<=0 || h<=0) return; - int line_delta_ = (scale() > 1.9 ? 1 : 0); - x += line_delta_; y += line_delta_; - int tw = line_width_ ? line_width_ : 1; // true line width - MoveToEx(gc_, x, y, 0L); - LineTo(gc_, x+w-tw, y); - LineTo(gc_, x+w-tw, y+h-tw); - LineTo(gc_, x, y+h-tw); - LineTo(gc_, x, y); +void Fl_GDI_Graphics_Driver::rect(int x, int y, int w, int h) +{ + if (w > 0 && h > 0) { + float s = scale(); + xyline_unscaled(x*s, y*s, (x+w-1)*s); + yxline_unscaled(x*s, y*s, (y+h-1)*s); + yxline_unscaled((x+w-1)*s, y*s, (y+h-1)*s); + xyline_unscaled(x*s, (y+h-1)*s, (x+w-1)*s); + } } void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) { @@ -132,9 +131,6 @@ void Fl_GDI_Graphics_Driver::loop_unscaled(float x, float y, float x1, float y1, } void Fl_GDI_Graphics_Driver::loop_unscaled(float x, float y, float x1, float y1, float x2, float y2, float x3, float y3) { - if (x==x3 && x1==x2 && y==y1 && y3==y2) { // rectangular loop - if (scale() > 1.9) { x += 1; y += 1; x1 += 1; y1 += 1; x2 += 1; y2 += 1; x3 += 1; y3 += 1;} - } MoveToEx(gc_, x, y, 0L); LineTo(gc_, x1, y1); LineTo(gc_, x2, y2); |
