From 55d43e6dfd890df0ce7b26f6c9cb5692e2c136b1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 18 Aug 2016 23:08:12 +0300 Subject: Fix some style issues. --- src/render/mobileopenglgraphics.cpp | 160 +++++++++++++++++------------------- 1 file changed, 75 insertions(+), 85 deletions(-) (limited to 'src/render') diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 64f01b8b3..83d57e33b 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -377,37 +377,33 @@ void MobileOpenGLGraphics::drawPatternCached(const Image *restrict const image, unsigned int vp = mVpCached; const unsigned int vLimit = mMaxVertices * 4; - // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - for (int py = 0; py < h; py += ih) + for (int py = 0; py < h; py += ih) + { + const int height = (py + ih >= h) ? h - py : ih; + const float texY2 = static_cast(srcY + height) / th; + const int dstY = y + py; + for (int px = 0; px < w; px += iw) { - const int height = (py + ih >= h) ? h - py : ih; - const float texY2 = static_cast(srcY + height) / th; - const int dstY = y + py; - for (int px = 0; px < w; px += iw) - { - const int width = (px + iw >= w) ? w - px : iw; - const int dstX = x + px; + const int width = (px + iw >= w) ? w - px : iw; + const int dstX = x + px; - const float texX2 = static_cast(srcX + width) / tw; + const float texX2 = static_cast(srcX + width) / tw; - vertFill2D(mFloatTexArrayCached, mShortVertArrayCached, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); + vertFill2D(mFloatTexArrayCached, mShortVertArrayCached, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); - vp += 12; - if (vp >= vLimit) - { - completeCache(); - vp = 0; - } + vp += 12; + if (vp >= vLimit) + { + completeCache(); + vp = 0; } } -// } + } mVpCached = vp; } @@ -499,38 +495,35 @@ void MobileOpenGLGraphics::drawPatternInline(const Image *restrict const image, unsigned int vp = 0; const unsigned int vLimit = mMaxVertices * 4; // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - for (int py = 0; py < h; py += ih) + for (int py = 0; py < h; py += ih) + { + const int height = (py + ih >= h) ? h - py : ih; + const float texY2 = static_cast(srcY + height) / th; + const int dstY = y + py; + for (int px = 0; px < w; px += iw) { - const int height = (py + ih >= h) ? h - py : ih; - const float texY2 = static_cast(srcY + height) / th; - const int dstY = y + py; - for (int px = 0; px < w; px += iw) - { - const int width = (px + iw >= w) ? w - px : iw; - const int dstX = x + px; + const int width = (px + iw >= w) ? w - px : iw; + const int dstX = x + px; - const float texX2 = static_cast(srcX + width) / tw; + const float texX2 = static_cast(srcX + width) / tw; - vertFill2D(mFloatTexArray, mShortVertArray, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); + vertFill2D(mFloatTexArray, mShortVertArray, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); - vp += 12; - if (vp >= vLimit) - { - drawTriangleArrayfs(vp); - vp = 0; - } + vp += 12; + if (vp >= vLimit) + { + drawTriangleArrayfs(vp); + vp = 0; } } - if (vp > 0) - drawTriangleArrayfs(vp); -// } + } + if (vp > 0) + drawTriangleArrayfs(vp); } void MobileOpenGLGraphics::drawRescaledPattern(const Image * @@ -568,49 +561,46 @@ void MobileOpenGLGraphics::drawRescaledPattern(const Image * const unsigned int vLimit = mMaxVertices * 4; // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float tw = static_cast(image->mTexWidth); - const float th = static_cast(image->mTexHeight); + const float tw = static_cast(image->mTexWidth); + const float th = static_cast(image->mTexHeight); - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - const float tFractionW = iw / tw; - const float tFractionH = ih / th; + const float tFractionW = iw / tw; + const float tFractionH = ih / th; - for (int py = 0; py < h; py += scaledHeight) + for (int py = 0; py < h; py += scaledHeight) + { + const int height = (py + scaledHeight >= h) + ? h - py : scaledHeight; + const int dstY = y + py; + const float visibleFractionH = static_cast(height) + / scaledHeight; + const float texY2 = texY1 + tFractionH * visibleFractionH; + for (int px = 0; px < w; px += scaledWidth) { - const int height = (py + scaledHeight >= h) - ? h - py : scaledHeight; - const int dstY = y + py; - const float visibleFractionH = static_cast(height) - / scaledHeight; - const float texY2 = texY1 + tFractionH * visibleFractionH; - for (int px = 0; px < w; px += scaledWidth) + const int width = (px + scaledWidth >= w) + ? w - px : scaledWidth; + const int dstX = x + px; + const float visibleFractionW = static_cast(width) + / scaledWidth; + const float texX2 = texX1 + tFractionW * visibleFractionW; + + vertFill2D(mFloatTexArray, mShortVertArray, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); + + vp += 12; + if (vp >= vLimit) { - const int width = (px + scaledWidth >= w) - ? w - px : scaledWidth; - const int dstX = x + px; - const float visibleFractionW = static_cast(width) - / scaledWidth; - const float texX2 = texX1 + tFractionW * visibleFractionW; - - vertFill2D(mFloatTexArray, mShortVertArray, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); - - vp += 12; - if (vp >= vLimit) - { - drawTriangleArrayfs(vp); - vp = 0; - } + drawTriangleArrayfs(vp); + vp = 0; } } - if (vp > 0) - drawTriangleArrayfs(vp); -// } + } + if (vp > 0) + drawTriangleArrayfs(vp); } inline void MobileOpenGLGraphics::drawVertexes(const -- cgit v1.2.3-60-g2f50