From 052f7900c23cd361a99e88461ed9e8b23db58eea Mon Sep 17 00:00:00 2001
From: Magnus Norddahl <dpjudas@users.noreply.github.com>
Date: Wed, 12 Oct 2016 08:04:42 +0200
Subject: [PATCH] Fix swapped x and y in DrawLetterbox

---
 src/gl/system/gl_swframebuffer.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp
index 252153b54..cffee9b91 100644
--- a/src/gl/system/gl_swframebuffer.cpp
+++ b/src/gl/system/gl_swframebuffer.cpp
@@ -1343,24 +1343,24 @@ void OpenGLSWFrameBuffer::DrawLetterbox(int x, int y, int width, int height)
 
 	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 	glEnable(GL_SCISSOR_TEST);
-	if (x > 0)
-	{
-		glScissor(0, 0, clientWidth, x);
-		glClear(GL_COLOR_BUFFER_BIT);
-	}
-	if (clientHeight - x - height > 0)
-	{
-		glScissor(0, x + height, clientWidth, clientHeight - x - height);
-		glClear(GL_COLOR_BUFFER_BIT);
-	}
 	if (y > 0)
 	{
-		glScissor(0, x, y, height);
+		glScissor(0, 0, clientWidth, y);
 		glClear(GL_COLOR_BUFFER_BIT);
 	}
-	if (clientWidth - y - width > 0)
+	if (clientHeight - y - height > 0)
 	{
-		glScissor(y + width, x, clientWidth - y - width, height);
+		glScissor(0, y + height, clientWidth, clientHeight - y - height);
+		glClear(GL_COLOR_BUFFER_BIT);
+	}
+	if (x > 0)
+	{
+		glScissor(0, y, x, height);
+		glClear(GL_COLOR_BUFFER_BIT);
+	}
+	if (clientWidth - x - width > 0)
+	{
+		glScissor(x + width, y, clientWidth - x - width, height);
 		glClear(GL_COLOR_BUFFER_BIT);
 	}
 	glDisable(GL_SCISSOR_TEST);