Make sure to call damage on the buffer when we damage it

Change-Id: Id325a1dee322c2b37215e6577870068260f5f7cc
Reviewed-on: http://codereview.qt.nokia.com/683
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
This commit is contained in:
Jørgen Lind 2011-06-23 10:14:51 +02:00 committed by Qt by Nokia
parent e9d3699123
commit 1b9c679eb5
5 changed files with 18 additions and 16 deletions

View File

@ -91,7 +91,7 @@ void QWaylandXCompositeEGLContext::swapBuffers()
QSize size = mWindow->geometry().size();
eglSwapBuffers(mEglIntegration->eglDisplay(),mEglWindowSurface);
mWindow->damage(QRegion(QRect(QPoint(0,0),size)));
mWindow->damage(QRect(QPoint(0,0),size));
mWindow->waitForFrameSync();
}

View File

@ -81,7 +81,7 @@ void QWaylandXCompositeGLXContext::swapBuffers()
QSize size = mWindow->geometry().size();
glXSwapBuffers(mGlxIntegration->xDisplay(),mXWindow);
mWindow->damage(QRegion(QRect(QPoint(0,0),size)));
mWindow->damage(QRect(QPoint(0,0),size));
mWindow->waitForFrameSync();
}

View File

@ -120,7 +120,12 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion &region, con
Q_UNUSED(offset);
QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
waylandWindow->damage(region);
QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); i++) {
const QRect rect = rects.at(i);
wl_buffer_damage(mBuffer->buffer(),rect.x(),rect.y(),rect.width(),rect.height());
waylandWindow->damage(rect);
}
}
void QWaylandShmWindowSurface::resize(const QSize &size)

View File

@ -127,28 +127,25 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer)
}
}
void QWaylandWindow::damage(const QRegion &region)
void QWaylandWindow::damage(const QRect &rect)
{
//We have to do sync stuff before calling damage, or we might
//get a frame callback before we get the timestamp
mDisplay->frameCallback(QWaylandWindow::frameCallback, mSurface, this);
mWaitingForFrameSync = true;
QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); i++) {
const QRect rect = rects.at(i);
wl_buffer_damage(mBuffer->buffer(), rect.x(), rect.y(), rect.width(), rect.height());
wl_surface_damage(mSurface,
rect.x(), rect.y(), rect.width(), rect.height());
wl_buffer_damage(mBuffer->buffer(),
rect.x(), rect.y(), rect.width(), rect.height());
if (!mWaitingForFrameSync) {
mDisplay->frameCallback(QWaylandWindow::frameCallback, mSurface, this);
mWaitingForFrameSync = true;
}
wl_surface_damage(mSurface,
rect.x(), rect.y(), rect.width(), rect.height());
}
void QWaylandWindow::newSurfaceCreated()
{
if (mBuffer) {
wl_surface_attach(mSurface,mBuffer->buffer(),0,0);
wl_surface_damage(mSurface,
0,0,mBuffer->size().width(),mBuffer->size().height());
}
}

View File

@ -71,7 +71,7 @@ public:
int32_t x, int32_t y, int32_t width, int32_t height);
void attach(QWaylandBuffer *buffer);
void damage(const QRegion &region);
void damage(const QRect &rect);
void waitForFrameSync();