mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Make sdl's VID_SetPalette only queue a palette change.
It seems that SDL_SetColors causes a page flip, so VID_SetPalette only queue a palette change (by checking for the need to change and storing the requested palete) and VID_Update now checks for a queued palette change and updates SDL's palette if required. This fixes the flickering console in sw -sdl introduced by the cshift/centerprint change.
This commit is contained in:
parent
82a6861233
commit
ed8b289315
1 changed files with 17 additions and 1 deletions
|
@ -84,6 +84,9 @@ static void (GLAPIENTRY *qfglFinish) (void);
|
||||||
static int use_gl_procaddress = 0;
|
static int use_gl_procaddress = 0;
|
||||||
static cvar_t *gl_driver;
|
static cvar_t *gl_driver;
|
||||||
|
|
||||||
|
static byte cached_palette[256 * 3];
|
||||||
|
static int update_palette;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
QFGL_ProcAddress (const char *name, qboolean crit)
|
QFGL_ProcAddress (const char *name, qboolean crit)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +183,7 @@ sdl_load_gl (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
VID_SetPalette (const byte *palette)
|
sdl_update_palette (const byte *palette)
|
||||||
{
|
{
|
||||||
SDL_Color colors[256];
|
SDL_Color colors[256];
|
||||||
int i;
|
int i;
|
||||||
|
@ -193,6 +196,15 @@ VID_SetPalette (const byte *palette)
|
||||||
SDL_SetColors (screen, colors, 0, 256);
|
SDL_SetColors (screen, colors, 0, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
VID_SetPalette (const byte *palette)
|
||||||
|
{
|
||||||
|
if (memcmp (cached_palette, palette, sizeof (cached_palette))) {
|
||||||
|
memcpy (cached_palette, palette, sizeof (cached_palette));
|
||||||
|
update_palette = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_screen_buffer (void)
|
do_screen_buffer (void)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +305,10 @@ VID_Update (vrect_t *rects)
|
||||||
int i, n;
|
int i, n;
|
||||||
vrect_t *rect;
|
vrect_t *rect;
|
||||||
|
|
||||||
|
if (update_palette) {
|
||||||
|
update_palette = 0;
|
||||||
|
sdl_update_palette (cached_palette);
|
||||||
|
}
|
||||||
// Two-pass system, since Quake doesn't do it the SDL way...
|
// Two-pass system, since Quake doesn't do it the SDL way...
|
||||||
|
|
||||||
// First, count the number of rectangles
|
// First, count the number of rectangles
|
||||||
|
|
Loading…
Reference in a new issue