Skip to content

Commit 7553d58

Browse files
committed
Fixed software renderer 8-bit scaling and rotation (thanks @jroatch!)
Fixes #14422
1 parent 6a01d6e commit 7553d58

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/render/software/SDL_render_sw.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ static bool SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Te
400400
}
401401
return false;
402402
}
403+
if (src->palette) {
404+
SDL_SetSurfacePalette(src_clone, src->palette);
405+
}
403406

404407
SDL_GetSurfaceBlendMode(src, &blendmode);
405408
SDL_GetSurfaceAlphaMod(src, &alphaMod);
@@ -880,7 +883,7 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
880883

881884
// Prevent to do scaling + clipping on viewport boundaries as it may lose proportion
882885
if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) {
883-
SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, src->format);
886+
SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, surface->format);
884887
// Scale to an intermediate surface, then blit
885888
if (tmp) {
886889
SDL_Rect r;

0 commit comments

Comments
 (0)