Merge branch '86Box:master' into master
This commit is contained in:
@@ -126,6 +126,7 @@ extern void plat_vidsize(int x, int y);
|
||||
extern void plat_setfullscreen(int on);
|
||||
extern void plat_resize(int x, int y);
|
||||
extern void plat_vidapi_enable(int enabled);
|
||||
extern void plat_vidapi_reload(void);
|
||||
extern void plat_vid_reload_options(void);
|
||||
extern uint32_t plat_language_code(char* langcode);
|
||||
extern void plat_language_code_r(uint32_t lcid, char* outbuf, int len);
|
||||
|
@@ -1194,6 +1194,14 @@ plat_vid_reload_options(void)
|
||||
vid_apis[vid_api].reload();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_vidapi_reload(void)
|
||||
{
|
||||
vid_apis[vid_api].reload();
|
||||
}
|
||||
|
||||
|
||||
/* Sets up the program language before initialization. */
|
||||
uint32_t
|
||||
plat_language_code(char* langcode)
|
||||
|
@@ -230,6 +230,46 @@ sdl_stretch(int *w, int *h, int *x, int *y)
|
||||
|
||||
static void
|
||||
sdl_blit(int x, int y, int w, int h)
|
||||
{
|
||||
SDL_Rect r_src;
|
||||
int ret;
|
||||
|
||||
if (!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) {
|
||||
video_blit_complete();
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_LockMutex(sdl_mutex);
|
||||
|
||||
r_src.x = x;
|
||||
r_src.y = y;
|
||||
r_src.w = w;
|
||||
r_src.h = h;
|
||||
SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), 2048 * sizeof(uint32_t));
|
||||
|
||||
if (screenshots)
|
||||
video_screenshot((uint32_t *) buffer32->dat, x, y, 2048);
|
||||
|
||||
video_blit_complete();
|
||||
|
||||
SDL_RenderClear(sdl_render);
|
||||
|
||||
r_src.x = x;
|
||||
r_src.y = y;
|
||||
r_src.w = w;
|
||||
r_src.h = h;
|
||||
|
||||
ret = SDL_RenderCopy(sdl_render, sdl_tex, &r_src, 0);
|
||||
if (ret)
|
||||
sdl_log("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError());
|
||||
|
||||
SDL_RenderPresent(sdl_render);
|
||||
SDL_UnlockMutex(sdl_mutex);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sdl_blit_ex(int x, int y, int w, int h)
|
||||
{
|
||||
SDL_Rect r_src;
|
||||
void *pixeldata;
|
||||
@@ -478,7 +518,7 @@ sdl_init_common(int flags)
|
||||
atexit(sdl_close);
|
||||
|
||||
/* Register our renderer! */
|
||||
video_setblit(sdl_blit);
|
||||
video_setblit((video_grayscale || invert_display) ? sdl_blit_ex : sdl_blit);
|
||||
|
||||
sdl_enabled = 1;
|
||||
sdl_mutex = SDL_CreateMutex();
|
||||
@@ -582,4 +622,6 @@ sdl_reload(void)
|
||||
|
||||
SDL_UnlockMutex(sdl_mutex);
|
||||
}
|
||||
|
||||
video_setblit((video_grayscale || invert_display) ? sdl_blit_ex : sdl_blit);
|
||||
}
|
||||
|
@@ -805,6 +805,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_VID_INVERT:
|
||||
video_toggle_option(hmenu, &invert_display, IDM_VID_INVERT);
|
||||
video_copy = (video_grayscale || invert_display) ? video_transform_copy : memcpy;
|
||||
plat_vidapi_reload();
|
||||
break;
|
||||
|
||||
case IDM_VID_OVERSCAN:
|
||||
@@ -838,6 +839,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB+video_grayscale, MF_UNCHECKED);
|
||||
video_grayscale = LOWORD(wParam) - IDM_VID_GRAY_RGB;
|
||||
video_copy = (video_grayscale || invert_display) ? video_transform_copy : memcpy;
|
||||
plat_vidapi_reload();
|
||||
CheckMenuItem(hmenu, IDM_VID_GRAY_RGB+video_grayscale, MF_CHECKED);
|
||||
device_force_redraw();
|
||||
config_save();
|
||||
|
Reference in New Issue
Block a user