diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx | 2 | ||||
| -rw-r--r-- | src/gl_draw.cxx | 23 | ||||
| -rw-r--r-- | src/gl_start.cxx | 2 | ||||
| -rw-r--r-- | src/glut_compatibility.cxx | 2 |
5 files changed, 16 insertions, 15 deletions
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx index 48a185410..27360ccee 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx @@ -61,7 +61,7 @@ Fl_RGB_Image* Fl_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int w, int int ns = Fl_Window_Driver::driver(glw)->screen_num(); float s = Fl::screen_driver()->scale(ns); if (s != 1) { - x *= s; y *= s; w *= s; h *= s; + x = int(x * s); y = int(y * s); w = int(w * s); h = int(h * s); } // Read a block of pixels from the frame buffer int mByteWidth = w * 3; diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx index 0a627bea6..0a92a9b2f 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx @@ -108,7 +108,7 @@ void Fl_OpenGL_Graphics_Driver::circle(double cx, double cy, double r) { int num_segments = (int)(10 * sqrt(rMax))+1; double theta = 2 * M_PI / float(num_segments); double tangetial_factor = tan(theta); - double radial_factor = cosf(theta);//calculate the radial factor + double radial_factor = cos(theta);//calculate the radial factor double x = r; //we start at angle = 0 double y = 0; diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 043d1c1f3..048510266 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -37,6 +37,7 @@ #include <FL/gl.h> #include <FL/gl_draw.H> #include <FL/fl_draw.H> +#include <FL/math.h> // for ceil() #include "Fl_Gl_Window_Driver.H" #include <FL/Fl_Image_Surface.H> #include <FL/glu.h> // for gluUnProject() @@ -154,7 +155,7 @@ void gl_draw(const char* str, int n, float x, float y) { \see gl_texture_pile_height(int) */ void gl_draw(const char* str) { - gl_draw(str, strlen(str)); + gl_draw(str, (int)strlen(str)); } /** @@ -162,7 +163,7 @@ void gl_draw(const char* str) { \see gl_texture_pile_height(int) */ void gl_draw(const char* str, int x, int y) { - gl_draw(str, strlen(str), x, y); + gl_draw(str, (int)strlen(str), x, y); } /** @@ -170,7 +171,7 @@ void gl_draw(const char* str, int x, int y) { \see gl_texture_pile_height(int) */ void gl_draw(const char* str, float x, float y) { - gl_draw(str, strlen(str), x, y); + gl_draw(str, (int)strlen(str), x, y); } static void gl_draw_invert(const char* str, int n, int x, int y) { @@ -359,11 +360,11 @@ void gl_texture_fifo::display_texture(int rank) float oy = pos[1] + height - Fl_Gl_Window_Driver::gl_scale * fl_descent(); glTexCoord2f (0.0f, 0.0f); // draw lower left in world coordinates glVertex2f (ox, oy); - glTexCoord2f (0.0f, height); // draw upper left in world coordinates + glTexCoord2f (0.0f, (GLfloat)height); // draw upper left in world coordinates glVertex2f (ox, oy - height); - glTexCoord2f (width, height); // draw upper right in world coordinates + glTexCoord2f ((GLfloat)width, (GLfloat)height); // draw upper right in world coordinates glVertex2f (ox + width, oy - height); - glTexCoord2f (width, 0.0f); // draw lower right in world coordinates + glTexCoord2f ((GLfloat)width, 0.0f); // draw lower right in world coordinates glVertex2f (ox + width, oy); glEnd (); glPopAttrib(); @@ -405,10 +406,10 @@ int gl_texture_fifo::compute_texture(const char* str, int n) fifo[current].str_len = n; // record length of text in utf8 fl_graphics_driver->font_descriptor(gl_fontsize); int w, h; - w = fl_width(fifo[current].utf8, n) * Fl_Gl_Window_Driver::gl_scale; + w = int(ceil(fl_width(fifo[current].utf8, n) * Fl_Gl_Window_Driver::gl_scale)); // Hack - make w be aligned w = (w + 3) & (~3); - h = fl_height() * Fl_Gl_Window_Driver::gl_scale; + h = int(ceil(fl_height() * Fl_Gl_Window_Driver::gl_scale)); fifo[current].scale = Fl_Gl_Window_Driver::gl_scale; fifo[current].fdesc = gl_fontsize; @@ -549,7 +550,7 @@ void Fl_Gl_Window_Driver::draw_string_legacy_get_list(const char* str, int n) { int size = 0; if (gl_start_scale != 1) { // using gl_start() / gl_finish() size = fl_graphics_driver->font_descriptor()->size; - gl_font(fl_font(), size * gl_start_scale); + gl_font(fl_font(), Fl_Fontsize(size * gl_start_scale)); } for (unsigned i = 0; i < wn; i++) { unsigned int r; @@ -579,7 +580,7 @@ void Fl_Gl_Window_Driver::draw_string_legacy_glut(const char* str, int n) fl_graphics_driver->font_descriptor(gl_fontsize); Fl_Gl_Window *gwin = Fl_Window::current()->as_gl_window(); gl_scale = (gwin ? gwin->pixels_per_unit() : 1); - float ratio = fl_width((char*)str_nul, n) * gl_scale/glutStrokeLength(GLUT_STROKE_ROMAN, str_nul); + float ratio = float(fl_width((char*)str_nul, n) * gl_scale/glutStrokeLength(GLUT_STROKE_ROMAN, str_nul)); Fl_Surface_Device::pop_current(); //setup matrices @@ -605,7 +606,7 @@ void Fl_Gl_Window_Driver::draw_string_legacy_glut(const char* str, int n) glTranslatef (-winw/R, -winh/R, 0.0f); glTranslatef(pos[0]*2/R, pos[1]*2/R, 0.0); glutStrokeString(GLUT_STROKE_ROMAN, str_nul); - float width = fl_width((char*)str_nul); + float width = float(fl_width((char*)str_nul)); delete[] str_nul; glPopAttrib(); // reset original matrices diff --git a/src/gl_start.cxx b/src/gl_start.cxx index 9c13dac0a..15ec99168 100644 --- a/src/gl_start.cxx +++ b/src/gl_start.cxx @@ -77,7 +77,7 @@ void gl_start() { if (fl_clip_box(0, 0, Fl_Window::current()->w(), Fl_Window::current()->h(), x, y, w, h)) { fl_clip_region(Fl_Graphics_Driver::default_driver().XRectangleRegion(x,y,w,h)); - glScissor(x*gl_start_scale, (Fl_Window::current()->h()-(y+h))*gl_start_scale, w*gl_start_scale, h*gl_start_scale); + glScissor(int(x*gl_start_scale), int((Fl_Window::current()->h()-(y+h))*gl_start_scale), int(w*gl_start_scale), int(h*gl_start_scale)); glEnable(GL_SCISSOR_TEST); } else { glDisable(GL_SCISSOR_TEST); diff --git a/src/glut_compatibility.cxx b/src/glut_compatibility.cxx index df657a808..cf51e1319 100644 --- a/src/glut_compatibility.cxx +++ b/src/glut_compatibility.cxx @@ -454,7 +454,7 @@ int glutExtensionSupported( const char* extension ) if (!extension || strchr(extension, ' ')) return 0; const char *extensions, *start; - const int len = strlen( extension ); + const int len = (const int)strlen( extension ); start = extensions = (const char *) glGetString(GL_EXTENSIONS); |
