From 61f79d8cd3c9093a1827f3ad0ecf0aa359243cb0 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 12 Oct 2005 20:30:46 +0000 Subject: [PATCH] Only change the font colours if they different than the current font colours. --- src/conio/sdl_con.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c index 05fa5f18b7..6fae59e9e3 100644 --- a/src/conio/sdl_con.c +++ b/src/conio/sdl_con.c @@ -955,17 +955,25 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y) SDL_Rect src; SDL_Rect dst; unsigned char ch; + static int lastfg=-1; + static int lastbg=-1; ch=(sch >> 8) & 0x0f; - co.r=dac_default256[vstat.palette[ch]].red; - co.g=dac_default256[vstat.palette[ch]].green; - co.b=dac_default256[vstat.palette[ch]].blue; - SDL_SetColors(sdl_font, &co, 1, 1); + if(lastfg!=ch) { + co.r=dac_default256[vstat.palette[ch]].red; + co.g=dac_default256[vstat.palette[ch]].green; + co.b=dac_default256[vstat.palette[ch]].blue; + SDL_SetColors(sdl_font, &co, 1, 1); + lastfg=ch; + } ch=(sch >> 12) & 0x07; - co.r=dac_default256[vstat.palette[ch]].red; - co.g=dac_default256[vstat.palette[ch]].green; - co.b=dac_default256[vstat.palette[ch]].blue; - SDL_SetColors(sdl_font, &co, 0, 1); + if(lastbg!=ch) { + co.r=dac_default256[vstat.palette[ch]].red; + co.g=dac_default256[vstat.palette[ch]].green; + co.b=dac_default256[vstat.palette[ch]].blue; + SDL_SetColors(sdl_font, &co, 0, 1); + lastbg=ch; + } dst.x=x*vstat.charwidth*vstat.scaling; dst.y=y*vstat.charheight*vstat.scaling; dst.w=vstat.charwidth*vstat.scaling; -- GitLab