From 2f002b885e28ccfcd5ad8934ba6d41068834103e Mon Sep 17 00:00:00 2001 From: "Chris Djali (AnyOldName3)" Date: Thu, 11 Dec 2025 00:02:39 +0000 Subject: [PATCH] Use devicePixelRatio directly --- apps/opencs/view/render/worldspacewidget.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index bdafc57498..79cdf8182d 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -411,14 +411,9 @@ std::optional CSVRender::WorldspaceWidget::check std::tuple CSVRender::WorldspaceWidget::getStartEndDirection( int pointX, int pointY) const { - // may be okay to just use devicePixelRatio() directly - QScreen* screen = SceneWidget::windowHandle() && SceneWidget::windowHandle()->screen() - ? SceneWidget::windowHandle()->screen() - : QGuiApplication::primaryScreen(); - // (0,0) is considered the lower left corner of an OpenGL window - int x = pointX * screen->devicePixelRatio(); - int y = height() * screen->devicePixelRatio() - pointY * screen->devicePixelRatio(); + int x = pointX * devicePixelRatio(); + int y = height() * devicePixelRatio() - pointY * devicePixelRatio(); // Convert from screen space to world space osg::Matrixd wpvMat;