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 crash when using a smudge brush

Luna Lovecraft4323f26c2856
diff --git a/libs/brush/kis_qimage_pyramid.cpp b/libs/brush/kis_qimage_pyramid.cpp
index f04deceed9..30fa7685db 100644
--- a/libs/brush/kis_qimage_pyramid.cpp
+++ b/libs/brush/kis_qimage_pyramid.cpp
@@ -112,6 +112,19 @@ inline QRect roundRect(const QRectF &rc)
rect.setTop(0.0);
}
+ qreal w_rounded = qRound(rect.width());
+ qreal h_rounded = qRound(rect.height());
+
+ //Take care of the float precision errors
+ if (qAbs(rect.width() - w_rounded) < 0.000001) {
+ rect.setWidth(w_rounded);
+ }
+
+ if (qAbs(rect.height() - h_rounded) < 0.000001) {
+ rect.setHeight(h_rounded);
+ }
+
+
return rect.toAlignedRect();
}