Commit 50df8ad8 authored by David Hurka's avatar David Hurka 🐬 Committed by Albert Astals Cid

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.
parent 3ed69d2f
Pipeline #28919 passed with stage
in 14 minutes and 2 seconds
...@@ -963,10 +963,9 @@ void PagePainter::drawShapeOnImage(QImage &image, const NormalizedPath &normPath ...@@ -963,10 +963,9 @@ void PagePainter::drawShapeOnImage(QImage &image, const NormalizedPath &normPath
if (pointsNumber < 2) if (pointsNumber < 2)
return; return;
int imageWidth = image.width(); const double dpr = image.devicePixelRatio();
int imageHeight = image.height(); const double fImageWidth = image.width() / dpr;
double fImageWidth = (double)imageWidth; const double fImageHeight = image.height() / dpr;
double fImageHeight = (double)imageHeight;
// stroke outline // stroke outline
double penWidth = (double)pen.width() * penWidthMultiplier; double penWidth = (double)pen.width() * penWidthMultiplier;
...@@ -1009,8 +1008,9 @@ void PagePainter::drawShapeOnImage(QImage &image, const NormalizedPath &normPath ...@@ -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) 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 dpr = image.devicePixelRatio();
const double fImageHeight = (double)image.height(); const double fImageWidth = image.width() / dpr;
const double fImageHeight = image.height() / dpr;
// stroke outline // stroke outline
const double penWidth = (double)pen.width() * penWidthMultiplier; const double penWidth = (double)pen.width() * penWidthMultiplier;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment