diff --git a/src/annotations/core/AnnotationArea.cpp b/src/annotations/core/AnnotationArea.cpp index e701d48e..6a629665 100644 --- a/src/annotations/core/AnnotationArea.cpp +++ b/src/annotations/core/AnnotationArea.cpp @@ -107,17 +107,13 @@ QImage AnnotationArea::image() mItemModifier->clear(); setSceneRect(canvasRect()); - auto scaleFactor = mDevicePixelRatioScaler->scaleFactor(); - auto sceneRect = this->sceneRect(); - auto scaledSceneSize = sceneRect.size().toSize() * scaleFactor; - auto scaledSceneRect = QRectF(sceneRect.topLeft(), scaledSceneSize); - QImage image(scaledSceneSize, QImage::Format_ARGB32_Premultiplied); + auto sceneRect = this->sceneRect().toRect(); + QImage image(sceneRect.size(), QImage::Format_ARGB32_Premultiplied); image.fill(mCanvasColor); - image.setDevicePixelRatio(scaleFactor); QPainter painter(&image); painter.setRenderHint(QPainter::Antialiasing); - render(&painter, QRectF(), scaledSceneRect); + render(&painter, QRectF(), sceneRect); setSceneRect(QRect()); // Reset scene rect diff --git a/tests/annotations/core/AnnotationAreaTest.cpp b/tests/annotations/core/AnnotationAreaTest.cpp index c7b475bd..9833d8f1 100644 --- a/tests/annotations/core/AnnotationAreaTest.cpp +++ b/tests/annotations/core/AnnotationAreaTest.cpp @@ -47,7 +47,7 @@ void AnnotationAreaTest::ExportAsImage_Should_ExportEmptyImage_When_NoImageSet() QCOMPARE(QImage(), resultImage); } -void AnnotationAreaTest::ExportAsImage_Should_ExportScaledImage_When_ScalingEnabled() +void AnnotationAreaTest::ExportAsImage_Should_ExportUnscaledImage_When_ScalingEnabled() { auto scaleFactor = 1.5; QPixmap pixmap(QSize(400, 400)); @@ -61,9 +61,7 @@ void AnnotationAreaTest::ExportAsImage_Should_ExportScaledImage_When_ScalingEnab auto resultImage = annotationArea.image(); - auto expectedImage = pixmap.scaled(pixmap.size() * scaleFactor).toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); - expectedImage.setDevicePixelRatio(scaleFactor); - QCOMPARE(resultImage, expectedImage); + QCOMPARE(resultImage, pixmap.toImage()); } void AnnotationAreaTest::AddAnnotationItem_Should_AddAnnotationItemToScene() diff --git a/tests/annotations/core/AnnotationAreaTest.h b/tests/annotations/core/AnnotationAreaTest.h index 76597201..5c007d06 100644 --- a/tests/annotations/core/AnnotationAreaTest.h +++ b/tests/annotations/core/AnnotationAreaTest.h @@ -42,7 +42,7 @@ Q_OBJECT private slots: void ExportAsImage_Should_ExportImage_When_ImageSet(); void ExportAsImage_Should_ExportEmptyImage_When_NoImageSet(); - void ExportAsImage_Should_ExportScaledImage_When_ScalingEnabled(); + void ExportAsImage_Should_ExportUnscaledImage_When_ScalingEnabled(); void AddAnnotationItem_Should_AddAnnotationItemToScene(); void RemoveAnnotationItem_Should_RemoveAnnotationItemFromScene(); void CanvasRect_Should_ReturnRectUnionOfAllItems_When_NoCanvasRectSet();