From e94dd318be1298ababe71aeb4404f7a3655627f0 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Tue, 6 Mar 2018 13:03:24 +0000 Subject: [PATCH] Windows: complete support for GUI rescaling. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12713 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 3 ++- src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index e4088b0c0..acc58c860 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -21,6 +21,7 @@ #include "Fl_GDI_Graphics_Driver.H" #include #include +#include /* @@ -232,7 +233,7 @@ void Fl_GDI_Graphics_Driver::scale(float f) { if (f != scale_) { size_ = 0; scale_ = f; -//fprintf(LOG,"set scale to %f\n",f);fflush(LOG); + line_style(FL_SOLID); // scale also default line width } } diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 40ba82472..1dc681f49 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -51,7 +51,7 @@ void Fl_GDI_Graphics_Driver::overlay_rect(int x, int y, int w , int h) { 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.75 ? 1 : 0);//TMP + 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); @@ -93,13 +93,13 @@ void Fl_GDI_Graphics_Driver::line_unscaled(float x, float y, float x1, float y1, SetPixel(gc_, x2, y2, fl_RGB()); } -//extern FILE*LOG; void Fl_GDI_Graphics_Driver::xyline_unscaled(float x, float y, float x1) { int line_delta_ = (scale_ > 1.75 ? 1 : 0); int tw = line_width_ ? line_width_ : 1; // true line width if (x > x1) { float exch = x; x = x1; x1 = exch; } int ix = x+line_delta_; if (scale_ >= 2) ix -= int(scale_/2); int iy = y+line_delta_; + if (scale_ > 1.9 && line_width_/scale_ >= 2) iy--; int ix1 = int(x1/scale_+1.5)*scale_-1; // extend line to pixel before line beginning at x1/scale_ + 1 ix1 += line_delta_; if (scale_ >= 2) ix1 -= 1;; if (scale_ >= 4) ix1 -= 1; MoveToEx(gc_, ix, iy, 0L); LineTo(gc_, ix1+1, iy); @@ -107,7 +107,6 @@ void Fl_GDI_Graphics_Driver::xyline_unscaled(float x, float y, float x1) { if (int(scale_) != scale_ && y+line_delta_ + scale_ >= iy + tw+1 - 0.001 ) { MoveToEx(gc_, ix, iy+1, 0L); LineTo(gc_, ix1+1, iy+1); } -//fprintf(LOG,"xyline_unscaled tw=%d s=%f gc_=%p\n",tw,scale_,gc_);fflush(LOG); } void Fl_GDI_Graphics_Driver::yxline_unscaled(float x, float y, float y1) { @@ -116,6 +115,7 @@ void Fl_GDI_Graphics_Driver::yxline_unscaled(float x, float y, float y1) { int tw = line_width_ ? line_width_ : 1; // true line width int ix = x+line_delta_; + if (scale_ > 1.9 && line_width_/scale_ >= 2) ix--; int iy = y+line_delta_; if (scale_ >= 2) iy -= int(scale_/2); int iy1 = int(y1/scale_+1.5)*scale_-1; iy1 += line_delta_; if (scale_ >= 2) iy1 -= 1;; if (scale_ >= 4) iy1 -= 1; // extend line to pixel before line beginning at y1/scale_ + 1 @@ -135,6 +135,9 @@ 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);