diff --git a/client/SDL/sdl_freerdp.cpp b/client/SDL/sdl_freerdp.cpp index 4d1865ea7..d2ad9bbe1 100644 --- a/client/SDL/sdl_freerdp.cpp +++ b/client/SDL/sdl_freerdp.cpp @@ -372,6 +372,7 @@ static BOOL sdl_end_paint_process(rdpContext* context) SDL_Rect dstRect = { window->offset_x + rgn->x, window->offset_y + rgn->y, rgn->w, rgn->h }; SDL_SetClipRect(sdl->primary, &srcRect); + SDL_SetClipRect(screen, &dstRect); SDL_BlitSurface(sdl->primary, &srcRect, screen, &dstRect); } } @@ -421,11 +422,20 @@ static BOOL sdl_create_primary(sdlContext* sdl) gdi = sdl->common.context.gdi; WINPR_ASSERT(gdi); + SDL_FreeFormat(sdl->primary_format); SDL_FreeSurface(sdl->primary); sdl->primary = SDL_CreateRGBSurfaceWithFormatFrom( gdi->primary_buffer, (int)gdi->width, (int)gdi->height, (int)FreeRDPGetBitsPerPixel(gdi->dstFormat), (int)gdi->stride, sdl->sdl_pixel_format); - return sdl->primary != nullptr; + sdl->primary_format = SDL_AllocFormat(sdl->sdl_pixel_format); + + if (!sdl->primary || !sdl->primary_format) + return FALSE; + + SDL_SetSurfaceBlendMode(sdl->primary, SDL_BLENDMODE_NONE); + SDL_FillRect(sdl->primary, nullptr, SDL_MapRGBA(sdl->primary_format, 0, 0, 0, 0xff)); + + return TRUE; } static BOOL sdl_desktop_resize(rdpContext* context) @@ -582,6 +592,9 @@ static void sdl_cleanup_sdl(sdlContext* sdl) *window = empty; } + SDL_FreeFormat(sdl->primary_format); + sdl->primary_format = nullptr; + SDL_FreeSurface(sdl->primary); sdl->primary = nullptr; diff --git a/client/SDL/sdl_freerdp.hpp b/client/SDL/sdl_freerdp.hpp index 52258fc4e..1f6017844 100644 --- a/client/SDL/sdl_freerdp.hpp +++ b/client/SDL/sdl_freerdp.hpp @@ -62,6 +62,7 @@ struct sdl_context int exit_code; SDL_Surface* primary; + SDL_PixelFormat* primary_format; sdlDispContext* disp; sdlInput* input;