diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index 7ae042cb50..c986a960f3 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -58,7 +58,8 @@ QT_BEGIN_NAMESPACE QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) : QPlatformBackingStore(window), - m_hasUnflushedPaintOperations(false) + m_needsPosting(false), + m_scrolled(false) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; @@ -85,10 +86,10 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window(); // Sometimes this method is called even though there is nothing to be - // flushed, for instance, after an expose event directly follows a - // geometry change event. - if (!m_hasUnflushedPaintOperations) - return; + // flushed (posted in "screen" parlance), for instance, after an expose + // event directly follows a geometry change event. + if (!m_needsPosting) + return; QQnxWindow *targetWindow = 0; if (window) @@ -99,25 +100,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const // 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. - if (!targetWindow || targetWindow == platformWindow()) { + if (!targetWindow || targetWindow == platformWindow()) + platformWindow()->post(region); // update the display with newly rendered content - // 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) ); - platformWindow()->scroll(srcArea, op.dx, op.dy); - } - - // clear all pending scroll operations - m_scrollOpList.clear(); - - // update the display with newly rendered content - platformWindow()->post(region); - } - - m_hasUnflushedPaintOperations = false; + m_needsPosting = false; + m_scrolled = false; } void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents) @@ -134,31 +121,14 @@ bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); - // calculate entire region affected by scroll operation (src + dst) - QRegion totalArea = area.translated(dx, dy); - totalArea += area; - m_hasUnflushedPaintOperations = true; + m_needsPosting = true; - // visit all pending scroll operations - for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { - - ScrollOp &op = m_scrollOpList[i]; - if (op.totalArea == totalArea) { - // same area is being scrolled again - update delta - op.dx += dx; - op.dy += dy; - return true; - } else if (op.totalArea.intersects(totalArea)) { - // current scroll overlaps previous scroll but is - // not equal in area - just paint everything - qWarning("QQNX: pending scroll operations overlap but not equal"); - return false; - } + if (!m_scrolled) { + platformWindow()->scroll(area, dx, dy, true); + m_scrolled = true; + return true; } - - // create new scroll operation - m_scrollOpList.append( ScrollOp(totalArea, dx, dy) ); - return true; + return false; } void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) @@ -166,7 +136,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) Q_UNUSED(region); qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); - m_hasUnflushedPaintOperations = true; + m_needsPosting = true; platformWindow()->adjustBufferSize(); diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h index 35efd68571..d71e274a1d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h @@ -64,19 +64,11 @@ public: void endPaint(); private: - class ScrollOp { - public: - ScrollOp(const QRegion &a, int x, int y) : totalArea(a), dx(x), dy(y) {} - QRegion totalArea; - int dx; - int dy; - }; - QQnxRasterWindow *platformWindow() const; QWindow *m_window; - QList m_scrollOpList; - bool m_hasUnflushedPaintOperations; + bool m_needsPosting; + bool m_scrolled; }; QT_END_NAMESPACE