From 3a28edfb7ac991ad70a7baf76f48218d9db89bcb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 10 Jun 2012 16:54:18 +0300 Subject: Split ImageHelper to ImageHelper, SDLImageHelper, OpenGLImageHelper. --- src/openglgraphics.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/openglgraphics.cpp') diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 3ca2a8c09..6b89f4bca 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -31,6 +31,7 @@ #include "resources/image.h" #include "resources/imagehelper.h" +#include "resources/openglimagehelper.h" #include "utils/stringutils.h" @@ -81,7 +82,7 @@ static inline void drawQuad(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) { - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. const float texX1 = static_cast(srcX) / @@ -143,7 +144,7 @@ static inline void drawRescaledQuad(Image *image, int width, int height, int desiredWidth, int desiredHeight) { - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. const float texX1 = static_cast(srcX) / @@ -214,7 +215,7 @@ bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -271,7 +272,7 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -324,14 +325,14 @@ void OpenGLGraphics::drawImagePattern(const Image *image, int x, int y, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); unsigned int vp = 0; const unsigned int vLimit = vertexBufSize * 4; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast(srcX) / tw; float texY1 = static_cast(srcY) / th; @@ -458,7 +459,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -466,7 +467,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, const unsigned int vLimit = vertexBufSize * 4; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { const float tw = static_cast(image->getTextureWidth()); const float th = static_cast(image->getTextureHeight()); @@ -598,7 +599,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, OpenGLGraphicsVertexes *ogl = vert->getOGL(); glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); std::vector *intVertPool = ogl->getIntVertPool(); @@ -609,7 +610,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, std::vector::const_iterator ivp_end = vp->end(); // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { std::vector *floatTexPool = ogl->getFloatTexPool(); std::vector::const_iterator ft; @@ -678,7 +679,7 @@ void OpenGLGraphics::calcImagePattern(GraphicsVertexes* vert, Image *image, ogl->init(); // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast(srcX) / tw; float texY1 = static_cast(srcY) / th; @@ -811,7 +812,7 @@ void OpenGLGraphics::calcTile(ImageVertexes *vert, int dstX, int dstY) unsigned int vp = ogl->ptr; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast(srcX) / tw; float texY1 = static_cast(srcY) / th; @@ -912,10 +913,10 @@ void OpenGLGraphics::drawTile(ImageVertexes *vert) OpenGLGraphicsVertexes *ogl = vert->ogl; glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) drawQuadArrayfi(ogl->mIntVertArray, ogl->mFloatTexArray, ogl->ptr); else drawQuadArrayii(ogl->mIntVertArray, ogl->mIntTexArray, ogl->ptr); @@ -1189,7 +1190,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable) { if (!mTexture) { - glEnable(ImageHelper::mTextureType); + glEnable(OpenGLImageHelper::mTextureType); mTexture = true; } @@ -1215,7 +1216,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable) if (mTexture) { - glDisable(ImageHelper::mTextureType); + glDisable(OpenGLImageHelper::mTextureType); mTexture = false; } } -- cgit v1.2.3-60-g2f50