summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-02-26 19:48:47 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-02-26 19:48:47 +0100
commitfcf89b580eb832731caa3c33d4e7a94c86f1265e (patch)
tree4e47665feb3b8b8ec4d7196f98f2d7cd874c64d4
parent7810cda145dae1a0dfc739ec24078a73e3138088 (diff)
Fix Visual Studio build warnings in OpenGL graphics driver
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_line_style.cxx10
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx24
2 files changed, 17 insertions, 17 deletions
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_line_style.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_line_style.cxx
index c1963352b..95b73408b 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_line_style.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_line_style.cxx
@@ -32,7 +32,7 @@
void Fl_OpenGL_Graphics_Driver::line_style(int style, int width, char* dashes) {
if (width<1) width = 1;
- line_width_ = width;
+ line_width_ = (float)width;
int stipple = style & 0x00ff;
line_stipple_ = stipple;
@@ -46,16 +46,16 @@ void Fl_OpenGL_Graphics_Driver::line_style(int style, int width, char* dashes) {
char enable = 1;
switch (stipple & 0x00ff) {
case FL_DASH:
- glLineStipple(pixels_per_unit_*line_width_, 0x0F0F); // ....****....****
+ glLineStipple(GLint(pixels_per_unit_*line_width_), 0x0F0F); // ....****....****
break;
case FL_DOT:
- glLineStipple(pixels_per_unit_*line_width_, 0x5555); // .*.*.*.*.*.*.*.*
+ glLineStipple(GLint(pixels_per_unit_*line_width_), 0x5555); // .*.*.*.*.*.*.*.*
break;
case FL_DASHDOT:
- glLineStipple(pixels_per_unit_*line_width_, 0x2727); // ..*..***..*..***
+ glLineStipple(GLint(pixels_per_unit_*line_width_), 0x2727); // ..*..***..*..***
break;
case FL_DASHDOTDOT:
- glLineStipple(pixels_per_unit_*line_width_, 0x5757); // .*.*.***.*.*.***
+ glLineStipple(GLint(pixels_per_unit_*line_width_), 0x5757); // .*.*.***.*.*.***
break;
default:
glLineStipple(1, 0xFFFF);
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx
index 5b61b3a11..22956605c 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx
@@ -48,7 +48,7 @@ void Fl_OpenGL_Graphics_Driver::rect(int x, int y, int w, int h) {
void Fl_OpenGL_Graphics_Driver::rectf(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
- glRectf(x, y, x+w, y+h);
+ glRectf((GLfloat)x, (GLfloat)y, (GLfloat)(x+w), (GLfloat)(y+h));
}
void Fl_OpenGL_Graphics_Driver::line(int x, int y, int x1, int y1) {
@@ -91,20 +91,20 @@ void Fl_OpenGL_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y
void Fl_OpenGL_Graphics_Driver::xyline(int x, int y, int x1) {
float offset = line_width_ / 2.0f;
- float xx = x, yy = y+0.5f, rr = x1+1.0f;
+ float xx = (float)x, yy = y+0.5f, rr = x1+1.0f;
glRectf(xx, yy-offset, rr, yy+offset);
}
void Fl_OpenGL_Graphics_Driver::xyline(int x, int y, int x1, int y2) {
float offset = line_width_ / 2.0f;
- float xx = x, yy = y+0.5f, rr = x1+0.5f, bb = y2+1.0f;
+ float xx = (float)x, yy = y+0.5f, rr = x1+0.5f, bb = y2+1.0f;
glRectf(xx, yy-offset, rr+offset, yy+offset);
glRectf(rr-offset, yy+offset, rr+offset, bb);
}
void Fl_OpenGL_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
float offset = line_width_ / 2.0f;
- float xx = x, yy = y+0.5f, xx1 = x1+0.5f, rr = x3+1.0f, bb = y2+0.5;
+ float xx = (float)x, yy = y+0.5f, xx1 = x1+0.5f, rr = x3+1.0f, bb = y2+0.5f;
glRectf(xx, yy-offset, xx1+offset, yy+offset);
glRectf(xx1-offset, yy+offset, xx1+offset, bb+offset);
glRectf(xx1+offset, bb-offset, rr, bb+offset);
@@ -112,20 +112,20 @@ void Fl_OpenGL_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
void Fl_OpenGL_Graphics_Driver::yxline(int x, int y, int y1) {
float offset = line_width_ / 2.0f;
- float xx = x+0.5f, yy = y, bb = y1+1.0f;
+ float xx = x+0.5f, yy = (float)y, bb = y1+1.0f;
glRectf(xx-offset, yy, xx+offset, bb);
}
void Fl_OpenGL_Graphics_Driver::yxline(int x, int y, int y1, int x2) {
float offset = line_width_ / 2.0f;
- float xx = x+0.5f, yy = y, rr = x2+1.0f, bb = y1+0.5f;
+ float xx = x+0.5f, yy = (float)y, rr = x2+1.0f, bb = y1+0.5f;
glRectf(xx-offset, yy, xx+offset, bb+offset);
glRectf(xx+offset, bb-offset, rr, bb+offset);
}
void Fl_OpenGL_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) {
float offset = line_width_ / 2.0f;
- float xx = x+0.5f, yy = y, yy1 = y1+0.5f, rr = x2+0.5f, bb = y3+1.0f;
+ float xx = x+0.5f, yy = (float)y, yy1 = y1+0.5f, rr = x2+0.5f, bb = y3+1.0f;
glRectf(xx-offset, yy, xx+offset, yy1+offset);
glRectf(xx+offset, yy1-offset, rr+offset, yy1+offset);
glRectf(rr-offset, yy1+offset, rr+offset, bb);
@@ -175,7 +175,7 @@ void Fl_OpenGL_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
glVertex2f(x+w+0.5f, y+h+0.5f);
glVertex2f(x+0.5f, y+h+0.5f);
glEnd();
- line_style(stipple, width);
+ line_style(stipple, (int)width);
}
@@ -205,10 +205,10 @@ typedef struct Fl_Gl_Region {
Fl_Gl_Window *win = Fl_Gl_Window::current()->as_gl_window();
if (win) {
float scale = win->pixels_per_unit();
- gl_x = x*scale;
- gl_y = (win->h()-h-y+1)*scale;
- gl_w = (w-1)*scale;
- gl_h = (h-1)*scale;
+ gl_x = int(x*scale);
+ gl_y = int((win->h()-h-y+1)*scale);
+ gl_w = int((w-1)*scale);
+ gl_h = int((h-1)*scale);
if (inX<=0 && inY<=0 && inX+inW>win->w() && inY+inH>=win->h()) {
state = kStateFull;
}