summaryrefslogtreecommitdiff
path: root/src/drivers/GDI
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/GDI')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.H1
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx8
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx4
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx28
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx32
6 files changed, 38 insertions, 37 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index a4225d82d..7b4e76c81 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -94,6 +94,7 @@ public:
void untranslate_all(void);
static HRGN scale_region(HRGN r, float f, Fl_GDI_Graphics_Driver *dr);
virtual void scale(float f);
+ float scale() {return Fl_Graphics_Driver::scale();}
protected:
void transformed_vertex0(float x, float y);
void fixloop();
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index a07e97313..20d129e75 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -109,7 +109,7 @@ void Fl_GDI_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offsc
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
SelectObject(new_gc, bitmap);
- BitBlt(gc_, x*scale_, y*scale_, w*scale_, h*scale_, new_gc, srcx*scale_, srcy*scale_, SRCCOPY);
+ BitBlt(gc_, x*scale(), y*scale(), w*scale(), h*scale(), new_gc, srcx*scale(), srcy*scale(), SRCCOPY);
RestoreDC(new_gc, save);
DeleteDC(new_gc);
}
@@ -147,7 +147,7 @@ void Fl_GDI_Graphics_Driver::translate_all(int x, int y) {
depth = stack_height - 1;
}
GetWindowOrgEx((HDC)gc(), origins+depth);
- SetWindowOrgEx((HDC)gc(), origins[depth].x - x*scale_, origins[depth].y - y*scale_, NULL);
+ SetWindowOrgEx((HDC)gc(), origins[depth].x - x*scale(), origins[depth].y - y*scale(), NULL);
depth++;
}
@@ -230,9 +230,9 @@ void Fl_GDI_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, i
void Fl_GDI_Graphics_Driver::scale(float f) {
- if (f != scale_) {
+ if (f != scale()) {
size_ = 0;
- scale_ = f;
+ Fl_Graphics_Driver::scale(f);
line_style(FL_SOLID); // scale also default line width
}
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
index 3b86650c8..9df0c8a39 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
@@ -97,7 +97,7 @@ void Fl_GDI_Graphics_Driver::color(Fl_Color i) {
} else {
Fl_Graphics_Driver::color(i);
Fl_XMap &xmap = fl_xmap[i];
- int tw = line_width_ ? line_width_ : int(scale_); if (!tw) tw = 1;
+ int tw = line_width_ ? line_width_ : int(scale()); if (!tw) tw = 1;
if (!xmap.pen || xmap.pwidth != tw) {
#if USE_COLORMAP
if (fl_palette) {
@@ -119,7 +119,7 @@ void Fl_GDI_Graphics_Driver::color(uchar r, uchar g, uchar b) {
static Fl_XMap xmap;
COLORREF c = RGB(r,g,b);
Fl_Graphics_Driver::color( fl_rgb_color(r, g, b) );
- int tw = line_width_ ? line_width_ : int(scale_); if (!tw) tw = 1;
+ int tw = line_width_ ? line_width_ : int(scale()); if (!tw) tw = 1;
if (!xmap.pen || c != xmap.rgb || tw != xmap.pwidth) {
clear_xmap(xmap);
set_xmap(xmap, c, tw);
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index e67df4844..f66adba1e 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -403,10 +403,10 @@ void Fl_GDI_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
}
void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Bitmap *bm, int X, int Y, int W, int H, int cx, int cy) {
- X = X*scale_;
- Y = Y*scale_;
+ X = X*scale();
+ Y = Y*scale();
cache_size(bm, W, H);
- cx *= scale_; cy *= scale_;
+ cx *= scale(); cy *= scale();
HDC tempdc = CreateCompatibleDC(gc_);
int save = SaveDC(tempdc);
@@ -504,10 +504,10 @@ void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img)
void Fl_GDI_Graphics_Driver::draw_fixed(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) {
- X = X*scale_;
- Y = Y*scale_;
+ X = X*scale();
+ Y = Y*scale();
cache_size(img, W, H);
- cx *= scale_; cy *= scale_;
+ cx *= scale(); cy *= scale();
if (W + cx > img->data_w()) W = img->data_w() - cx;
if (H + cy > img->data_h()) H = img->data_h() - cy;
if (!*Fl_Graphics_Driver::id(img)) {
@@ -549,10 +549,10 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP,
int save = SaveDC(new_gc);
SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb));
if ( (rgb->d() % 2) == 0 ) {
- alpha_blend_(XP*scale_, YP*scale_, W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH);
+ alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH);
} else {
SetStretchBltMode(gc_, HALFTONE);
- StretchBlt(gc_, XP*scale_, YP*scale_, W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH, SRCCOPY);
+ StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH, SRCCOPY);
}
RestoreDC(new_gc, save);
DeleteDC(new_gc);
@@ -632,11 +632,11 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Bitmap *bm) {
}
void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int H, int cx, int cy) {
- X = X*scale_;
- Y = Y*scale_;
+ X = X*scale();
+ Y = Y*scale();
cache_size(pxm, W, H);
- cx *= scale_; cy *= scale_;
- Fl_Region r2 = scale_clip(scale_);
+ cx *= scale(); cy *= scale();
+ Fl_Region r2 = scale_clip(scale());
if (*Fl_Graphics_Driver::mask(pxm)) {
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
@@ -647,9 +647,9 @@ void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else {
- float s = scale_; scale_ = 1;
+ float s = scale(); Fl_Graphics_Driver::scale(1);
copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
- scale_ = s;
+ Fl_Graphics_Driver::scale(s);
}
unscale_clip(r2);
}
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 91f1a164d..19619e369 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx
@@ -48,7 +48,7 @@ void Fl_GDI_Graphics_Driver::line_style_unscaled(int style, float width, char* d
} else {
s1 |= style & 0xff; // allow them to pass any low 8 bits for style
}
- if ((style || n) && !width) width = scale_; // fix cards that do nothing for 0?
+ if ((style || n) && !width) width = scale(); // fix cards that do nothing for 0?
if (!fl_current_xmap) color(FL_BLACK);
LOGBRUSH penbrush = {BS_SOLID,fl_RGB(),0}; // can this be fl_brush()?
int tw = width < 1? 1: width;
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);
}