Ax ScaleSurfaceSlow() in favor of ScaleSurface()

ScaleSurfaceSlow() uses DrawPixel() instead of SDL_FillRect() to scale a
given surface, which is slow and inefficient, and makes it less likely
that the game could be moved to SDL_Render.

Unfortunately, it has this weird -1,-1 offset, but that will be fixed in
the next commit.
This commit is contained in:
Misa
2020-08-04 13:09:13 -07:00
committed by Ethan Lee
parent 57dca99a4e
commit 5f776faba7
3 changed files with 2 additions and 35 deletions

View File

@@ -424,7 +424,7 @@ void Graphics::bigprint( int _x, int _y, std::string _s, int r, int g, int b, b
idx = font_idx(curr);
if (INBOUNDS(idx, font))
{
SDL_Surface* tempPrint = ScaleSurfaceSlow(font[idx], font[idx]->w *sc,font[idx]->h *sc);
SDL_Surface* tempPrint = ScaleSurface(font[idx], font[idx]->w *sc,font[idx]->h *sc);
SDL_Rect printrect = { static_cast<Sint16>((_x) + bfontpos), static_cast<Sint16>(_y) , static_cast<Sint16>((bfont_rect.w*sc)+1), static_cast<Sint16>((bfont_rect.h * sc)+1)};
BlitSurfaceColoured(tempPrint, NULL, backBuffer, &printrect, ct);
SDL_FreeSurface(tempPrint);
@@ -3023,7 +3023,7 @@ void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool
idx = font_idx(cur);
if (INBOUNDS(idx, font))
{
SDL_Surface* tempPrint = ScaleSurfaceSlow(font[idx], font[idx]->w *sc,font[idx]->h *sc);
SDL_Surface* tempPrint = ScaleSurface(font[idx], font[idx]->w *sc,font[idx]->h *sc);
SDL_Rect printrect = { Sint16((x) + bfontpos), Sint16(y) , Sint16(bfont_rect.w*sc), Sint16(bfont_rect.h * sc)};
BlitSurfaceColoured(tempPrint, NULL, backBuffer, &printrect, ct);
SDL_FreeSurface(tempPrint);