mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-10 13:44:17 +00:00
Improve overlay format handling
This commit is contained in:
parent
e103f6c9b6
commit
f8a6012c3a
4 changed files with 6 additions and 13 deletions
|
@ -816,6 +816,7 @@ void D3D11VARenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||
|
||||
// Create a texture with our pixel data
|
||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||
|
||||
D3D11_TEXTURE2D_DESC texDesc = {};
|
||||
texDesc.Width = newSurface->w;
|
||||
|
|
|
@ -834,19 +834,9 @@ void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (newSurface->pitch == lockedRect.Pitch) {
|
||||
// If the pitch matches, we can take the fast path and use a single copy to transfer the pixels
|
||||
RtlCopyMemory(lockedRect.pBits, newSurface->pixels, newSurface->pitch * newSurface->h);
|
||||
}
|
||||
else {
|
||||
// If the pitch doesn't match, we'll need to copy each row separately
|
||||
int pitch = SDL_min(newSurface->pitch, lockedRect.Pitch);
|
||||
for (int i = 0; i < newSurface->h; i++) {
|
||||
RtlCopyMemory(((PUCHAR)lockedRect.pBits) + (lockedRect.Pitch * i),
|
||||
((PUCHAR)newSurface->pixels) + (newSurface->pitch * i),
|
||||
pitch);
|
||||
}
|
||||
}
|
||||
// Copy (and convert, if necessary) the surface pixels to the texture
|
||||
SDL_ConvertPixels(newSurface->w, newSurface->h, newSurface->format->format, newSurface->pixels,
|
||||
newSurface->pitch, SDL_PIXELFORMAT_ARGB8888, lockedRect.pBits, lockedRect.Pitch);
|
||||
|
||||
newTexture->UnlockRect(0);
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@ void EGLRenderer::renderOverlay(Overlay::OverlayType type)
|
|||
SDL_Surface* newSurface = Session::get()->getOverlayManager().getUpdatedOverlaySurface(type);
|
||||
if (newSurface != nullptr) {
|
||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_OverlayTextures[type]);
|
||||
|
||||
|
|
|
@ -365,6 +365,7 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||
|
||||
if (newSurface != nullptr) {
|
||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||
|
||||
VdpBitmapSurface newBitmapSurface = 0;
|
||||
status = m_VdpBitmapSurfaceCreate(m_Device,
|
||||
|
|
Loading…
Reference in a new issue