|
|
@@ -1252,7 +1252,8 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
|
|
|
if (scaleMode == SDL_SCALEMODE_NEAREST || scaleMode == SDL_SCALEMODE_PIXELART) {
|
|
|
if (!(src->map.info.flags & complex_copy_flags) &&
|
|
|
src->format == dst->format &&
|
|
|
- !SDL_ISPIXELFORMAT_INDEXED(src->format) &&
|
|
|
+ (!SDL_ISPIXELFORMAT_INDEXED(src->format) ||
|
|
|
+ (SDL_BITSPERPIXEL(src->format) == 8 && SDL_IsSamePalette(src->palette, dst->palette))) &&
|
|
|
SDL_BYTESPERPIXEL(src->format) <= 4) {
|
|
|
return SDL_StretchSurface(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
|
|
|
} else if (SDL_BITSPERPIXEL(src->format) < 8) {
|
|
|
@@ -2244,6 +2245,11 @@ SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_S
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ if (SDL_ISPIXELFORMAT_INDEXED(surface->format)) {
|
|
|
+ // Linear scaling requires conversion to RGBA and then slow pixel color lookup
|
|
|
+ scaleMode = SDL_SCALEMODE_NEAREST;
|
|
|
+ }
|
|
|
+
|
|
|
// Create a new surface with the desired size
|
|
|
if (surface->pixels || SDL_MUSTLOCK(surface)) {
|
|
|
convert = SDL_CreateSurface(width, height, surface->format);
|