summaryrefslogtreecommitdiff
path: root/src/render/mobileopenglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-15 02:14:22 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-15 02:14:22 +0300
commit93e4b8849a71be3ebf9e552a27fad8ffc4217a6a (patch)
treec1587ca959e44bb1e340bdaa11761e2a53898208 /src/render/mobileopenglgraphics.cpp
parentb2f9877c03a8af2a2c32b3d57470b6e573dc3c6a (diff)
downloadmanaverse-93e4b8849a71be3ebf9e552a27fad8ffc4217a6a.tar.gz
manaverse-93e4b8849a71be3ebf9e552a27fad8ffc4217a6a.tar.bz2
manaverse-93e4b8849a71be3ebf9e552a27fad8ffc4217a6a.tar.xz
manaverse-93e4b8849a71be3ebf9e552a27fad8ffc4217a6a.zip
Remove one condition form renderers.
Diffstat (limited to 'src/render/mobileopenglgraphics.cpp')
-rw-r--r--src/render/mobileopenglgraphics.cpp82
1 files changed, 40 insertions, 42 deletions
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index b2baa7d66..853757a22 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -291,7 +291,7 @@ void MobileOpenGLGraphics::drawImageInline(const Image *restrict const image,
debugBindTexture(image);
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
const SDL_Rect &imageRect = image->mBounds;
drawQuad(image, imageRect.x, imageRect.y,
@@ -427,7 +427,7 @@ void MobileOpenGLGraphics::completeCache() restrict2
// debugBindTexture(image);
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, mImageCached);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
drawTriangleArrayfsCached(mVpCached);
mImageCached = 0;
@@ -457,7 +457,7 @@ void MobileOpenGLGraphics::drawRescaledImage(const Image *restrict const image,
debugBindTexture(image);
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
// Draw a textured quad.
drawRescaledQuad(image, imageRect.x, imageRect.y, dstX, dstY,
@@ -500,7 +500,7 @@ void MobileOpenGLGraphics::drawPatternInline(const Image *restrict const image,
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
unsigned int vp = 0;
const unsigned int vLimit = mMaxVertices * 4;
@@ -565,7 +565,7 @@ void MobileOpenGLGraphics::drawRescaledPattern(const Image *
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
unsigned int vp = 0;
const unsigned int vLimit = mMaxVertices * 4;
@@ -757,7 +757,7 @@ void MobileOpenGLGraphics::drawTileCollection(const ImageCollection *
debugBindTexture(image);
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
drawVertexes(vert->ogl);
}
}
@@ -860,7 +860,7 @@ void MobileOpenGLGraphics::drawTileVertexes(const ImageVertexes *
debugBindTexture(image);
#endif // DEBUG_BIND_TEXTURE
bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage);
- setTexturingAndBlending(true);
+ enableTexturingAndBlending();
drawVertexes(vert->ogl);
}
@@ -1023,7 +1023,7 @@ void MobileOpenGLGraphics::drawPoint(int x A_UNUSED, int y A_UNUSED) restrict2
void MobileOpenGLGraphics::drawPoint(int x, int y) restrict2
#endif // ANDROID
{
- setTexturingAndBlending(false);
+ disableTexturingAndBlending();
restoreColor();
#ifdef ANDROID
@@ -1039,7 +1039,7 @@ void MobileOpenGLGraphics::drawPoint(int x, int y) restrict2
void MobileOpenGLGraphics::drawLine(int x1, int y1,
int x2, int y2) restrict2
{
- setTexturingAndBlending(false);
+ disableTexturingAndBlending();
restoreColor();
mShortVertArray[0] = static_cast<GLshort>(x1);
@@ -1060,43 +1060,41 @@ void MobileOpenGLGraphics::fillRectangle(const Rect &restrict rect) restrict2
drawRectangle(rect, true);
}
-void MobileOpenGLGraphics::setTexturingAndBlending(const bool enable) restrict2
+void MobileOpenGLGraphics::enableTexturingAndBlending() restrict2
{
- if (enable)
+ if (!mTexture)
{
- if (!mTexture)
- {
- mglEnable(OpenGLImageHelper::mTextureType);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- mTexture = true;
- }
+ mglEnable(OpenGLImageHelper::mTextureType);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ mTexture = true;
+ }
- if (!mAlpha)
- {
- mglEnable(GL_BLEND);
- mAlpha = true;
- }
+ if (!mAlpha)
+ {
+ mglEnable(GL_BLEND);
+ mAlpha = true;
}
- else
+}
+
+void MobileOpenGLGraphics::disableTexturingAndBlending() restrict2
+{
+ mTextureBinded = 0;
+ if (mAlpha && !mColorAlpha)
{
- mTextureBinded = 0;
- if (mAlpha && !mColorAlpha)
- {
- mglDisable(GL_BLEND);
- mAlpha = false;
- }
- else if (!mAlpha && mColorAlpha)
- {
- mglEnable(GL_BLEND);
- mAlpha = true;
- }
+ mglDisable(GL_BLEND);
+ mAlpha = false;
+ }
+ else if (!mAlpha && mColorAlpha)
+ {
+ mglEnable(GL_BLEND);
+ mAlpha = true;
+ }
- if (mTexture)
- {
- mglDisable(OpenGLImageHelper::mTextureType);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- mTexture = false;
- }
+ if (mTexture)
+ {
+ mglDisable(OpenGLImageHelper::mTextureType);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ mTexture = false;
}
}
@@ -1104,7 +1102,7 @@ void MobileOpenGLGraphics::drawRectangle(const Rect &restrict rect,
const bool filled) restrict2
{
BLOCK_START("Graphics::drawRectangle")
- setTexturingAndBlending(false);
+ disableTexturingAndBlending();
restoreColor();
const GLshort x = static_cast<GLshort>(rect.x);
@@ -1164,7 +1162,7 @@ void MobileOpenGLGraphics::drawNet(const int x1, const int y1,
unsigned int vp = 0;
const unsigned int vLimit = mMaxVertices * 4;
- setTexturingAndBlending(false);
+ disableTexturingAndBlending();
restoreColor();
const GLshort xs1 = static_cast<GLshort>(x1);