Skip to content
Snippets Groups Projects
Commit 61f79d8c authored by deuce's avatar deuce
Browse files

Only change the font colours if they different than the current font colours.

parent 9590c5b6
No related branches found
No related tags found
No related merge requests found
...@@ -955,17 +955,25 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y) ...@@ -955,17 +955,25 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
SDL_Rect src; SDL_Rect src;
SDL_Rect dst; SDL_Rect dst;
unsigned char ch; unsigned char ch;
static int lastfg=-1;
static int lastbg=-1;
ch=(sch >> 8) & 0x0f; ch=(sch >> 8) & 0x0f;
co.r=dac_default256[vstat.palette[ch]].red; if(lastfg!=ch) {
co.g=dac_default256[vstat.palette[ch]].green; co.r=dac_default256[vstat.palette[ch]].red;
co.b=dac_default256[vstat.palette[ch]].blue; co.g=dac_default256[vstat.palette[ch]].green;
SDL_SetColors(sdl_font, &co, 1, 1); co.b=dac_default256[vstat.palette[ch]].blue;
SDL_SetColors(sdl_font, &co, 1, 1);
lastfg=ch;
}
ch=(sch >> 12) & 0x07; ch=(sch >> 12) & 0x07;
co.r=dac_default256[vstat.palette[ch]].red; if(lastbg!=ch) {
co.g=dac_default256[vstat.palette[ch]].green; co.r=dac_default256[vstat.palette[ch]].red;
co.b=dac_default256[vstat.palette[ch]].blue; co.g=dac_default256[vstat.palette[ch]].green;
SDL_SetColors(sdl_font, &co, 0, 1); 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.x=x*vstat.charwidth*vstat.scaling;
dst.y=y*vstat.charheight*vstat.scaling; dst.y=y*vstat.charheight*vstat.scaling;
dst.w=vstat.charwidth*vstat.scaling; dst.w=vstat.charwidth*vstat.scaling;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment