mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-22 13:31:08 +00:00
save initial gamma tables
change default gammaramp to off
This commit is contained in:
parent
7313b0284c
commit
be17ba9044
@ -168,6 +168,12 @@ static SDL_mutex *frame_buffer_lock = NULL;
|
|||||||
#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock)
|
#define LOCK_FRAME_BUFFER SDL_LockMutex(frame_buffer_lock)
|
||||||
#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock)
|
#define UNLOCK_FRAME_BUFFER SDL_UnlockMutex(frame_buffer_lock)
|
||||||
|
|
||||||
|
// Initially set gamma tables
|
||||||
|
static uint16 init_gamma_red[256];
|
||||||
|
static uint16 init_gamma_green[256];
|
||||||
|
static uint16 init_gamma_blue[256];
|
||||||
|
static bool init_gamma_valid;
|
||||||
|
|
||||||
// Previously set gamma tables
|
// Previously set gamma tables
|
||||||
static uint16 last_gamma_red[256];
|
static uint16 last_gamma_red[256];
|
||||||
static uint16 last_gamma_green[256];
|
static uint16 last_gamma_green[256];
|
||||||
@ -1624,19 +1630,20 @@ void VideoQuitFullScreen(void)
|
|||||||
static void ApplyGammaRamp() {
|
static void ApplyGammaRamp() {
|
||||||
if (sdl_window) {
|
if (sdl_window) {
|
||||||
int result;
|
int result;
|
||||||
|
if (!init_gamma_valid) {
|
||||||
|
result = SDL_GetWindowGammaRamp(sdl_window, init_gamma_red, init_gamma_green, init_gamma_blue);
|
||||||
|
if (result < 0)
|
||||||
|
fprintf(stderr, "SDL_GetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
||||||
|
init_gamma_valid = true;
|
||||||
|
}
|
||||||
const char *s = PrefsFindString("gammaramp");
|
const char *s = PrefsFindString("gammaramp");
|
||||||
if (!s) s = "on";
|
if (!s) s = "off";
|
||||||
if (strcmp(s, "off") && (strcmp(s, "fullscreen") || display_type == DISPLAY_SCREEN))
|
if (strcmp(s, "off") && (strcmp(s, "fullscreen") || display_type == DISPLAY_SCREEN))
|
||||||
result = SDL_SetWindowGammaRamp(sdl_window, last_gamma_red, last_gamma_green, last_gamma_blue);
|
result = SDL_SetWindowGammaRamp(sdl_window, last_gamma_red, last_gamma_green, last_gamma_blue);
|
||||||
else {
|
else
|
||||||
Uint16 ident[256];
|
result = SDL_SetWindowGammaRamp(sdl_window, init_gamma_red, init_gamma_green, init_gamma_blue);
|
||||||
for (int i = 0; i < 256; i++)
|
if (result < 0)
|
||||||
ident[i] = (i << 8) | i;
|
|
||||||
result = SDL_SetWindowGammaRamp(sdl_window, ident, ident, ident);
|
|
||||||
}
|
|
||||||
if (result < 0) {
|
|
||||||
fprintf(stderr, "SDL_SetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
fprintf(stderr, "SDL_SetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user