--- previous/src/fast_screen.c 2018/04/24 19:31:10 1.1.1.2 +++ previous/src/fast_screen.c 2018/04/24 19:33:09 1.1.1.3 @@ -17,10 +17,10 @@ const char Screen_fileid[] = "Previous f #include "configuration.h" #include "log.h" #include "m68000.h" -#include "dimension.h" +#include "dimension.hpp" +#include "nd_mem.hpp" #include "paths.h" #include "screen.h" -#include "control.h" #include "statusbar.h" #include "video.h" @@ -113,65 +113,64 @@ static void blitColor(SDL_Texture* tex) /* Dimension format is 8bit per pixel, big-endian: RRGGBBAA */ -void blitDimension(SDL_Texture* tex) { +void blitDimension(Uint32* vram, SDL_Texture* tex) { #if ND_STEP - Uint32* src = (Uint32*)&ND_vram[0]; + Uint32* src = &vram[0]; #else - Uint32* src = (Uint32*)&ND_vram[16]; + Uint32* src = &vram[16]; #endif - void* pixels; int d; Uint32 format; SDL_QueryTexture(tex, &format, &d, &d, &d); - SDL_LockTexture(tex, NULL, &pixels, &d); - Uint32* dst = (Uint32*)pixels; if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { /* Add big-endian accelerated blit loops as needed here */ switch (format) { default: { + void* pixels; + SDL_LockTexture(tex, NULL, &pixels, &d); + Uint32* dst = (Uint32*)pixels; + /* fallback to SDL_MapRGB */ SDL_PixelFormat* pformat = SDL_AllocFormat(format); for(int y = NeXT_SCRN_HEIGHT; --y >= 0;) { for(int x = NeXT_SCRN_WIDTH; --x >= 0;) { Uint32 v = *src++; - *dst++ = SDL_MapRGB(pformat, (v >> 24) & 0xFF, (v>>16) & 0xFF, (v>>8) & 0xFF); + *dst++ = SDL_MapRGB(pformat, (v >> 8) & 0xFF, (v>>16) & 0xFF, (v>>24) & 0xFF); } src += 32; } SDL_FreeFormat(pformat); + SDL_UnlockTexture(tex); break; } } } else { /* Add little-endian accelerated blit loops as needed here */ switch (format) { - case SDL_PIXELFORMAT_ARGB8888: - for(int y = NeXT_SCRN_HEIGHT; --y >= 0;) { - for(int x = NeXT_SCRN_WIDTH; --x >= 0;) { - // Uint32 LE: AABBGGRR - // Target: AARRGGBB - Uint32 v = *src++; - *dst++ = (v & 0xFF000000) | ((v<<16) &0x00FF0000) | (v &0x0000FF00) | ((v>>16) &0x000000FF); - } - src += 32; - } + case SDL_PIXELFORMAT_ARGB8888: { + SDL_UpdateTexture(tex, NULL, src, (NeXT_SCRN_WIDTH+32)*4); break; + } default: { + void* pixels; + SDL_LockTexture(tex, NULL, &pixels, &d); + Uint32* dst = (Uint32*)pixels; + /* fallback to SDL_MapRGB */ SDL_PixelFormat* pformat = SDL_AllocFormat(format); for(int y = NeXT_SCRN_HEIGHT; --y >= 0;) { for(int x = NeXT_SCRN_WIDTH; --x >= 0;) { - Uint32 v = SDL_Swap32(*src++); - *dst++ = SDL_MapRGB(pformat, (v >> 24) & 0xFF, (v>>16) & 0xFF, (v>>8) & 0xFF); + Uint32 v = *src++; + *dst++ = SDL_MapRGB(pformat, (v >> 16) & 0xFF, (v>>8) & 0xFF, (v>>0) & 0xFF); } src += 32; } SDL_FreeFormat(pformat); + SDL_UnlockTexture(tex); break; } } } - SDL_UnlockTexture(tex); } /* @@ -179,7 +178,9 @@ void blitDimension(SDL_Texture* tex) { */ static void blitScreen(SDL_Texture* tex) { if (ConfigureParams.Screen.nMonitorType==MONITOR_TYPE_DIMENSION) { - blitDimension(tex); + Uint32* vram = nd_vram_for_slot(ND_SLOT(ConfigureParams.Screen.nMonitorNum)); + if(vram) + blitDimension(vram, tex); return; } if(ConfigureParams.System.bColor) { @@ -238,11 +239,6 @@ static int repainter(void* unused) { exit(-2); } - if (!bInFullScreen) { - /* re-embed the new SDL window */ - Control_ReparentWindow(width, height, bInFullScreen); - } - Statusbar_Init(sdlscrn); if (bGrabMouse) { @@ -339,11 +335,6 @@ void Screen_Init(void) { /* Statusbar height */ height += Statusbar_SetHeight(width, height); - if (bInFullScreen) { - /* unhide the WM window for fullscreen */ - Control_ReparentWindow(width, height, bInFullScreen); - } - /* Set new video mode */ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");