[graphics/krita] libs/ui/tool: Fix inaccurate ref image scale calculation when rotated
Emmet O'Neill <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit cfa4993571edf4982d1a4054e4bac59f5791cfd8 by Emmet O'Neill, on behalf of Dat Le.
Committed on 13/08/2026 at 23:16.
Pushed by emmetoneill into branch 'master'.
Fix inaccurate ref image scale calculation when rotated
Just change boundingRect() to normal size() :D
M +3 -2 libs/ui/tool/KisAsyncColorSamplerHelper.cpp
https://invent.kde.org/graphics/krita/-/commit/cfa4993571edf4982d1a4054e4bac59f5791cfd8
diff --git a/libs/ui/tool/KisAsyncColorSamplerHelper.cpp b/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
index 47535288abf..3f533e30a29 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);