1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-03 13:13:08 +00:00

Use devicePixelRatio directly

This commit is contained in:
Chris Djali (AnyOldName3) 2025-12-11 00:02:39 +00:00
parent 759734beb4
commit 2f002b885e

View file

@ -411,14 +411,9 @@ std::optional<CSVRender::WorldspaceHitResult> CSVRender::WorldspaceWidget::check
std::tuple<osg::Vec3d, osg::Vec3d, osg::Vec3d> 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;