diff options
author | neonloop | 2021-03-14 19:27:02 +0000 |
---|---|---|
committer | neonloop | 2021-03-14 19:27:02 +0000 |
commit | 34c62fb129becec9e61a48227d9ed89867cdd470 (patch) | |
tree | 12268e577f3e74ad12c5f667e9603cc8904eb11b | |
parent | f38f9aaa0c05563ac012bb6e58fdcdf7f2973787 (diff) | |
download | pcsx_rearmed-34c62fb129becec9e61a48227d9ed89867cdd470.tar.gz pcsx_rearmed-34c62fb129becec9e61a48227d9ed89867cdd470.tar.bz2 pcsx_rearmed-34c62fb129becec9e61a48227d9ed89867cdd470.zip |
Skips an unnecessary copy if the screen doesn't need scaling
-rw-r--r-- | frontend/plat_trimui.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/frontend/plat_trimui.c b/frontend/plat_trimui.c index 5b99d97..46527c4 100644 --- a/frontend/plat_trimui.c +++ b/frontend/plat_trimui.c @@ -15,6 +15,7 @@ */ #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <string.h> #include <unistd.h> #include <sys/mman.h> @@ -158,7 +159,7 @@ void plat_minimize(void) { } -#define make_flip_func(name, blitfunc) \ +#define make_flip_func(name, scale, blitfunc) \ static void name(int doffs, const void *vram_, int w, int h, int sstride, int bgr24) \ { \ const unsigned short *vram = vram_; \ @@ -177,16 +178,20 @@ static void name(int doffs, const void *vram_, int w, int h, int sstride, int bg vram += psx_step * 1024, \ dst += dst_stride, \ conv += dst_stride) { \ - convertfunc(conv, vram, len); \ - blitfunc(dst, conv, dst_stride); \ + if (scale) { \ + convertfunc(conv, vram, len); \ + blitfunc(dst, conv, dst_stride); \ + } else { \ + convertfunc(dst, vram, len); \ + } \ } \ SDL_UnlockSurface(screen); \ } -make_flip_func(raw_blit_soft, memcpy) -make_flip_func(raw_blit_soft_368, blit320_368) -make_flip_func(raw_blit_soft_512, blit320_512) -make_flip_func(raw_blit_soft_640, blit320_640) +make_flip_func(raw_blit_soft, false, memcpy) +make_flip_func(raw_blit_soft_368, true, blit320_368) +make_flip_func(raw_blit_soft_512, true, blit320_512) +make_flip_func(raw_blit_soft_640, true, blit320_640) void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_) { @@ -301,8 +306,6 @@ void plat_sdl_event_handler(void *event_) void plat_init(void) { - int ret; - if (SDL_WasInit(SDL_INIT_EVERYTHING)) { SDL_InitSubSystem(SDL_INIT_VIDEO); } |