widgets: Clarify backingstore resize logic by removing cruft
Change-Id: I0a449068a0d4557b7bd6581ddf71c590b72d76a1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
5f3c071ee3
commit
45fe7adcb8
@ -810,11 +810,10 @@ void QWidgetRepaintManager::paintAndFlush()
|
|||||||
bool repaintAllWidgets = false;
|
bool repaintAllWidgets = false;
|
||||||
|
|
||||||
const QRect tlwRect = tlw->data->crect;
|
const QRect tlwRect = tlw->data->crect;
|
||||||
const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
|
if (!updatesDisabled && store->size() != tlwRect.size()) {
|
||||||
if ((surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
|
|
||||||
if (hasStaticContents() && !store->size().isEmpty() ) {
|
if (hasStaticContents() && !store->size().isEmpty() ) {
|
||||||
// Repaint existing dirty area and newly visible area.
|
// Repaint existing dirty area and newly visible area.
|
||||||
const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
|
const QRect clipRect(QPoint(0, 0), store->size());
|
||||||
const QRegion staticRegion(staticContents(nullptr, clipRect));
|
const QRegion staticRegion(staticContents(nullptr, clipRect));
|
||||||
QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
|
QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
|
||||||
newVisible -= staticRegion;
|
newVisible -= staticRegion;
|
||||||
@ -830,7 +829,7 @@ void QWidgetRepaintManager::paintAndFlush()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surfaceGeometry.size() != tlwRect.size())
|
if (store->size() != tlwRect.size())
|
||||||
store->resize(tlwRect.size());
|
store->resize(tlwRect.size());
|
||||||
|
|
||||||
if (updatesDisabled)
|
if (updatesDisabled)
|
||||||
@ -1241,11 +1240,10 @@ bool QWidgetRepaintManager::hasStaticContents() const
|
|||||||
QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &withinClipRect) const
|
QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &withinClipRect) const
|
||||||
{
|
{
|
||||||
if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {
|
if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {
|
||||||
const QSize surfaceGeometry(store->size());
|
QRect backingstoreRect(QPoint(0, 0), store->size());
|
||||||
QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
|
|
||||||
if (!withinClipRect.isEmpty())
|
if (!withinClipRect.isEmpty())
|
||||||
surfaceRect &= withinClipRect;
|
backingstoreRect &= withinClipRect;
|
||||||
return QRegion(surfaceRect);
|
return QRegion(backingstoreRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegion region;
|
QRegion region;
|
||||||
|
Loading…
Reference in New Issue
Block a user