mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59: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:
parent
2e03f2b03d
commit
f35618999f
1 changed files with 4 additions and 3 deletions
|
@ -221,7 +221,7 @@ static void BlitSurfaceTransform(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Find a way to do this without allocating... */
|
/* 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)
|
if (tempsurface == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -245,11 +245,12 @@ static void BlitSurfaceTransform(
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDL_Color result = transform(pixel, color);
|
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);
|
VVV_freefunc(SDL_FreeSurface, tempsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue