mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-28 00:54:35 +00:00
Fixed scaling YUV surfaces
This commit is contained in:
@@ -2227,7 +2227,7 @@ SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_S
|
||||
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(surface->format)) {
|
||||
// We can't directly scale a YUV surface (yet!)
|
||||
SDL_Surface *tmp = SDL_CreateSurface(surface->w, surface->h, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_Surface *tmp = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_ARGB8888);
|
||||
if (!tmp) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -2237,10 +2237,9 @@ SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_S
|
||||
if (!scaled) {
|
||||
return NULL;
|
||||
}
|
||||
tmp = scaled;
|
||||
|
||||
SDL_Surface *result = SDL_ConvertSurfaceAndColorspace(tmp, surface->format, NULL, surface->colorspace, surface->props);
|
||||
SDL_DestroySurface(tmp);
|
||||
SDL_Surface *result = SDL_ConvertSurfaceAndColorspace(scaled, surface->format, NULL, surface->colorspace, surface->props);
|
||||
SDL_DestroySurface(scaled);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user