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
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;
......
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