mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-02-03 07:45:31 +03:00
Use SDL_BlitScaled in ScaleSurface
Why do all this error-prone per-pixel work when you can just use an SDL function instead?
This commit is contained in:
@@ -166,16 +166,7 @@ SDL_Surface * ScaleSurface( SDL_Surface *_surface, int Width, int Height, SDL_Su
|
|||||||
_ret = Dest;
|
_ret = Dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
float _stretch_factor_x = (static_cast<double>(Width) / static_cast<double>(_surface->w)), _stretch_factor_y = (static_cast<double>(Height) / static_cast<double>(_surface->h));
|
SDL_BlitScaled(_surface, NULL, _ret, NULL);
|
||||||
|
|
||||||
|
|
||||||
SDL_Rect gigantoPixel;
|
|
||||||
for(Sint32 y = 0; y < _surface->h; y++)
|
|
||||||
for(Sint32 x = 0; x < _surface->w; x++)
|
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return _ret;
|
return _ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user