From kde-commits Sun May 08 16:12:15 2016 From: Weng Xuetian Date: Sun, 08 May 2016 16:12:15 +0000 To: kde-commits Subject: [spectacle/Applications/16.04] src/QuickEditor: Fix high dpi region selection. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=146272394503738 Git commit 38804556588e977aaaea5f50115363d9f4dc379d by Weng Xuetian. Committed on 08/05/2016 at 16:11. Pushed by xuetianweng into branch 'Applications/16.04'. Fix high dpi region selection. Coordinates need to be scaled to native pixel before clip. REVIEW: 127814 CCBUG: 357022 M +8 -2 src/QuickEditor/EditorRoot.qml http://commits.kde.org/kscreengenie/38804556588e977aaaea5f50115363d9f4dc379d diff --git a/src/QuickEditor/EditorRoot.qml b/src/QuickEditor/EditorRoot.qml index f7fb33b..4ef0784 100644 --- a/src/QuickEditor/EditorRoot.qml +++ b/src/QuickEditor/EditorRoot.qml @@ -51,7 +51,10 @@ Item { = Keys.onReturnPressed: { if (selection) { - acceptImage(selection.x, selection.y, selection.width, selecti= on.height); + acceptImage(selection.x * Screen.devicePixelRatio, + selection.y * Screen.devicePixelRatio, + selection.width * Screen.devicePixelRatio, + selection.height * Screen.devicePixelRatio); } else { acceptImage(-1, -1, -1, -1); } @@ -253,7 +256,10 @@ Item { imageElement: imageBackground; = onDoubleClicked: { - editorRoot.acceptImage(selection.x, selection.y, selection= .width, selection.height); + editorRoot.acceptImage(selection.x * Screen.devicePixelRat= io, + selection.y * Screen.devicePixelRat= io, + selection.width * Screen.devicePixe= lRatio, + selection.height * Screen.devicePix= elRatio); } } }