mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 22:50:57 +00:00
Use GL_NEAREST when possible without degrading quality
This commit is contained in:
@@ -417,6 +417,9 @@ ReadbackRetry:
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
// Never alpha blend this texture when rendering
|
||||
SDL_SetTextureBlendMode(m_Texture, SDL_BLENDMODE_NONE);
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
if (frame->format == AV_PIX_FMT_CUDA) {
|
||||
SDL_assert(m_CudaGLHelper == nullptr);
|
||||
@@ -567,6 +570,11 @@ ReadbackRetry:
|
||||
// Ensure the viewport is set to the desired video region
|
||||
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||
|
||||
// Use nearest pixel sampling if the video region size is a multiple of the frame size
|
||||
SDL_SetTextureScaleMode(m_Texture,
|
||||
dst.w % frame->width == 0 && dst.h % frame->height == 0 ?
|
||||
SDL_ScaleModeNearest : SDL_ScaleModeLinear);
|
||||
|
||||
// Draw the video content itself
|
||||
SDL_RenderCopy(m_Renderer, m_Texture, nullptr, nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user