Fix misplacement of some non-PDF annotations on hiDPI

PagePainter::drawShapeOnImage() and drawEllipseOnImage() didn’t respect the image’s device pixel ratio.

Steps to reproduce:
* Set your screen scale to e. g. 1.25.
* Open e. g. a .txt document.
* Draw e. g. an arrow annotation or a text markup annotation.
remotes/origin/work/aacid/use_mimes_open_dialog
David Hurka 6 years ago committed by Albert Astals Cid
parent 3ed69d2f60
commit 50df8ad877
  1. 12
      ui/pagepainter.cpp

@ -963,10 +963,9 @@ void PagePainter::drawShapeOnImage(QImage &image, const NormalizedPath &normPath
if (pointsNumber < 2)
return;
int imageWidth = image.width();
int imageHeight = image.height();
double fImageWidth = (double)imageWidth;
double fImageHeight = (double)imageHeight;
const double dpr = image.devicePixelRatio();
const double fImageWidth = image.width() / dpr;
const double fImageHeight = image.height() / dpr;
// stroke outline
double penWidth = (double)pen.width() * penWidthMultiplier;
@ -1009,8 +1008,9 @@ void PagePainter::drawShapeOnImage(QImage &image, const NormalizedPath &normPath
void PagePainter::drawEllipseOnImage(QImage &image, const NormalizedPath &rect, const QPen &pen, const QBrush &brush, double penWidthMultiplier, RasterOperation op)
{
const double fImageWidth = (double)image.width();
const double fImageHeight = (double)image.height();
const double dpr = image.devicePixelRatio();
const double fImageWidth = image.width() / dpr;
const double fImageHeight = image.height() / dpr;
// stroke outline
const double penWidth = (double)pen.width() * penWidthMultiplier;

Loading…
Cancel
Save