mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 14:43:20 +00:00
Don't create a larger surface than we need when scaling
This commit is contained in:
parent
7d628ef76c
commit
01d359c1df
1 changed files with 4 additions and 3 deletions
|
|
@ -1310,14 +1310,15 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
|
|||
SDL_PixelFormat fmt;
|
||||
tmprect.x = 0;
|
||||
tmprect.y = 0;
|
||||
tmprect.w = src->w;
|
||||
tmprect.h = src->h;
|
||||
tmprect.w = srcrect->w;
|
||||
tmprect.h = srcrect->h;
|
||||
if (SDL_BYTESPERPIXEL(dst->format) == 4 && dst->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||
fmt = dst->format;
|
||||
} else {
|
||||
fmt = SDL_PIXELFORMAT_ARGB8888;
|
||||
}
|
||||
tmp1 = SDL_CreateSurface(src->w, src->h, fmt);
|
||||
// FIXME: We really want a SDL_DuplicateSurface() with a rectangle here
|
||||
tmp1 = SDL_CreateSurface(tmprect.w, tmprect.h, fmt);
|
||||
SDL_BlitSurfaceUnchecked(src, srcrect, tmp1, &tmprect);
|
||||
|
||||
srcrect2.x = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue