[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [spectacle] src/QuickEditor: Take into account devicePixelRatio for selection
From:       Àlex_Fiestas <afiestas () kde ! org>
Date:       2016-06-01 11:27:10
Message-ID: E1b84Io-0002gV-E6 () scm ! kde ! org
[Download RAW message or body]

Git commit 6a69fadcd521195e8fef00acdf7da5db27cac82a by Àlex Fiestas.
Committed on 01/06/2016 at 11:27.
Pushed by afiestas into branch 'master'.

Take into account devicePixelRatio for selection

The selection QQuickView is emitting is not having into account the
devicePixelRatio, so when we use it to crop the pixmap the operation is
all wrong.

Maybe a better solution would be to figure out why the qml part is
failing to report the correct coordinates, but I do not have the time
for that right now :/

REVIEW: 128068

M  +2    -1    src/QuickEditor/QuickEditor.cpp

http://commits.kde.org/spectacle/6a69fadcd521195e8fef00acdf7da5db27cac82a

diff --git a/src/QuickEditor/QuickEditor.cpp b/src/QuickEditor/QuickEditor.cpp
index a9bb72f..035703a 100644
--- a/src/QuickEditor/QuickEditor.cpp
+++ b/src/QuickEditor/QuickEditor.cpp
@@ -135,7 +135,8 @@ void QuickEditor::acceptImageHandler(int x, int y, int width, int height)
         return;
     }
 
-    d->mGrabRect = QRect(x, y, width, height);
+    auto pixelRatio = d->mQuickView->devicePixelRatio();
+    d->mGrabRect = QRect(x * pixelRatio, y * pixelRatio, width * pixelRatio, height * pixelRatio);
     SpectacleConfig::instance()->setCropRegion(d->mGrabRect);
 
     d->mQuickView->hide();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic