diff options
author | gameblabla | 2020-12-26 08:53:03 +0100 |
---|---|---|
committer | gameblabla | 2020-12-26 08:53:03 +0100 |
commit | 2c41876dd9913c2a49cd044a805df54915b95f0f (patch) | |
tree | e04b3f224a90c217289c49b84129faac19bf1248 /shell/video/sdl | |
parent | 4c1a193d483b10ef63c27553f6e6e95af23552b8 (diff) | |
download | snesemu-2c41876dd9913c2a49cd044a805df54915b95f0f.tar.gz snesemu-2c41876dd9913c2a49cd044a805df54915b95f0f.tar.bz2 snesemu-2c41876dd9913c2a49cd044a805df54915b95f0f.zip |
Fix issue wit pitch being doubled by 2.
Change all of the code accordingly and simplify it.
This was made as to allocate less memory than needed, improve the speed of the scaler code
and make it more suitable for IPU mode.
Diffstat (limited to 'shell/video/sdl')
-rw-r--r-- | shell/video/sdl/video_blit.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/shell/video/sdl/video_blit.c b/shell/video/sdl/video_blit.c index b4a6bbe..0e489c0 100644 --- a/shell/video/sdl/video_blit.c +++ b/shell/video/sdl/video_blit.c @@ -54,7 +54,7 @@ void Init_Video() SDL_ShowCursor(0); - sdl_screen = SDL_SetVideoMode(0, 0, 16, SDL_HWSURFACE); + sdl_screen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE); backbuffer = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 240, 16, 0,0,0,0); @@ -78,12 +78,13 @@ void Video_Close() void Update_Video_Menu() { + SDL_SoftStretch(backbuffer, NULL, sdl_screen, NULL); SDL_Flip(sdl_screen); } void Update_Video_Ingame() { - uint32_t *s, *d; + uint16_t *s, *d; uint32_t h, w; uint8_t PAL = !!(Memory.FillRAM[0x2133] & 4); @@ -92,17 +93,16 @@ void Update_Video_Ingame() switch(option.fullscreen) { case 0: - s = (uint32_t*) GFX.Screen; - d = (uint32_t*) sdl_screen->pixels + ((sdl_screen->w - IPPU.RenderedScreenWidth)/4 + (sdl_screen->h - IPPU.RenderedScreenHeight) * 160) - (PAL ? 0 : 4*320); - for(uint8_t y = 0; y < IPPU.RenderedScreenHeight; y++, s += IPPU.RenderedScreenWidth, d += sdl_screen->w/2) memmove(d, s, IPPU.RenderedScreenWidth * 2); - + s = (uint16_t*) GFX.Screen; + d = (uint16_t*) sdl_screen->pixels + ((sdl_screen->w - IPPU.RenderedScreenWidth)/2 + (sdl_screen->h - IPPU.RenderedScreenHeight) * 160) - (PAL ? 0 : 2*320); + for(uint8_t y = 0; y < IPPU.RenderedScreenHeight; y++, s += IPPU.RenderedScreenWidth, d += sdl_screen->w) memmove(d, s, IPPU.RenderedScreenWidth * 2); break; case 1: - upscale_256xXXX_to_320x240((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, SNES_WIDTH, PAL ? 240 : 224); + upscale_256xXXX_to_320x240((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, PAL ? 240 : 224); break; case 2: - if (IPPU.RenderedScreenHeight == 240) upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, SNES_WIDTH, 239); - else upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels + (160*8), (uint32_t*) GFX.Screen, SNES_WIDTH, 224); + if (IPPU.RenderedScreenHeight == 240) upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, 239); + else upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels + (160*8), (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, 224); break; } //bitmap_scale(0, 0, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, sdl_screen->w, sdl_screen->h, SNES_WIDTH*2, 0, GFX.Screen, sdl_screen->pixels); |