mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-28 19:28:38 +00:00
QtQuick: simplify PageItem
Don't compare the limits to itself
This commit is contained in:
parent
970e0f2ba9
commit
a082ace479
1 changed files with 4 additions and 8 deletions
|
@ -344,18 +344,14 @@ void PageItem::paint()
|
||||||
const int flags = PagePainter::Accessibility | PagePainter::Highlights | PagePainter::Annotations;
|
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
|
// 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.
|
// 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 (width() <= 0 || height() < 0) {
|
||||||
if (size.isNull()) {
|
update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap pix(size);
|
const QRect limits(QPoint(0, 0), QSize(width()*dpr, height()*dpr));
|
||||||
|
QPixmap pix(limits.size());
|
||||||
pix.setDevicePixelRatio(dpr);
|
pix.setDevicePixelRatio(dpr);
|
||||||
QPainter p(&pix);
|
QPainter p(&pix);
|
||||||
p.setRenderHint(QPainter::Antialiasing, m_smooth);
|
p.setRenderHint(QPainter::Antialiasing, m_smooth);
|
||||||
|
|
Loading…
Reference in a new issue