mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-24 13:41:14 +00:00
Consolidate test window creation code
This commit is contained in:
@@ -184,21 +184,13 @@ void SystemProperties::startAsyncLoad()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
testWindow = StreamUtils::createTestWindow();
|
||||||
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
|
||||||
if (!testWindow) {
|
if (!testWindow) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to create test window with platform flags: %s",
|
"Failed to create window for hardware decode test: %s",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
return;
|
||||||
if (!testWindow) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Failed to create window for hardware decode test: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display related attributes (max FPS, native resolution, etc).
|
// Update display related attributes (max FPS, native resolution, etc).
|
||||||
|
|||||||
@@ -640,21 +640,13 @@ bool Session::initialize(QQuickWindow* qtWindow)
|
|||||||
getWindowDimensions(x, y, width, height);
|
getWindowDimensions(x, y, width, height);
|
||||||
|
|
||||||
// Create a hidden window to use for decoder initialization tests
|
// Create a hidden window to use for decoder initialization tests
|
||||||
SDL_Window* testWindow = SDL_CreateWindow("", x, y, width, height,
|
SDL_Window* testWindow = StreamUtils::createTestWindow();
|
||||||
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
|
||||||
if (!testWindow) {
|
if (!testWindow) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to create test window with platform flags: %s",
|
"Failed to create window for hardware decode test: %s",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
testWindow = SDL_CreateWindow("", x, y, width, height, SDL_WINDOW_HIDDEN);
|
return false;
|
||||||
if (!testWindow) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Failed to create window for hardware decode test: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qInfo() << "Server GPU:" << m_Computer->gpuModel;
|
qInfo() << "Server GPU:" << m_Computer->gpuModel;
|
||||||
|
|||||||
@@ -84,6 +84,26 @@ Uint32 StreamUtils::getPlatformWindowFlags()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_Window* StreamUtils::createTestWindow()
|
||||||
|
{
|
||||||
|
SDL_Window* testWindow;
|
||||||
|
|
||||||
|
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
|
||||||
|
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
|
||||||
|
if (!testWindow) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Failed to create test window with platform flags: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
|
||||||
|
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||||
|
if (!testWindow) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return testWindow;
|
||||||
|
}
|
||||||
|
|
||||||
void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst)
|
void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst)
|
||||||
{
|
{
|
||||||
int dstH = SDL_ceilf((float)dst->w * src->h / src->w);
|
int dstH = SDL_ceilf((float)dst->w * src->h / src->w);
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ public:
|
|||||||
static
|
static
|
||||||
Uint32 getPlatformWindowFlags();
|
Uint32 getPlatformWindowFlags();
|
||||||
|
|
||||||
|
static
|
||||||
|
SDL_Window* createTestWindow();
|
||||||
|
|
||||||
static
|
static
|
||||||
void scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst);
|
void scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user