mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-10 22:31:04 +00:00
switchable gamma ramp
This commit is contained in:
parent
3cf23176f6
commit
21c16f991e
@ -1618,6 +1618,25 @@ void VideoQuitFullScreen(void)
|
|||||||
quit_full_screen = true;
|
quit_full_screen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ApplyGammaRamp() {
|
||||||
|
if (sdl_window) {
|
||||||
|
int result;
|
||||||
|
const char *s = PrefsFindString("gammaramp");
|
||||||
|
if (!s) s = "on";
|
||||||
|
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);
|
||||||
|
else {
|
||||||
|
Uint16 ident[256];
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void do_toggle_fullscreen(void)
|
static void do_toggle_fullscreen(void)
|
||||||
{
|
{
|
||||||
#ifndef USE_CPU_EMUL_SERVICES
|
#ifndef USE_CPU_EMUL_SERVICES
|
||||||
@ -1654,6 +1673,7 @@ static void do_toggle_fullscreen(void)
|
|||||||
#ifdef SHEEPSHAVER
|
#ifdef SHEEPSHAVER
|
||||||
video_set_palette();
|
video_set_palette();
|
||||||
#endif
|
#endif
|
||||||
|
ApplyGammaRamp();
|
||||||
drv->update_palette();
|
drv->update_palette();
|
||||||
|
|
||||||
// reset the video refresh handler
|
// reset the video refresh handler
|
||||||
@ -1795,16 +1815,11 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||||||
memcmp(green, last_gamma_green, 512) != 0 ||
|
memcmp(green, last_gamma_green, 512) != 0 ||
|
||||||
memcmp(blue, last_gamma_blue, 512) != 0);
|
memcmp(blue, last_gamma_blue, 512) != 0);
|
||||||
|
|
||||||
if (changed && sdl_window) {
|
if (changed) {
|
||||||
int result = SDL_SetWindowGammaRamp(sdl_window, red, green, blue);
|
|
||||||
|
|
||||||
if (result < 0) {
|
|
||||||
fprintf(stderr, "SDL_SetWindowGammaRamp returned %d, SDL error: %s\n", result, SDL_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(last_gamma_red, red, 512);
|
memcpy(last_gamma_red, red, 512);
|
||||||
memcpy(last_gamma_green, green, 512);
|
memcpy(last_gamma_green, green, 512);
|
||||||
memcpy(last_gamma_blue, blue, 512);
|
memcpy(last_gamma_blue, blue, 512);
|
||||||
|
ApplyGammaRamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -78,6 +78,7 @@ prefs_desc common_prefs_items[] = {
|
|||||||
{"yearofs", TYPE_INT32, 0, "year offset"},
|
{"yearofs", TYPE_INT32, 0, "year offset"},
|
||||||
{"dayofs", TYPE_INT32, 0, "day offset"},
|
{"dayofs", TYPE_INT32, 0, "day offset"},
|
||||||
{"mag_rate", TYPE_INT32, 0, "rate of magnification"},
|
{"mag_rate", TYPE_INT32, 0, "rate of magnification"},
|
||||||
|
{"gammaramp", TYPE_STRING, false, "gamma ramp (on, off or fullscreen)"},
|
||||||
{NULL, TYPE_END, false, NULL} // End of list
|
{NULL, TYPE_END, false, NULL} // End of list
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ prefs_desc common_prefs_items[] = {
|
|||||||
{"yearofs", TYPE_INT32, 0, "year offset"},
|
{"yearofs", TYPE_INT32, 0, "year offset"},
|
||||||
{"dayofs", TYPE_INT32, 0, "day offset"},
|
{"dayofs", TYPE_INT32, 0, "day offset"},
|
||||||
{"mag_rate", TYPE_INT32, 0, "rate of magnification"},
|
{"mag_rate", TYPE_INT32, 0, "rate of magnification"},
|
||||||
|
{"gammaramp", TYPE_STRING, false, "gamma ramp (on, off or fullscreen)"},
|
||||||
{NULL, TYPE_END, false, NULL} // End of list
|
{NULL, TYPE_END, false, NULL} // End of list
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user