diff options
| author | Manolo Gouy <Manolo> | 2018-04-19 10:39:46 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-04-19 10:39:46 +0000 |
| commit | 54b697cd49d3946ecd1f264c0741f36568822819 (patch) | |
| tree | 399901a93956b7558be6d5e77ba62cb93ee7141d /src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | |
| parent | d375918a5ea3210d0d148ec215f1494cbfbd927e (diff) | |
Reorganise access to the value of the GUI scaling factor with public getter and protected, virtual setter member functions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12858 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 1dc681f49..5e8f9e1d7 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -36,7 +36,7 @@ // --- line and polygon drawing with integer coordinates void Fl_GDI_Graphics_Driver::point_unscaled(float fx, float fy) { - int width = scale_ >= 1 ? scale_ : 1; + int width = scale() >= 1 ? scale() : 1; RECT rect; rect.left = fx; rect.top = fy; rect.right = fx + width; rect.bottom = fy + width; @@ -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.9 ? 1 : 0); + 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); @@ -94,34 +94,34 @@ void Fl_GDI_Graphics_Driver::line_unscaled(float x, float y, float x1, float y1, } void Fl_GDI_Graphics_Driver::xyline_unscaled(float x, float y, float x1) { - int line_delta_ = (scale_ > 1.75 ? 1 : 0); + 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 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; + 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); // try and make sure no unfilled area lies between xyline(x,y,x1) and xyline(x,y+1,x1) - if (int(scale_) != scale_ && y+line_delta_ + scale_ >= iy + tw+1 - 0.001 ) { + 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); } } void Fl_GDI_Graphics_Driver::yxline_unscaled(float x, float y, float y1) { if (y1 < y) { float exch = y; y = y1; y1 = exch;} - int line_delta_ = (scale_ > 1.75 ? 1 : 0); + int line_delta_ = (scale() > 1.75 ? 1 : 0); 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 + 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 MoveToEx(gc_, ix, iy, 0L); LineTo(gc_, ix, iy1+1); // try and make sure no unfilled area lies between yxline(x,y,y1) and yxline(x+1,y,y1) - if (int(scale_) != scale_ && x+line_delta_+scale_ >= ix + tw+1 -0.001) { + if (int(scale()) != scale() && x+line_delta_+scale() >= ix + tw+1 -0.001) { MoveToEx(gc_, ix+1, iy, 0L); LineTo(gc_, ix+1, iy1+1); } @@ -136,7 +136,7 @@ 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;} + 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); @@ -251,7 +251,7 @@ void Fl_GDI_Graphics_Driver::restore_clip() { fl_clip_state_number++; if (gc_) { HRGN r = NULL; - if (rstack[rstackptr]) r = scale_clip(scale_); + if (rstack[rstackptr]) r = scale_clip(scale()); SelectClipRgn(gc_, rstack[rstackptr]); // if region is NULL, clip is automatically cleared if (r) unscale_clip(r); } |
