Avoid extending dirty region in beginPaint
When the raster window is resized, we need to resize the backingstore, and make sure we repaint the entire window. We defer the backingstore resize to beginPaint, in case multiple resize events come in before we have a chance to paint, but we can't defer the invalidation of the paint device window, because QPaintDeviceWindowPrivate::paint() has already subtracted the paint region from its dirty region at this point. Invalidating yet again will result in the dirty region of window not clearing fully until after the final resize, and when that happens we will also repaint the window with the wrong dirty region, based on the window's original size. My moving the window invalidation to the resize event, while keeping the deferred backingstore resize we avoid this problem. Change-Id: I44662778f5b1bcd259b20ca86124e6487561ef4f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit e0eb2818face4ffb7dafd87464f355d4654b7be0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit d48f08edb6ed78a639a4c84693f983c6efca7a43)
This commit is contained in:
parent
f9b63001de
commit
e5adee7685
@ -38,10 +38,9 @@ public:
|
||||
{
|
||||
Q_Q(QRasterWindow);
|
||||
const QSize size = q->size();
|
||||
if (backingstore->size() != size) {
|
||||
if (backingstore->size() != size)
|
||||
backingstore->resize(size);
|
||||
markWindowAsDirty();
|
||||
}
|
||||
|
||||
backingstore->beginPaint(region);
|
||||
}
|
||||
|
||||
@ -102,6 +101,13 @@ QPaintDevice *QRasterWindow::redirected(QPoint *) const
|
||||
return d->backingstore->paintDevice();
|
||||
}
|
||||
|
||||
void QRasterWindow::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
Q_D(QRasterWindow);
|
||||
if (d->backingstore->size() != size())
|
||||
d->markWindowAsDirty();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qrasterwindow.cpp"
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
protected:
|
||||
int metric(PaintDeviceMetric metric) const override;
|
||||
QPaintDevice *redirected(QPoint *) const override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QRasterWindow)
|
||||
|
Loading…
x
Reference in New Issue
Block a user