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.
This commit is contained in:
Jonas Kulla 2015-02-10 15:34:42 +01:00
parent 4864f63c6c
commit b2631d4c23
1 changed files with 2 additions and 3 deletions

View File

@ -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);