File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -107,17 +107,13 @@ QImage AnnotationArea::image()
107107 mItemModifier ->clear ();
108108
109109 setSceneRect (canvasRect ());
110- auto scaleFactor = mDevicePixelRatioScaler ->scaleFactor ();
111- auto sceneRect = this ->sceneRect ();
112- auto scaledSceneSize = sceneRect.size ().toSize () * scaleFactor;
113- auto scaledSceneRect = QRectF (sceneRect.topLeft (), scaledSceneSize);
114- QImage image (scaledSceneSize, QImage::Format_ARGB32_Premultiplied);
110+ auto sceneRect = this ->sceneRect ().toRect ();
111+ QImage image (sceneRect.size (), QImage::Format_ARGB32_Premultiplied);
115112 image.fill (mCanvasColor );
116- image.setDevicePixelRatio (scaleFactor);
117113
118114 QPainter painter (&image);
119115 painter.setRenderHint (QPainter::Antialiasing);
120- render (&painter, QRectF (), scaledSceneRect );
116+ render (&painter, QRectF (), sceneRect );
121117
122118 setSceneRect (QRect ()); // Reset scene rect
123119
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ void AnnotationAreaTest::ExportAsImage_Should_ExportEmptyImage_When_NoImageSet()
4747 QCOMPARE (QImage (), resultImage);
4848}
4949
50- void AnnotationAreaTest::ExportAsImage_Should_ExportScaledImage_When_ScalingEnabled ()
50+ void AnnotationAreaTest::ExportAsImage_Should_ExportUnscaledImage_When_ScalingEnabled ()
5151{
5252 auto scaleFactor = 1.5 ;
5353 QPixmap pixmap (QSize (400 , 400 ));
@@ -61,9 +61,7 @@ void AnnotationAreaTest::ExportAsImage_Should_ExportScaledImage_When_ScalingEnab
6161
6262 auto resultImage = annotationArea.image ();
6363
64- auto expectedImage = pixmap.scaled (pixmap.size () * scaleFactor).toImage ().convertToFormat (QImage::Format_ARGB32_Premultiplied);
65- expectedImage.setDevicePixelRatio (scaleFactor);
66- QCOMPARE (resultImage, expectedImage);
64+ QCOMPARE (resultImage, pixmap.toImage ());
6765}
6866
6967void AnnotationAreaTest::AddAnnotationItem_Should_AddAnnotationItemToScene ()
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ Q_OBJECT
4242private slots:
4343 void ExportAsImage_Should_ExportImage_When_ImageSet ();
4444 void ExportAsImage_Should_ExportEmptyImage_When_NoImageSet ();
45- void ExportAsImage_Should_ExportScaledImage_When_ScalingEnabled ();
45+ void ExportAsImage_Should_ExportUnscaledImage_When_ScalingEnabled ();
4646 void AddAnnotationItem_Should_AddAnnotationItemToScene ();
4747 void RemoveAnnotationItem_Should_RemoveAnnotationItemFromScene ();
4848 void CanvasRect_Should_ReturnRectUnionOfAllItems_When_NoCanvasRectSet ();
You can’t perform that action at this time.
0 commit comments