From 6a34e5553db3e0cd052d9e83fd09a7457f845d7b Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Tue, 19 Sep 2017 06:11:09 +0200 Subject: [PATCH] GRAPHICS: Fix legacy OpenGL surface renderer incorrect y coordinates Fixes #1360. --- graphics/opengl/surfacerenderer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/opengl/surfacerenderer.cpp b/graphics/opengl/surfacerenderer.cpp index 95746a924fe..5e61b8cbdb6 100644 --- a/graphics/opengl/surfacerenderer.cpp +++ b/graphics/opengl/surfacerenderer.cpp @@ -104,11 +104,11 @@ void FixedSurfaceRenderer::prepareState() { void FixedSurfaceRenderer::render(const Texture *tex, const Math::Rect2d &dest) { float texcropX = tex->getWidth() / float(tex->getTexWidth()); float texcropY = tex->getHeight() / float(tex->getTexHeight()); - float texTop = _flipY ? 0.0 : texcropY; - float texBottom = _flipY ? texcropY : 0.0; + float texTop = _flipY ? 0.0f : texcropY; + float texBottom = _flipY ? texcropY : 0.0f; float offsetX = dest.getTopLeft().getX(); - float offsetY = dest.getTopLeft().getY(); + float offsetY = _flipY ? dest.getTopLeft().getY() : 1.0f - dest.getTopLeft().getY() - dest.getHeight(); float sizeX = fabsf(dest.getWidth()); float sizeY = fabsf(dest.getHeight());