1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Allocate to the size of source surface instead

Otherwise it will slow down since the destination surface is usually
pretty big.
This commit is contained in:
Misa 2023-01-05 12:23:34 -08:00
parent 2e03f2b03d
commit f35618999f

View file

@ -221,7 +221,7 @@ static void BlitSurfaceTransform(
}
/* FIXME: Find a way to do this without allocating... */
SDL_Surface* tempsurface = RecreateSurface(dest);
SDL_Surface* tempsurface = RecreateSurfaceWithDimensions(src, orig_rect.w, orig_rect.h);
if (tempsurface == NULL)
{
return;
@ -245,11 +245,12 @@ static void BlitSurfaceTransform(
}
const SDL_Color result = transform(pixel, color);
DrawPixel(tempsurface, blit_x + x, blit_y + y, result);
DrawPixel(tempsurface, x, y, result);
}
}
SDL_BlitSurface(tempsurface, NULL, dest, NULL);
SDL_Rect final_rect = {blit_x, blit_y, 0, 0};
SDL_BlitSurface(tempsurface, NULL, dest, &final_rect);
VVV_freefunc(SDL_FreeSurface, tempsurface);
}