From b2631d4c231b5d8fe3c0ad48de89a36295ff90de Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Tue, 10 Feb 2015 15:34:42 +0100
Subject: [PATCH] Bitmap: Fix scaled blit from mega surface to texture

SDL's default blend mode for surfaces (SDL_BLENDMODE_BLEND)
renders the source surface unusable for further use.
---
 src/bitmap.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/bitmap.cpp b/src/bitmap.cpp
index ced85fd..2342d7b 100644
--- a/src/bitmap.cpp
+++ b/src/bitmap.cpp
@@ -251,6 +251,7 @@ Bitmap::Bitmap(const char *filename)
 		/* Mega surface */
 		p = new BitmapPrivate(this);
 		p->megaSurface = imgSurf;
+		SDL_SetSurfaceBlendMode(p->megaSurface, SDL_BLENDMODE_NONE);
 	}
 	else
 	{
@@ -429,9 +430,7 @@ void Bitmap::stretchBlt(const IntRect &destRect,
 		SDL_Surface *blitTemp =
 			SDL_CreateRGBSurface(0, destRect.w, destRect.h, bpp, rMask, gMask, bMask, aMask);
 
-		// FXIME: This is supposed to be a scaled blit, put SDL2 for some reason
-		// makes the source surface unusable after BlitScaled() is called. Investigate!
-		SDL_BlitSurface(srcSurf, &srcRect, blitTemp, 0);
+		SDL_BlitScaled(srcSurf, &srcRect, blitTemp, 0);
 
 		TEX::bind(p->gl.tex);