From 0348a2c28469f8e112de8ae95023b049afaa2560 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 11 Jun 2026 14:25:59 -0700
Subject: [PATCH] Synchronize destination surface changes back to SDL2 after
blitting
Fixes the case where an RLE surface is unencoded during a blit and has valid pixels afterwards
Fixes https://github.com/libsdl-org/sdl2-compat/issues/601
---
src/sdl2_compat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index bd2064a4..533bf688 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -4550,6 +4550,7 @@ SDL_LowerBlit(SDL2_Surface *src2, SDL_Rect *srcrect, SDL2_Surface *dst2, SDL_Rec
SDL_Surface *dst = Surface2to3(dst2);
int result = SDL3_BlitSurfaceUnchecked(src, srcrect, dst, dstrect) ? 0 : -1;
SynchronizeSurface3to2(src, src2);
+ SynchronizeSurface3to2(dst, dst2);
return result;
}
@@ -4720,6 +4721,7 @@ SDL_LowerBlitScaled(SDL2_Surface *src2, SDL_Rect *srcrect, SDL2_Surface *dst2, S
SDL_Surface *dst = Surface2to3(dst2);
int result = SDL3_BlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST) ? 0 : -1;
SynchronizeSurface3to2(src, src2);
+ SynchronizeSurface3to2(dst, dst2);
return result;
}