From 45a17142524b79254b0b87a8385ee36cbfac79ce Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Apr 2016 04:04:00 +0300 Subject: Fix code style. --- src/render/mobileopengl2graphics.cpp | 76 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 36 deletions(-) (limited to 'src/render') diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index 65ed66a76..ed2ca8b17 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -267,10 +267,10 @@ void MobileOpenGL2Graphics::drawQuad(const int srcX, const int width, const int height) restrict2 { - const GLfloat texX2 = srcX + width; - const GLfloat texY2 = srcY + height; - const GLfloat x2 = dstX + width; - const GLfloat y2 = dstY + height; + const GLfloat texX2 = static_cast(srcX + width); + const GLfloat texY2 = static_cast(srcY + height); + const GLfloat x2 = static_cast(dstX + width); + const GLfloat y2 = static_cast(dstY + height); const GLfloat srcX2 = toGL(srcX); const GLfloat srcY2 = toGL(srcY); const GLfloat dstX2 = toGL(dstX); @@ -298,10 +298,10 @@ void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY, const int desiredWidth, const int desiredHeight) restrict2 { - const GLfloat texX2 = srcX + width; - const GLfloat texY2 = srcY + height; - const GLfloat x2 = dstX + desiredWidth; - const GLfloat y2 = dstY + desiredHeight; + const GLfloat texX2 = static_cast(srcX + width); + const GLfloat texY2 = static_cast(srcY + height); + const GLfloat x2 = static_cast(dstX + desiredWidth); + const GLfloat y2 = static_cast(dstY + desiredHeight); const GLfloat srcX2 = toGL(srcX); const GLfloat srcY2 = toGL(srcY); const GLfloat dstX2 = toGL(dstX); @@ -486,13 +486,13 @@ void MobileOpenGL2Graphics::drawPatternInline(const Image * for (int py = 0; py < h; py += ih) { const int height = (py + ih >= h) ? h - py : ih; - const GLfloat texY2 = srcY + height; - const GLfloat dstY = y2 + py; + const GLfloat texY2 = static_cast(srcY + height); + const GLfloat dstY = static_cast(y2 + py); for (int px = 0; px < w; px += iw) { const int width = (px + iw >= w) ? w - px : iw; - const GLfloat dstX = x2 + px; - const GLfloat texX2 = srcX + width; + const GLfloat dstX = static_cast(x2 + px); + const GLfloat texX2 = static_cast(srcX + width); vertFill2D(mFloatArray, srcX2, srcY2, texX2, texY2, @@ -558,18 +558,20 @@ void MobileOpenGL2Graphics::drawRescaledPattern(const Image * { const int height = (py + scaledHeight >= h) ? h - py : scaledHeight; - const GLfloat dstY = y2 + py; + const GLfloat dstY = static_cast(y2 + py); const GLfloat scaledY = srcY + height / scaleFactorH; for (int px = 0; px < w; px += scaledWidth) { const int width = (px + scaledWidth >= w) ? w - px : scaledWidth; - const int dstX = x2 + px; + const GLfloat dstX = static_cast(x2 + px); const GLfloat scaledX = srcX + width / scaleFactorW; vertFill2D(mFloatArray, - srcX2, srcY2, scaledX, scaledY, - dstX, dstY, width, height); + srcX2, srcY2, + scaledX, scaledY, + dstX, dstY, + static_cast(width), static_cast(height)); vp += 24; if (vp >= vLimit) @@ -652,13 +654,15 @@ void MobileOpenGL2Graphics::calcPatternInline(ImageVertexes * for (int py = 0; py < h; py += ih) { - const GLfloat height = (py + ih >= h) ? h - py : ih; - const GLfloat dstY = y2 + py; + const GLfloat height = static_cast( + (py + ih >= h) ? h - py : ih); + const GLfloat dstY = static_cast(y2 + py); const GLfloat texY2 = srcY + height; for (int px = 0; px < w; px += iw) { - const GLfloat width = (px + iw >= w) ? w - px : iw; - const GLfloat dstX = x2 + px; + const GLfloat width = static_cast( + (px + iw >= w) ? w - px : iw); + const GLfloat dstX = static_cast(x2 + px); const GLfloat texX2 = srcX2 + width; vertFill2D(floatArray, @@ -777,8 +781,8 @@ void MobileOpenGL2Graphics::calcTileVertexesInline(ImageVertexes * const GLfloat srcY2 = toGL(srcY); const ClipRect &clipArea = mClipStack.top(); - const GLfloat x2 = dstX + clipArea.xOffset; - const GLfloat y2 = dstY + clipArea.yOffset; + const GLfloat x2 = static_cast(dstX + clipArea.xOffset); + const GLfloat y2 = static_cast(dstY + clipArea.yOffset); const unsigned int vLimit = mMaxVertices * 4; @@ -786,8 +790,8 @@ void MobileOpenGL2Graphics::calcTileVertexesInline(ImageVertexes * unsigned int vp = ogl.continueVp(); - GLfloat texX2 = srcX + w; - GLfloat texY2 = srcY + h; + GLfloat texX2 = static_cast(srcX + w); + GLfloat texY2 = static_cast(srcY + h); GLfloat *const floatArray = ogl.continueFloatTexArray(); @@ -950,10 +954,10 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect) restrict2 setTexturingAndBlending(false); bindArrayBufferAndAttributes(mVbo); const ClipRect &clipArea = mClipStack.top(); - const GLfloat x1 = rect.x + clipArea.xOffset; - const GLfloat y1 = rect.y + clipArea.yOffset; - const GLfloat x2 = x1 + rect.width; - const GLfloat y2 = y1 + rect.height; + const GLfloat x1 = static_cast(rect.x + clipArea.xOffset); + const GLfloat y1 = static_cast(rect.y + clipArea.yOffset); + const GLfloat x2 = x1 + static_cast(rect.width); + const GLfloat y2 = y1 + static_cast(rect.height); GLfloat vertices[] = { x1, y1, 0.0f, 0.0f, @@ -975,10 +979,10 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2 setTexturingAndBlending(false); bindArrayBufferAndAttributes(mVbo); const ClipRect &clipArea = mClipStack.top(); - const GLfloat x1 = rect.x + clipArea.xOffset; - const GLfloat y1 = rect.y + clipArea.yOffset; - const GLfloat x2 = x1 + rect.width; - const GLfloat y2 = y1 + rect.height; + const GLfloat x1 = static_cast(rect.x + clipArea.xOffset); + const GLfloat y1 = static_cast(rect.y + clipArea.yOffset); + const GLfloat x2 = x1 + static_cast(rect.width); + const GLfloat y2 = y1 + static_cast(rect.height); GLfloat vertices[] = { x1, y1, 0.0f, 0.0f, @@ -1049,8 +1053,8 @@ void MobileOpenGL2Graphics::drawNet(const int x1, setTexturingAndBlending(false); bindArrayBufferAndAttributes(mVbo); const ClipRect &clipArea = mClipStack.top(); - const GLfloat dx = clipArea.xOffset; - const GLfloat dy = clipArea.yOffset; + const GLfloat dx = static_cast(clipArea.xOffset); + const GLfloat dy = static_cast(clipArea.yOffset); const GLfloat xs1 = x1 + dx; const GLfloat xs2 = x2 + dx; @@ -1115,8 +1119,8 @@ void MobileOpenGL2Graphics::bindTexture2(const GLenum target, mTextureWidth = image->mTexWidth; mTextureHeight = image->mTexHeight; mglUniform2f(mTextureSizeUniform, - image->mTexWidth, - image->mTexHeight); + static_cast(image->mTexWidth), + static_cast(image->mTexHeight)); } } } -- cgit v1.2.3-60-g2f50