Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:regataos
OpenBoard
0569-scale-mirror-pixmap.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0569-scale-mirror-pixmap.patch of Package OpenBoard
From e9908d730e31a94a9c4482b55a2efad4fba60e9a Mon Sep 17 00:00:00 2001 From: letsfindaway <me@letsfindaway.de> Date: Sun, 9 Jan 2022 10:40:12 +0100 Subject: [PATCH] fix: scaling of mirror pixmap - when scaling the pixmap take the devicePixelRatio into account - do not scale the already scaled pixmap when drawing in UBScreenMirror - use device independent coordinates when positioning the pixmap --- src/gui/UBScreenMirror.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/UBScreenMirror.cpp b/src/gui/UBScreenMirror.cpp index db5b65116..ff9810862 100644 --- a/src/gui/UBScreenMirror.cpp +++ b/src/gui/UBScreenMirror.cpp @@ -66,10 +66,12 @@ void UBScreenMirror::paintEvent(QPaintEvent *event) if (!mLastPixmap.isNull()) { - int x = (width() - mLastPixmap.width()) / 2; - int y = (height() - mLastPixmap.height()) / 2; + // compute size and offset in device independent coordinates + QSizeF pixmapSize = mLastPixmap.size() / mLastPixmap.devicePixelRatioF(); + int x = (width() - pixmapSize.width()) / 2; + int y = (height() - pixmapSize.height()) / 2; - painter.drawPixmap(x, y, width(), height(), mLastPixmap); + painter.drawPixmap(x, y, mLastPixmap); } } @@ -95,7 +97,7 @@ void UBScreenMirror::grabPixmap() } if (!mLastPixmap.isNull()) - mLastPixmap = mLastPixmap.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + mLastPixmap = mLastPixmap.scaled(size() * mLastPixmap.devicePixelRatioF(), Qt::KeepAspectRatio, Qt::SmoothTransformation); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor