shithub: cstory

Download patch

ref: f90d45cb7352367817a2d3253dfc9ed749491861
parent: a2c86d9f7c57a854e0ea0866eef9810563b6bde2
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Jan 22 19:08:54 EST 2019

Fix some Draw.cpp bugs

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -206,7 +206,7 @@
 	ReleaseSurface(surf_no);
 	
 	//Create surface
-	surf[surf_no].texture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, bxsize * gWindowScale, bysize * gWindowScale);
+	surf[surf_no].texture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET, bxsize * gWindowScale, bysize * gWindowScale);
 	
 	if (!surf[surf_no].texture)
 	{
@@ -231,7 +231,7 @@
 	SDL_GetRendererOutputSize(gRenderer, &w, &h);
 
 	//Get texture of what's currently rendered on screen
-	SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(SDL_TEXTUREACCESS_TARGET, w, h, 0, SDL_PIXELFORMAT_RGB888);
+	SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, SDL_PIXELFORMAT_RGBA32);
 	SDL_RenderReadPixels(gRenderer, nullptr, SDL_PIXELFORMAT_RGBA32, surface->pixels, surface->pitch);
 
 	SDL_Texture *screenTexture = SDL_CreateTextureFromSurface(gRenderer, surface);
@@ -247,6 +247,8 @@
 	SDL_SetRenderTarget(gRenderer, surf[surf_no].texture);
 	SDL_RenderCopy(gRenderer, screenTexture, &frameRect, &destRect);
 	SDL_SetRenderTarget(gRenderer, NULL);
+
+	SDL_DestroyTexture(screenTexture);
 }
 
 void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, int surf_no) //Transparency
--