1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Remove -1,-1 offset from ScaleSurface()

For some reason, ScaleSurface() was drawing each pixel one pixel up and
to the left from its actual position. I have no idea why.

But this was causing an issue where pixels would just be dropped,
because they would be drawn outside of the temporary SDL_Surface from
which the scaled surface would be drawn onto. Also, the offset just
creates a visual one-pixel offset in the result for no reason. So I'm
just removing it.

Big Viridian also suffered from this one-pixel offset, so now they will
no longer look like they're floating above the ground when standing on
the floor.
This commit is contained in:
Misa 2020-08-04 13:10:50 -07:00 committed by Ethan Lee
parent 5f776faba7
commit 79fd3e1d36

View file

@ -161,7 +161,7 @@ SDL_Surface * ScaleSurface( SDL_Surface *_surface, int Width, int Height, SDL_Su
for(Sint32 y = 0; y < _surface->h; y++) for(Sint32 y = 0; y < _surface->h; y++)
for(Sint32 x = 0; x < _surface->w; x++) for(Sint32 x = 0; x < _surface->w; x++)
{ {
setRect(gigantoPixel, static_cast<Sint32>((float(x)*_stretch_factor_x) -1), static_cast<Sint32>((float(y) *_stretch_factor_y)-1), static_cast<Sint32>(_stretch_factor_x +1.0),static_cast<Sint32>( _stretch_factor_y+1.0)) ; setRect(gigantoPixel, static_cast<Sint32>(float(x)*_stretch_factor_x), static_cast<Sint32>(float(y) *_stretch_factor_y), static_cast<Sint32>(_stretch_factor_x),static_cast<Sint32>( _stretch_factor_y)) ;
SDL_FillRect(_ret, &gigantoPixel, ReadPixel(_surface, x, y)); SDL_FillRect(_ret, &gigantoPixel, ReadPixel(_surface, x, y));
} }