Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix inaccurate ref image scale calculation when rotated

Dat Lecfa4993571ed
diff --git a/libs/ui/tool/KisAsyncColorSamplerHelper.cpp b/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
index 47535288ab..3f533e30a2 100644
--- a/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
+++ b/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
@@ -796,10 +796,11 @@ void KisAsyncColorSamplerHelper::paintCircleReferenceImagePreview(QPainter &gc,
// Avoid using KisReferenceImage::documentToPixel because it use absoluteTransformation.invert()
// Which will take rotation into account and cause some quirks when ref image is rotated
- qreal xScale = refImage->boundingRect().width() / image.width();
- qreal yScale = refImage->boundingRect().height() / image.height();
+ qreal xScale = refImage->size().width() / image.width();
+ qreal yScale = refImage->size().height() / image.height();
QRect refPixelRect = QRect(refPixelPoint, QSize(zoomDocRectF.width() / xScale, zoomDocRectF.height() / yScale));
+
refPixelRect = m_d->standardizeZoomPreviewPixelRect(refPixelRect);
refPixelRect.moveCenter(refPixelPoint);