From cbf2e289b8fbcb887a5479b8740ec557d3b5a167 Mon Sep 17 00:00:00 2001 From: gendlin <108626604+gendlin@users.noreply.github.com> Date: Wed, 28 Aug 2024 03:54:35 -0400 Subject: [PATCH] Blit directly to texture (#1870) * Blit directly to texture * Omit unneeded vars --- src/i_video.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index f5232bf6..5d87e8be 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -665,9 +665,12 @@ void I_StartFrame(void) static void UpdateRender(void) { + SDL_LockTexture(texture, &blit_rect, &argbbuffer->pixels, + &argbbuffer->pitch); + SDL_LowerBlit(screenbuffer, &blit_rect, argbbuffer, &blit_rect); - SDL_UpdateTexture(texture, &blit_rect, argbbuffer->pixels, - argbbuffer->pitch); + + SDL_UnlockTexture(texture); if (letterboxed) { @@ -1814,16 +1817,9 @@ static void CreateSurfaces(int w, int h) } // [FG] create intermediate ARGB frame buffer - { - uint32_t rmask, gmask, bmask, amask; - int bpp; - SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ARGB8888, &bpp, - &rmask, &gmask, &bmask, &amask); - argbbuffer = - SDL_CreateRGBSurface(0, w, h, bpp, rmask, gmask, bmask, amask); - SDL_FillRect(argbbuffer, NULL, 0); - } + argbbuffer = SDL_CreateRGBSurfaceWithFormatFrom( + NULL, w, h, 8, 0, SDL_PIXELFORMAT_ARGB8888); I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE));