QNX: Use 'disabled' child window buffers.

Because there is only one QBackingStore per top-level window, child windows do
not need to have their own buffer, since Qt will use the TLW backing store as
their drawing surface. Since QNX's libscreen does not support windows without
buffer, a 1x1 buffer is used instead.

Change-Id: I4b81fdd0f3e6059c46b1d4302d2a754d72dc8a68
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
Rafael Roquetto 2013-05-06 19:17:52 -03:00 committed by The Qt Project
parent 46685f755b
commit 6dfba7c628
2 changed files with 18 additions and 23 deletions

View File

@ -85,6 +85,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle());
// we only need to flush the platformWindow backing store, since this is
// the buffer where all drawing operations of all windows, including the
// child windows, are performed; conceptually ,child windows have no buffers
// (actually they do have a 1x1 placeholder buffer due to libscreen limitations),
// since Qt will only draw to the backing store of the top-level window.
QQnxWindow *platformWindow = this->platformWindow();
if (!targetWindow || targetWindow == platformWindow) {
@ -102,29 +107,6 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
// update the display with newly rendered content
platformWindow->post(region);
} else if (targetWindow) {
// The contents of the backing store should be flushed to a different window than the
// window which owns the buffer.
// This typically happens for child windows, since child windows share a backing store with
// their top-level window (TLW).
// Simply copy the buffer over to the child window, to emulate a painting operation, and
// then post the window.
//
// ### Note that because of the design in the QNX QPA plugin, each window has its own buffers,
// even though they might share a backing store. This is unneeded overhead, but I don't think
// libscreen allows to have windows without buffers, or does it?
// We assume that the TLW has been flushed previously and that no changes were made to the
// backing store inbetween (### does Qt guarantee this?)
Q_ASSERT(!m_hasUnflushedPaintOperations);
targetWindow->adjustBufferSize();
targetWindow->blitFrom(platformWindow, offset, region);
targetWindow->post(region);
} else {
qWarning() << Q_FUNC_INFO << "flush() called without a valid window!";
}
m_hasUnflushedPaintOperations = false;

View File

@ -332,6 +332,9 @@ QSize QQnxWindow::requestedBufferSize() const
void QQnxWindow::adjustBufferSize()
{
if (m_parentWindow)
return;
const QSize windowSize = window()->size();
if (windowSize != bufferSize())
setBufferSize(windowSize);
@ -574,8 +577,18 @@ void QQnxWindow::setParent(const QPlatformWindow *window)
setScreen(m_parentWindow->m_screen);
m_parentWindow->m_childWindows.push_back(this);
// we don't need any buffers, since
// Qt will draw to the parent TLW
// backing store.
setBufferSize(QSize(1, 1));
} else {
m_screen->addWindow(this);
// recreate buffers, in case the
// window has been reparented and
// becomes a TLW
adjustBufferSize();
}
m_screen->updateHierarchy();