From f4792bc06f21335fc2d1171d937ea7645ca0c253 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Mar 2011 22:13:37 +0200 Subject: Fix most conversions except manaserv net code and some other code. --- src/opengl1graphics.cpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'src/opengl1graphics.cpp') diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index 03742ccb3..3dfe06ecf 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -121,11 +121,13 @@ static inline void drawQuad(Image *image, if (image->getTextureType() == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. - float texX1 = srcX / static_cast(image->getTextureWidth()); - float texY1 = srcY / static_cast(image->getTextureHeight()); - float texX2 = (srcX + width) / static_cast( + float texX1 = static_cast(srcX) + / static_cast(image->getTextureWidth()); + float texY1 = static_cast(srcY) + / static_cast(image->getTextureHeight()); + float texX2 = static_cast(srcX + width) / static_cast( image->getTextureWidth()); - float texY2 = (srcY + height) / static_cast( + float texY2 = static_cast(srcY + height) / static_cast( image->getTextureHeight()); glTexCoord2f(texX1, texY1); @@ -157,11 +159,13 @@ static inline void drawRescaledQuad(Image *image, int srcX, int srcY, if (image->getTextureType() == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. - float texX1 = srcX / static_cast(image->getTextureWidth()); - float texY1 = srcY / static_cast(image->getTextureHeight()); - float texX2 = (srcX + width) / static_cast( + float texX1 = static_cast(srcX) + / static_cast(image->getTextureWidth()); + float texY1 = static_cast(srcY) + / static_cast(image->getTextureHeight()); + float texX2 = static_cast(srcX + width) / static_cast( image->getTextureWidth()); - float texY2 = (srcY + height) / static_cast( + float texY2 = static_cast(srcY + height) / static_cast( image->getTextureHeight()); glTexCoord2f(texX1, texY1); @@ -383,7 +387,8 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y, glEnd(); - glColor4ub(mColor.r, mColor.g, mColor.b, mColor.a); + glColor4ub(static_cast(mColor.r), static_cast(mColor.g), + static_cast(mColor.b), static_cast(mColor.a)); } void OpenGL1Graphics::updateScreen() @@ -525,12 +530,12 @@ void OpenGL1Graphics::drawLine(int x1, int y1, int x2, int y2) setTexturingAndBlending(false); glBegin(GL_LINES); - glVertex2f(x1 + 0.5f, y1 + 0.5f); - glVertex2f(x2 + 0.5f, y2 + 0.5f); + glVertex2f(static_cast(x1) + 0.5f, static_cast(y1) + 0.5f); + glVertex2f(static_cast(x2) + 0.5f, static_cast(y2) + 0.5f); glEnd(); glBegin(GL_POINTS); - glVertex2f(x2 + 0.5f, y2 + 0.5f); + glVertex2f(static_cast(x2) + 0.5f, static_cast(y2) + 0.5f); glEnd(); } @@ -593,10 +598,14 @@ void OpenGL1Graphics::drawRectangle(const gcn::Rectangle& rect, bool filled) setTexturingAndBlending(false); glBegin(filled ? GL_QUADS : GL_LINE_LOOP); - glVertex2f(rect.x + offset, rect.y + offset); - glVertex2f(rect.x + rect.width - offset, rect.y + offset); - glVertex2f(rect.x + rect.width - offset, rect.y + rect.height - offset); - glVertex2f(rect.x + offset, rect.y + rect.height - offset); + glVertex2f(static_cast(rect.x) + offset, + static_cast(rect.y) + offset); + glVertex2f(static_cast(rect.x + rect.width) - offset, + static_cast(rect.y) + offset); + glVertex2f(static_cast(rect.x + rect.width) - offset, + static_cast(rect.y + rect.height) - offset); + glVertex2f(static_cast(rect.x) + offset, + static_cast(rect.y + rect.height) - offset); glEnd(); } -- cgit v1.2.3-60-g2f50