diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-22 21:17:15 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-23 08:21:40 +0200 |
commit | 236b87b8208349a3853866102e7a0b34544e84c7 (patch) | |
tree | 01cd8f6e165566dcef19e684b0e406ea55995b99 | |
parent | 3cd1fd8e0b11793d082c7f7ca4c9ddafd434971e (diff) | |
download | mana-236b87b8208349a3853866102e7a0b34544e84c7.tar.gz mana-236b87b8208349a3853866102e7a0b34544e84c7.tar.bz2 mana-236b87b8208349a3853866102e7a0b34544e84c7.tar.xz mana-236b87b8208349a3853866102e7a0b34544e84c7.zip |
Some cleanups in OpenGL code
* Removed empty and unused function `setTargetPlane`
* Removed duplicated enabling of `GL_VERTEX_ARRAY`
* Removed strange smoothing code from `drawRescaledImage`
-rw-r--r-- | src/openglgraphics.cpp | 37 | ||||
-rw-r--r-- | src/openglgraphics.h | 13 |
2 files changed, 1 insertions, 49 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 69b4b960..9844dc7c 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -303,19 +303,6 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, int desiredWidth, int desiredHeight, bool useColor) { - return drawRescaledImage(image, srcX, srcY, - dstX, dstY, - width, height, - desiredWidth, desiredHeight, - useColor, true); -} - -bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, - int dstX, int dstY, - int width, int height, - int desiredWidth, int desiredHeight, - bool useColor, bool smooth) -{ if (!image) return false; @@ -326,11 +313,6 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, width, height, useColor); } - // When the desired image is smaller than the current one, - // disable smooth effect. - if (width > desiredWidth && height > desiredHeight) - smooth = false; - srcX += image->mBounds.x; srcY += image->mBounds.y; @@ -345,20 +327,6 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, drawRescaledQuad(image, srcX, srcY, dstX, dstY, width, height, desiredWidth, desiredHeight); - if (smooth) // A basic smooth effect... - { - glColor4f(1.0f, 1.0f, 1.0f, 0.2f); - drawRescaledQuad(image, srcX, srcY, dstX - 1, dstY - 1, width, height, - desiredWidth + 1, desiredHeight + 1); - drawRescaledQuad(image, srcX, srcY, dstX + 1, dstY + 1, width, height, - desiredWidth - 1, desiredHeight - 1); - - drawRescaledQuad(image, srcX, srcY, dstX + 1, dstY, width, height, - desiredWidth - 1, desiredHeight); - drawRescaledQuad(image, srcX, srcY, dstX, dstY + 1, width, height, - desiredWidth, desiredHeight - 1); - } - if (!useColor) { glColor4ub(static_cast<GLubyte>(mColor.r), @@ -665,7 +633,6 @@ void OpenGLGraphics::_beginDraw() glLoadIdentity(); glEnable(GL_SCISSOR_TEST); - glEnableClientState(GL_VERTEX_ARRAY); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -810,10 +777,6 @@ void OpenGLGraphics::fillRectangle(const gcn::Rectangle& rect) drawRectangle(rect, true); } -void OpenGLGraphics::setTargetPlane(int width, int height) -{ -} - void OpenGLGraphics::setTexturingAndBlending(bool enable) { if (enable) diff --git a/src/openglgraphics.h b/src/openglgraphics.h index d61bf3db..a1d78e46 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -52,7 +52,7 @@ class OpenGLGraphics : public Graphics bool useColor); /** - * Draws a resclaled version of the image + * Draws a rescaled version of the image */ bool drawRescaledImage(Image *image, int srcX, int srcY, int dstX, int dstY, @@ -60,15 +60,6 @@ class OpenGLGraphics : public Graphics int desiredWidth, int desiredHeight, bool useColor); - /** - * Used to get the smooth rescale option over the standard function. - */ - bool drawRescaledImage(Image *image, int srcX, int srcY, - int dstX, int dstY, - int width, int height, - int desiredWidth, int desiredHeight, - bool useColor, bool smooth); - void drawImagePattern(Image *image, int x, int y, int w, int h); @@ -100,8 +91,6 @@ class OpenGLGraphics : public Graphics void fillRectangle(const gcn::Rectangle &rect); - void setTargetPlane(int width, int height); - /** * Takes a screenshot and returns it as SDL surface. */ |