From a082ace479c291f092db2d30bf24120bb153d6cf Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 26 Apr 2018 01:32:27 +0200 Subject: [PATCH] QtQuick: simplify PageItem Don't compare the limits to itself --- mobile/components/pageitem.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mobile/components/pageitem.cpp b/mobile/components/pageitem.cpp index 7223eae97..a41c3bbff 100644 --- a/mobile/components/pageitem.cpp +++ b/mobile/components/pageitem.cpp @@ -344,18 +344,14 @@ void PageItem::paint() const int flags = PagePainter::Accessibility | PagePainter::Highlights | PagePainter::Annotations; // Simply using the limits as described by textureSize will, at times, result in the page painter // attempting to write outside the data area, unsurprisingly resulting in a crash. - QRect limits(QPoint(0, 0), QSize(width(), height())); - if(limits.width() > width()) - limits.setWidth(width()); - if(limits.height() > height()) - limits.setHeight(height()); - QSize size(width()*dpr, height()*dpr); - if (size.isNull()) { + if (width() <= 0 || height() < 0) { + update(); return; } - QPixmap pix(size); + const QRect limits(QPoint(0, 0), QSize(width()*dpr, height()*dpr)); + QPixmap pix(limits.size()); pix.setDevicePixelRatio(dpr); QPainter p(&pix); p.setRenderHint(QPainter::Antialiasing, m_smooth);