mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Fix absolute mouse positioning on SDL renderer
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include "sdlvid.h"
|
#include "sdlvid.h"
|
||||||
|
|
||||||
#include "streaming/session.h"
|
#include "streaming/session.h"
|
||||||
|
#include "streaming/streamutils.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -176,9 +177,18 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The window may be smaller than the stream size, so ensure our
|
// Calculate the video region size, scaling to fill the window while
|
||||||
// logical rendering surface size is equal to the stream size
|
// preserving the aspect ratio of the video stream.
|
||||||
SDL_RenderSetLogicalSize(m_Renderer, params->width, params->height);
|
SDL_Rect src, dst;
|
||||||
|
src.x = src.y = 0;
|
||||||
|
src.w = params->width;
|
||||||
|
src.h = params->height;
|
||||||
|
dst.x = dst.y = 0;
|
||||||
|
SDL_GetWindowSize(params->window, &dst.w, &dst.h);
|
||||||
|
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||||
|
|
||||||
|
// Ensure the viewport is set to the desired video region
|
||||||
|
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||||
|
|
||||||
// Draw a black frame until the video stream starts rendering
|
// Draw a black frame until the video stream starts rendering
|
||||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user