From 1a3dc7d8e05fe0cd2d83ad5ed6365045e3f8e202 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 15 Nov 2017 23:14:49 +0000 Subject: [PATCH] Fix highlight/annotation clipping with Qt scaling Summary: pixelValue/pixelValue will give us a normalised value. Normalised values shouldn't be modified by a device pixel ratio. We want scaledRect not dScaledRect. BUG: 386110 Test Plan: Searched for text. Zoomed in, panned about Created annotations, they still seemed to work Subscribers: #okular Tags: #okular Differential Revision: https://phabricator.kde.org/D8832 --- ui/pagepainter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp index 94514a7ee..3a37ac350 100644 --- a/ui/pagepainter.cpp +++ b/ui/pagepainter.cpp @@ -153,10 +153,10 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula if ( canDrawHighlights || canDrawTextSelection || canDrawAnnotations ) { // precalc normalized 'limits rect' for intersection - double nXMin = ( (double)limits.left() / dScaledWidth ) + crop.left, - nXMax = ( (double)limits.right() / dScaledWidth ) + crop.left, - nYMin = ( (double)limits.top() / dScaledHeight ) + crop.top, - nYMax = ( (double)limits.bottom() / dScaledHeight ) + crop.top; + double nXMin = ( (double)limits.left() / scaledWidth ) + crop.left, + nXMax = ( (double)limits.right() / scaledWidth ) + crop.left, + nYMin = ( (double)limits.top() / scaledHeight ) + crop.top, + nYMax = ( (double)limits.bottom() / scaledHeight ) + crop.top; // append all highlights inside limits to their list if ( canDrawHighlights ) {