diff options
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index 70af4b3579..542b587bd7 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -55,7 +55,8 @@ QT_BEGIN_NAMESPACE QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) - : QPlatformBackingStore(window) + : QPlatformBackingStore(window), + m_hasUnflushedPaintOperations(false) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; @@ -75,25 +76,54 @@ QPaintDevice *QQnxRasterBackingStore::paintDevice() void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(window); - Q_UNUSED(offset); - qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window(); - // visit all pending scroll operations - for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { + QQnxWindow *targetWindow = 0; + if (window) + targetWindow = static_cast<QQnxWindow *>(window->handle()); - // do the scroll operation - ScrollOp &op = m_scrollOpList[i]; - QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) ); - m_platformWindow->scroll(srcArea, op.dx, op.dy); - } + if (!targetWindow || targetWindow == m_platformWindow) { - // clear all pending scroll operations - m_scrollOpList.clear(); + // visit all pending scroll operations + for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { + + // do the scroll operation + ScrollOp &op = m_scrollOpList[i]; + QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) ); + m_platformWindow->scroll(srcArea, op.dx, op.dy); + } + + // clear all pending scroll operations + m_scrollOpList.clear(); + + // update the display with newly rendered content + m_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(m_platformWindow, offset, region); + targetWindow->post(region); + + } else { + qWarning() << Q_FUNC_INFO << "flush() called without a valid window!"; + } - // update the display with newly rendered content - m_platformWindow->post(region); + m_hasUnflushedPaintOperations = false; } void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents) @@ -113,6 +143,7 @@ bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy) // calculate entire region affected by scroll operation (src + dst) QRegion totalArea = area.translated(dx, dy); totalArea += area; + m_hasUnflushedPaintOperations = true; // visit all pending scroll operations for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { @@ -141,6 +172,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) Q_UNUSED(region); qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); + m_hasUnflushedPaintOperations = true; m_platformWindow->adjustBufferSize(); } |