Refactor: Move rendering to sc_screen and introduce sc_texture by rom1v · Pull Request #6651 · Genymobile/scrcpy (original) (raw)
added 10 commits
When the scrcpy window is minimized on Windows with D3D9, texture creation and updates fail.
As a workaround, a mechanism was implemented to reattempt applying the requested changes.
Since SDL3 defaults to the D3D11 backend, remove this workaround, which adds a lot of complexity for a backend that should almost never be used.
However, do not close scrcpy when texture creation or updates fail; only that specific rendering should fail.
Refs SDL/#7651 <libsdl-org/SDL#7651> Refs #3947 <#3947> Refs 6298ef0 PR #6651 <#6651>
Make sc_screen the owner of both the SDL window and the SDL renderer. This is the first step toward limiting the role of sc_display to texture management.
Three components are involved in displaying device content on screen:
- a window
- a renderer
- a texture
Originally, all three were handled by sc_screen.
Commit 051b74c later extracted the renderer and texture into a separate component, sc_display.
However, the split was a bit awkward because the window size and rendering location were managed by separate components.
Move rendering back to sc_screen, keeping only texture management separated.
The coordinates of the content to render depend on the render output size, not the window size in pixels. In theory, the two could differ.
Replace SDL "logical rendering" with explicit computation of icon location, and unify rendering of video frames and icons using the same common code.
In SDL3, texture rendering uses SDL_FRect, unlike SDL2 which used SDL_Rect.
Compute content location using floating-point coordinates from the start.
Add a function to set a texture from a surface on a sc_display.
Add a function to set a texture from an AVFrame on a sc_display.
The sc_display component now only handles a texture. Rendering has been moved to sc_screen.
This was referenced
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})