summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-13 21:12:52 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-02-13 21:13:04 +0100
commit9fad60140167661bfa1f442db3b81ba9e10d37e9 (patch)
tree564b6cdd0e52c523a9a51e136d2edb0bbd60ece2 /src/drivers
parent5ade8fcb09ad2f30d0ee84228f062bdfc8ecdc50 (diff)
Remove compilation warnings issued by Visual Studio 2019.
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx17
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx26
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx35
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx68
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx4
-rw-r--r--src/drivers/PostScript/Fl_PostScript.cxx2
-rw-r--r--src/drivers/PostScript/Fl_PostScript_image.cxx2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx24
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx16
11 files changed, 101 insertions, 97 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
index 9d7591712..9cb5a425c 100644
--- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
@@ -77,7 +77,7 @@ Fl_GDI_Copy_Surface_Driver::~Fl_GDI_Copy_Surface_Driver() {
SetClipboardData (CF_ENHMETAFILE, hmf);
// then put a BITMAP version of the graphics in the clipboard
float scaling = driver()->scale();
- int W = width * scaling, H = height * scaling;
+ int W = int(width * scaling), H = int(height * scaling);
RECT rect = {0, 0, W, H};
Fl_Image_Surface *surf = new Fl_Image_Surface(W, H);
Fl_Surface_Device::push_current(surf);
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 31e54c37f..b70f579cb 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -104,7 +104,8 @@ HDC fl_makeDC(HBITMAP bitmap) {
}
void Fl_GDI_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen bitmap, int srcx, int srcy) {
- x *= scale(); y *= scale(); w *= scale(); h *= scale(); srcx *= scale(); srcy *= scale();
+ x = int(x * scale()); y = int(y * scale()); w = int(w * scale()); h = int(h * scale());
+ srcx = int(srcx * scale()); srcy = int(srcy * scale());
if (srcx < 0) {w += srcx; x -= srcx; srcx = 0;}
if (srcy < 0) {h += srcy; y -= srcy; srcy = 0;}
int off_width, off_height;
@@ -157,7 +158,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(), int(origins[depth].x - x*scale()), int(origins[depth].y - y*scale()), NULL);
depth++;
}
@@ -179,8 +180,8 @@ void Fl_GDI_Graphics_Driver::transformed_vertex0(float x, float y) {
p_size = p ? 2*p_size : 16;
p = (POINT*)realloc((void*)p, p_size*sizeof(*p));
}
- p[n].x = x;
- p[n].y = y;
+ p[n].x = int(x);
+ p[n].y = int(y);
n++;
}
}
@@ -255,14 +256,14 @@ HRGN Fl_GDI_Graphics_Driver::scale_region(HRGN r, float f, Fl_GDI_Graphics_Drive
POINT pt = {0, 0};
if (dr && dr->depth >= 1) { // account for translation
GetWindowOrgEx((HDC)dr->gc(), &pt);
- pt.x *= (f - 1);
- pt.y *= (f - 1);
+ pt.x = int(pt.x * (f - 1));
+ pt.y = int(pt.y * (f - 1));
}
RECT *rects = (RECT*)&(pdata->Buffer);
int delta = (f > 1.75 ? 1 : 0) - int(f/2);
for (DWORD i = 0; i < pdata->rdh.nCount; i++) {
- int x = rects[i].left * f + pt.x;
- int y = rects[i].top * f + pt.y;
+ int x = int(rects[i].left * f) + pt.x;
+ int y = int(rects[i].top * f) + pt.y;
RECT R2;
R2.left = x + delta;
R2.top = y + delta;
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
index 6055ab1a5..9bd3aaa44 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
@@ -32,29 +32,29 @@
void Fl_GDI_Graphics_Driver::arc_unscaled(float x, float y, float w, float h, double a1, double a2) {
if (w <= 0 || h <= 0) return;
- int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
- int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
- int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
- int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
+ int xa = int( x+w/2+int(w*cos(a1/180.0*M_PI)) );
+ int ya = int( y+h/2-int(h*sin(a1/180.0*M_PI)) );
+ int xb = int( x+w/2+int(w*cos(a2/180.0*M_PI)) );
+ int yb = int( y+h/2-int(h*sin(a2/180.0*M_PI)) );
if (fabs(a1 - a2) < 90) {
if (xa == xb && ya == yb) SetPixel(gc_, xa, ya, fl_RGB());
- else Arc(gc_, x, y, x+w, y+h, xa, ya, xb, yb);
- } else Arc(gc_, x, y, x+w, y+h, xa, ya, xb, yb);
+ else Arc(gc_, int(x), int(y), int(x+w), int(y+h), xa, ya, xb, yb);
+ } else Arc(gc_, int(x), int(y), int(x+w), int(y+h), xa, ya, xb, yb);
}
void Fl_GDI_Graphics_Driver::pie_unscaled(float x, float y, float w, float h, double a1, double a2) {
if (w <= 0 || h <= 0) return;
if (a1 == a2) return;
- int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
- int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
- int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
- int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
+ int xa = int( x+w/2+int(w*cos(a1/180.0*M_PI)) );
+ int ya = int( y+h/2-int(h*sin(a1/180.0*M_PI)) );
+ int xb = int( x+w/2+int(w*cos(a2/180.0*M_PI)) );
+ int yb = int( y+h/2-int(h*sin(a2/180.0*M_PI)) );
SelectObject(gc_, fl_brush());
if (fabs(a1 - a2) < 90) {
if (xa == xb && ya == yb) {
- MoveToEx(gc_, x+w/2, y+h/2, 0L);
+ MoveToEx(gc_, int(x+w/2), int(y+h/2), 0L);
LineTo(gc_, xa, ya);
SetPixel(gc_, xa, ya, fl_RGB());
- } else Pie(gc_, x, y, x+w, y+h, xa, ya, xb, yb);
- } else Pie(gc_, x, y, x+w, y+h, xa, ya, xb, yb);
+ } else Pie(gc_, int(x), int(y), int(x+w), int(y+h), xa, ya, xb, yb);
+ } else Pie(gc_, int(x), int(y), int(x+w), int(y+h), xa, ya, xb, yb);
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 38bfc4b1b..cf476f7c4 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -398,10 +398,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 = int(X * scale());
+ Y = int(Y * scale());
cache_size(bm, W, H);
- cx *= scale(); cy *= scale();
+ cx = int(cx * scale()); cy = int(cy * scale());
HDC tempdc = CreateCompatibleDC(gc_);
int save = SaveDC(tempdc);
@@ -467,7 +467,8 @@ void Fl_GDI_Printer_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP,
// draw it to printer context with background color as transparent
float scaleW = bm->data_w()/float(bm->w());
float scaleH = bm->data_h()/float(bm->h());
- fl_TransparentBlt(gc_, X, Y, W, H, tempdc, cx * scaleW, cy * scaleH, W * scaleW, H * scaleH, RGB(r, g, b) );
+ fl_TransparentBlt(gc_, X, Y, W, H, tempdc,
+ int(cx * scaleW), int(cy * scaleH), int(W * scaleW), int(H * scaleH), RGB(r, g, b) );
delete img_surf;
RestoreDC(tempdc, save);
DeleteDC(tempdc);
@@ -498,10 +499,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 = int(X * scale());
+ Y = int(Y * scale());
cache_size(img, W, H);
- cx *= scale(); cy *= scale();
+ cx = int(cx * scale()); cy = int(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)) {
@@ -542,8 +543,8 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP,
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb));
- Wfull = W*(rgb->data_w()/float(Wfull)); Hfull = H*(rgb->data_h()/float(Hfull));
- int cx2 = cx * scale(), cy2 = cy * scale();
+ Wfull = int(W * (rgb->data_w() / float(Wfull))); Hfull = int(H * (rgb->data_h() / float(Hfull)));
+ int cx2 = int(cx * scale()), cy2 = int(cy * scale());
if (cx2+Wfull > rgb->data_w()) Wfull = rgb->data_w()-cx2;
if (cy2+Hfull > rgb->data_h()) Hfull = rgb->data_h()-cy2;
float scaleW = float(rgb->data_w())/rgb->w();
@@ -554,10 +555,10 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP,
float s = scale(); scale(1); cache_size(rgb, Wfull, Hfull); scale(s);
}
if ( (rgb->d() % 2) == 0 ) {
- alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, Wfull, Hfull);
+ alpha_blend_(int(XP*scale()), int(YP*scale()), W, H, new_gc, int(cx*scaleW), int(cy*scaleH), Wfull, Hfull);
} else {
SetStretchBltMode(gc_, HALFTONE);
- StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, Wfull, Hfull, SRCCOPY);
+ StretchBlt(gc_, int(XP*scale()), int(YP*scale()), W, H, new_gc, int(cx*scaleW), int(cy*scaleH), Wfull, Hfull, SRCCOPY);
}
RestoreDC(new_gc, save);
DeleteDC(new_gc);
@@ -582,7 +583,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP,
if ( *pw != rgb->data_w() || *ph != rgb->data_h()) rgb->uncache();
}
if (!*id(rgb)) cache(rgb);
- draw_fixed(rgb, 0, 0, WP/tr.eM11, HP/tr.eM22, cx/tr.eM11, cy/tr.eM22);
+ draw_fixed(rgb, 0, 0, int(WP / tr.eM11), int(HP / tr.eM22), int(cx / tr.eM11), int(cy / tr.eM22));
SetWorldTransform(gc_, &old_tr);
}
@@ -637,10 +638,10 @@ 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 = int(X * scale());
+ Y = int(Y * scale());
cache_size(pxm, W, H);
- cx *= scale(); cy *= scale();
+ cx = int(cx * scale()); cy = int(cy * scale());
Fl_Region r2 = scale_clip(scale());
if (*Fl_Graphics_Driver::mask(pxm)) {
HDC new_gc = CreateCompatibleDC(gc_);
@@ -688,8 +689,8 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP,
// print all of offscreen but its parts in background color
float scaleW = pxm->data_w()/float(pxm->w());
float scaleH = pxm->data_h()/float(pxm->h());
- fl_TransparentBlt(gc_, X, Y, W, H, new_gc, cx * scaleW, cy * scaleH, W * scaleW, H * scaleH,
- need_pixmap_bg_color );
+ fl_TransparentBlt(gc_, X, Y, W, H, new_gc,
+ int(cx * scaleW), int(cy * scaleH), int(W * scaleW), int(H * scaleH), need_pixmap_bg_color );
RestoreDC(new_gc,save);
DeleteDC(new_gc);
need_pixmap_bg_color = 0;
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 e71fa65d7..18fba5fb8 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
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;
+ int tw = ( width < 1.f ? 1 : int(width) );
HPEN newpen = ExtCreatePen(s1, tw, &penbrush, n, n ? a : 0);
if (!newpen) {
Fl::error("fl_line_style(): Could not create GDI pen object.");
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index fba77eb17..50e00c5a9 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -33,10 +33,10 @@
// --- 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 ? int(scale()) : 1);
RECT rect;
- rect.left = fx; rect.top = fy;
- rect.right = fx + width; rect.bottom = fy + width;
+ rect.left = int(fx); rect.top = int(fy);
+ rect.right = int(fx) + width; rect.bottom = int(fy) + width;
FillRect(gc_, &rect, fl_brush());
}
@@ -71,32 +71,32 @@ void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
void Fl_GDI_Graphics_Driver::rectf_unscaled(float x, float y, float w, float h) {
if (w<=0 || h<=0) return;
RECT rect;
- rect.left = x; rect.top = y;
- rect.right = x + w; rect.bottom = y + h;
+ rect.left = int(x); rect.top = int(y);
+ rect.right = int(x + w); rect.bottom = int(y + h);
FillRect(gc_, &rect, fl_brush());
}
void Fl_GDI_Graphics_Driver::line_unscaled(float x, float y, float x1, float y1) {
- MoveToEx(gc_, x, y, 0L);
- LineTo(gc_, x1, y1);
- SetPixel(gc_, x1, y1, fl_RGB());
+ MoveToEx(gc_, int(x), int(y), 0L);
+ LineTo(gc_, int(x1), int(y1));
+ SetPixel(gc_, int(x1), int(y1), fl_RGB());
}
void Fl_GDI_Graphics_Driver::line_unscaled(float x, float y, float x1, float y1, float x2, float y2) {
- MoveToEx(gc_, x, y, 0L);
- LineTo(gc_, x1, y1);
- LineTo(gc_, x2, y2);
- SetPixel(gc_, x2, y2, fl_RGB());
+ MoveToEx(gc_, int(x), int(y), 0L);
+ LineTo(gc_, int(x1), int(y1));
+ LineTo(gc_, int(x2), int(y2));
+ SetPixel(gc_, int(x2), int(y2), fl_RGB());
}
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_;
+ int ix = int(x) + line_delta_; if (scale() >= 2.f) ix -= int(scale()/2);
+ int iy = int(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
+ int ix1 = int( int(x1/scale()+1.5f) * 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)
@@ -110,10 +110,10 @@ void Fl_GDI_Graphics_Driver::yxline_unscaled(float x, float y, float y1) {
int line_delta_ = (scale() > 1.75 ? 1 : 0);
int tw = line_width_ ? line_width_ : 1; // true line width
- int ix = x+line_delta_;
+ int ix = int(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;
+ int iy = int(y) + line_delta_; if (scale() >= 2) iy -= int(scale()/2);
+ int iy1 = int( 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)
@@ -124,35 +124,35 @@ void Fl_GDI_Graphics_Driver::yxline_unscaled(float x, float y, float y1) {
}
void Fl_GDI_Graphics_Driver::loop_unscaled(float x, float y, float x1, float y1, float x2, float y2) {
- MoveToEx(gc_, x, y, 0L);
- LineTo(gc_, x1, y1);
- LineTo(gc_, x2, y2);
- LineTo(gc_, x, y);
+ MoveToEx(gc_, int(x), int(y), 0L);
+ LineTo(gc_, int(x1), int(y1));
+ LineTo(gc_, int(x2), int(y2));
+ LineTo(gc_, int(x), int(y));
}
void Fl_GDI_Graphics_Driver::loop_unscaled(float x, float y, float x1, float y1, float x2, float y2, float x3, float y3) {
- MoveToEx(gc_, x, y, 0L);
- LineTo(gc_, x1, y1);
- LineTo(gc_, x2, y2);
- LineTo(gc_, x3, y3);
- LineTo(gc_, x, y);
+ MoveToEx(gc_, int(x), int(y), 0L);
+ LineTo(gc_, int(x1), int(y1));
+ LineTo(gc_, int(x2), int(y2));
+ LineTo(gc_, int(x3), int(y3));
+ LineTo(gc_, int(x), int(y));
}
void Fl_GDI_Graphics_Driver::polygon_unscaled(float x, float y, float x1, float y1, float x2, float y2) {
POINT p[3];
- p[0].x = x; p[0].y = y;
- p[1].x = x1; p[1].y = y1;
- p[2].x = x2; p[2].y = y2;
+ p[0].x = int(x); p[0].y = int(y);
+ p[1].x = int(x1); p[1].y = int(y1);
+ p[2].x = int(x2); p[2].y = int(y2);
SelectObject(gc_, fl_brush());
Polygon(gc_, p, 3);
}
void Fl_GDI_Graphics_Driver::polygon_unscaled(float x, float y, float x1, float y1, float x2, float y2, float x3, float y3) {
POINT p[4];
- p[0].x = x; p[0].y = y;
- p[1].x = x1; p[1].y = y1;
- p[2].x = x2; p[2].y = y2;
- p[3].x = x3; p[3].y = y3;
+ p[0].x = int(x); p[0].y = int(y);
+ p[1].x = int(x1); p[1].y = int(y1);
+ p[2].x = int(x2); p[2].y = int(y2);
+ p[3].x = int(x3); p[3].y = int(y3);
SelectObject(gc_, fl_brush());
Polygon(gc_, p, 4);
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
index c556121cc..87e694f18 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
@@ -42,7 +42,7 @@ void Fl_GDI_Graphics_Driver::end_line() {
void Fl_GDI_Graphics_Driver::end_loop() {
fixloop();
- if (n>2) transformed_vertex0(p[0].x, p[0].y);
+ if (n>2) transformed_vertex0(float(p[0].x), float(p[0].y));
end_line();
}
@@ -67,7 +67,7 @@ void Fl_GDI_Graphics_Driver::begin_complex_polygon() {
void Fl_GDI_Graphics_Driver::gap() {
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
if (n > gap_+2) {
- transformed_vertex0(p[gap_].x, p[gap_].y);
+ transformed_vertex0(float(p[gap_].x), float(p[gap_].y));
counts[numcount++] = n-gap_;
gap_ = n;
} else {
diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx
index 15b66563a..a2d17ff3e 100644
--- a/src/drivers/PostScript/Fl_PostScript.cxx
+++ b/src/drivers/PostScript/Fl_PostScript.cxx
@@ -2122,7 +2122,7 @@ Fl_EPS_File_Surface::Fl_EPS_File_Surface(int width, int height, FILE *eps, Fl_Co
ps->close_cmd_ = closef;
if (ps->output) {
float s = Fl::screen_scale(0);
- ps->start_eps(width*s, height*s);
+ ps->start_eps(int(width*s), int(height*s));
#if USE_PANGO
cairo_save(ps->cr());
ps->left_margin = ps->top_margin = 0;
diff --git a/src/drivers/PostScript/Fl_PostScript_image.cxx b/src/drivers/PostScript/Fl_PostScript_image.cxx
index 2aaa29a20..13976b20e 100644
--- a/src/drivers/PostScript/Fl_PostScript_image.cxx
+++ b/src/drivers/PostScript/Fl_PostScript_image.cxx
@@ -116,7 +116,7 @@ void Fl_PostScript_Graphics_Driver::write85(void *data, const uchar *p, int len)
const uchar *last = p + len;
while (p < last) {
int c = 4 - big->l4;
- if (last-p < c) c = last-p;
+ if (last-p < c) c = int(last-p);
memcpy(big->bytes4 + big->l4, p, c);
p += c;
big->l4 += c;
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
index 998d4f9b9..9720c2594 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
@@ -146,10 +146,10 @@ void Fl_WinAPI_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H, i
{
if (num_screens < 0) init();
if (n < 0 || n >= num_screens) n = 0;
- X = work_area[n].left/scale_of_screen[n];
- Y = work_area[n].top/scale_of_screen[n];
- W = (work_area[n].right - work_area[n].left)/scale_of_screen[n];
- H = (work_area[n].bottom - work_area[n].top)/scale_of_screen[n];
+ X = int(work_area[n].left/scale_of_screen[n]);
+ Y = int(work_area[n].top/scale_of_screen[n]);
+ W = int((work_area[n].right - work_area[n].left)/scale_of_screen[n]);
+ H = int((work_area[n].bottom - work_area[n].top)/scale_of_screen[n]);
}
@@ -161,10 +161,10 @@ void Fl_WinAPI_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H, int n)
n = 0;
if (num_screens > 0) {
- X = screens[n].left/scale_of_screen[n];
- Y = screens[n].top/scale_of_screen[n];
- W = (screens[n].right - screens[n].left)/scale_of_screen[n];
- H = (screens[n].bottom - screens[n].top)/scale_of_screen[n];
+ X = int(screens[n].left/scale_of_screen[n]);
+ Y = int(screens[n].top/scale_of_screen[n]);
+ W = int((screens[n].right - screens[n].left)/scale_of_screen[n]);
+ H = int((screens[n].bottom - screens[n].top)/scale_of_screen[n]);
} else {
/* Fallback if something is broken... */
X = 0;
@@ -501,14 +501,14 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(
{
float s = Fl_Surface_Device::surface()->driver()->scale();
int ws, hs;
- if (int(s) == s) { ws = w * s; hs = h * s;}
+ if (int(s) == s) { ws = int(w * s); hs = int(h * s);}
else {
- ws = (w+1)*s; // approximates what Fl_Graphics_Driver::cache_size() does
- hs = (h+1)*s;
+ ws = int((w+1) * s); // approximates what Fl_Graphics_Driver::cache_size() does
+ hs = int((h+1) * s);
if (ws < 1) ws = 1;
if (hs < 1) hs = 1;
}
- return read_win_rectangle_unscaled(X*s, Y*s, ws, hs, win);
+ return read_win_rectangle_unscaled(int(X*s), int(Y*s), ws, hs, win);
}
Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h, Fl_Window *win)
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 5b50b64b1..8d0fddcd4 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -121,7 +121,7 @@ int Fl_WinAPI_Window_Driver::decorated_w()
int bt, bx, by;
float s = Fl::screen_driver()->scale(screen_num());
border_width_title_bar_height(bx, by, bt);
- int mini_bx = bx/s; if (mini_bx < 1) mini_bx = 1;
+ int mini_bx = int(bx/s); if (mini_bx < 1) mini_bx = 1;
return w() + 2 * mini_bx;
}
@@ -130,8 +130,8 @@ int Fl_WinAPI_Window_Driver::decorated_h()
int bt, bx, by;
border_width_title_bar_height(bx, by, bt);
float s = Fl::screen_driver()->scale(screen_num());
- int mini_by = by/s; if (mini_by < 1) mini_by = 1;
- return h() + (bt + by)/s + mini_by;
+ int mini_by = int(by / s); if (mini_by < 1) mini_by = 1;
+ return h() + int((bt + by) / s) + mini_by;
}
@@ -285,8 +285,8 @@ void Fl_WinAPI_Window_Driver::draw_begin()
float s = Fl::screen_driver()->scale(screen_num());
if ((shape_data_->lw_ != s*w() || shape_data_->lh_ != s*h()) && shape_data_->shape_) {
// size of window has changed since last time
- shape_data_->lw_ = s*w();
- shape_data_->lh_ = s*h();
+ shape_data_->lw_ = int(s * w());
+ shape_data_->lh_ = int(s * h());
Fl_Image* temp = shape_data_->effective_bitmap_ ? shape_data_->effective_bitmap_ : shape_data_->shape_;
temp = temp->copy(shape_data_->lw_, shape_data_->lh_);
HRGN region = bitmap2region(temp);
@@ -601,7 +601,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
Fl_X::i(pWindow)->xid = xid;
// compute window position and size in scaled units
float s = Fl::screen_driver()->scale(screen_num());
- int scaledX = ceil(X*s), scaledY= ceil(Y*s), scaledW = ceil(W*s), scaledH = ceil(H*s);
+ int scaledX = int(ceil(X*s)), scaledY= int(ceil(Y*s)), scaledW = int(ceil(W*s)), scaledH = int(ceil(H*s));
// Adjust for decorations (but not if that puts the decorations
// outside the screen)
if ((X != x()) || (Y != y())) {
@@ -649,7 +649,9 @@ int Fl_WinAPI_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h,
first_time = 0;
}
float s = Fl::screen_driver()->scale(screen_num());
- src_x *= s; src_y *= s; src_w *= s; src_h *= s; dest_x *= s; dest_y *= s;
+ src_x = int(src_x * s); src_y = int(src_y * s);
+ src_w = int(src_w * s); src_h = int(src_h * s);
+ dest_x = int(dest_x * s); dest_y = int(dest_y * s);
// Now check if the source scrolling area is fully visible.
// If it is, we will do a quick scroll and just update the
// newly exposed area. If it is not, we go the safe route and