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++

Prevent KisImage resolution being set to 0

Freya Lupen464cab24ed20
diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index 5e2efe338e..5f6a3b16de 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -1506,8 +1506,17 @@ double KisImage::yRes() const
void KisImage::setResolution(double xres, double yres)
{
- m_d->xres = xres;
- m_d->yres = yres;
+ if (xres > 0) {
+ m_d->xres = xres;
+ } else {
+ qWarning() << "WARNING: Ignoring attempt to set image x resolution <= 0 (" << xres << ")!";
+ }
+
+ if (yres > 0) {
+ m_d->yres = yres;
+ } else {
+ qWarning() << "WARNING: Ignoring attempt to set image y resolution <= 0 (" << yres << ")!";
+ }
}
QPointF KisImage::documentToPixel(const QPointF &documentCoord) const