mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Make fast path using FillRect() when opaque
FillRect() is similar enough to memset when blending isn't used, so the game will take a fast path drawing the roomname background when the background is opaque.
This commit is contained in:
parent
2f85c2a8dc
commit
2709de9cf0
3 changed files with 10 additions and 12 deletions
|
@ -3447,16 +3447,15 @@ void editorrender( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, ent
|
|||
{
|
||||
if(ed.roomnamehide<12) ed.roomnamehide++;
|
||||
}
|
||||
dwgfx.footerrect.y = 230+ed.roomnamehide;
|
||||
if (dwgfx.translucentroomname)
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127);
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255);
|
||||
FillRect(dwgfx.backBuffer, 0,230+ed.roomnamehide,320,10, dwgfx.getRGB(0,0,0));
|
||||
}
|
||||
dwgfx.footerrect.y = 230+ed.roomnamehide;
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
dwgfx.bprint(5,231+ed.roomnamehide,ed.level[ed.levx+(ed.maxwidth*ed.levy)].roomname, 196, 196, 255 - help.glow, true);
|
||||
dwgfx.bprint(4, 222, "SPACE ^ SHIFT ^", 196, 196, 255 - help.glow, false);
|
||||
dwgfx.bprint(268,222, "("+help.String(ed.levx+1)+","+help.String(ed.levy+1)+")",196, 196, 255 - help.glow, false);
|
||||
|
|
|
@ -127,6 +127,7 @@ int main(int argc, char *argv[])
|
|||
SDL_SetSurfaceBlendMode(graphics.backBuffer, SDL_BLENDMODE_NONE);
|
||||
graphics.footerbuffer = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 10, 32, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
|
||||
SDL_SetSurfaceBlendMode(graphics.footerbuffer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(graphics.footerbuffer, 127);
|
||||
FillRect(graphics.footerbuffer, SDL_MapRGB(fmt, 0, 0, 0));
|
||||
graphics.Makebfont();
|
||||
|
||||
|
|
|
@ -1562,16 +1562,15 @@ void gamerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, Ut
|
|||
|
||||
if(map.extrarow==0 || (map.custommode && map.roomname!=""))
|
||||
{
|
||||
dwgfx.footerrect.y = 230;
|
||||
if (dwgfx.translucentroomname)
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127);
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255);
|
||||
FillRect(dwgfx.backBuffer, dwgfx.footerrect, 0);
|
||||
}
|
||||
dwgfx.footerrect.y = 230;
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
|
||||
if (map.finalmode)
|
||||
{
|
||||
|
@ -2827,16 +2826,15 @@ void towerrender(Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, U
|
|||
}
|
||||
|
||||
|
||||
dwgfx.footerrect.y = 230;
|
||||
if (dwgfx.translucentroomname)
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127);
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255);
|
||||
FillRect(dwgfx.backBuffer, dwgfx.footerrect, 0);
|
||||
}
|
||||
dwgfx.footerrect.y = 230;
|
||||
SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect);
|
||||
dwgfx.bprint(5, 231, map.roomname, 196, 196, 255 - help.glow, true);
|
||||
|
||||
//dwgfx.rprint(5, 231,help.String(game.coins), 255 - help.glow/2, 255 - help.glow/2, 196, true);
|
||||
|
|
Loading…
Reference in a new issue