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

This commit is contained in:
Jørgen Lind 2011-06-23 14:30:04 +02:00
parent bbcc62efaa
commit ce4d3435d7
4 changed files with 15 additions and 17 deletions

View File

@ -1,7 +1,4 @@
include (../xcomposite_share/xcomposite_share.pri) include (../xcomposite_share/xcomposite_share.pri)
load(qpa/egl/convenience)
load(qpa/egl/context)
load(qpa/egl/xlibintegration)
LIBS += -lXcomposite -lEGL LIBS += -lXcomposite -lEGL

View File

@ -119,7 +119,12 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, cons
Q_UNUSED(offset); Q_UNUSED(offset);
QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window->handle()); QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window->handle());
Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); 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 QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &)

View File

@ -129,22 +129,17 @@ 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 //We have to do sync stuff before calling damage, or we might
//get a frame callback before we get the timestamp //get a frame callback before we get the timestamp
if (!mWaitingForFrameSync) {
mDisplay->frameCallback(QWaylandWindow::frameCallback, mSurface, this); mDisplay->frameCallback(QWaylandWindow::frameCallback, mSurface, this);
mWaitingForFrameSync = true; 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, wl_surface_damage(mSurface,
rect.x(), rect.y(), rect.width(), rect.height()); rect.x(), rect.y(), rect.width(), rect.height());
wl_buffer_damage(mBuffer->buffer(),
rect.x(), rect.y(), rect.width(), rect.height());
}
} }
void QWaylandWindow::newSurfaceCreated() void QWaylandWindow::newSurfaceCreated()
@ -152,6 +147,7 @@ void QWaylandWindow::newSurfaceCreated()
if (mBuffer) { if (mBuffer) {
wl_surface_attach(mSurface,mBuffer->buffer(),0,0); wl_surface_attach(mSurface,mBuffer->buffer(),0,0);
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
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); int32_t x, int32_t y, int32_t width, int32_t height);
void attach(QWaylandBuffer *buffer); void attach(QWaylandBuffer *buffer);
void damage(const QRegion &region); void damage(const QRect &rect);
void waitForFrameSync(); void waitForFrameSync();