mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 22:50:57 +00:00
Blit the new overlay in one shot if it entirely covers the old one
This commit is contained in:
@@ -1444,7 +1444,13 @@ void DrmRenderer::blitOverlayToCompositionSurface(Overlay::OverlayType type, SDL
|
||||
SDL_Rect overlayUnionRect;
|
||||
SDL_UnionRect(overlayRect, &m_OverlayRects[type], &overlayUnionRect);
|
||||
|
||||
// If the new overlay completely covers the old overlay, blit it all at once
|
||||
if (SDL_RectEquals(&overlayUnionRect, overlayRect)) {
|
||||
SDL_BlitSurface(newSurface, nullptr, m_OverlayCompositionSurface, overlayRect);
|
||||
}
|
||||
else {
|
||||
// Draw the surface row-by-row to ensure we clear the dirty area from the previous surface
|
||||
// without causing flickering, which would be noticeable if we cleared the whole area first.
|
||||
for (int y = overlayUnionRect.y; y < overlayUnionRect.y + overlayUnionRect.h; y++) {
|
||||
auto dstPixelRow =
|
||||
(uint8_t*)m_OverlayCompositionSurface->pixels +
|
||||
@@ -1478,6 +1484,7 @@ void DrmRenderer::blitOverlayToCompositionSurface(Overlay::OverlayType type, SDL
|
||||
(overlayUnionRect.w - overlayRect->w) * bpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dirty the modified portion of the plane
|
||||
m_PropSetter.damagePlane(m_OverlayPlanes[0], overlayUnionRect);
|
||||
|
||||
Reference in New Issue
Block a user