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;

    // 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;
        }
    }

    // create new scroll operation
    m_scrollOpList.append( ScrollOp(totalArea, dx, dy) );
    return true;
}
void QQnxRasterBackingStore::beginPaint(const QRegion &region)
{
    Q_UNUSED(region);

    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
    m_hasUnflushedPaintOperations = true;

    platformWindow()->adjustBufferSize();
}
void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
{
    Q_UNUSED(size);
    Q_UNUSED(staticContents);
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window() << ", s =" << size;

    // NOTE: defer resizing window buffers until next paint as
    // resize() can be called multiple times before a paint occurs
}
QT_BEGIN_NAMESPACE

QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
    : QPlatformBackingStore(window),
      m_hasUnflushedPaintOperations(false)
{
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window;

    m_window = window;
}
Esempio n. 5
0
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window();

    QQnxWindow *targetWindow = 0;
    if (window)
        targetWindow = static_cast<QQnxWindow *>(window->handle());

    QQnxWindow *platformWindow = this->platformWindow();
    if (!targetWindow || targetWindow == platformWindow) {

        // 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);
    } 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;
}
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
    Q_UNUSED(offset)

    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;

    QQnxWindow *targetWindow = 0;
    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.
    if (!targetWindow || targetWindow == platformWindow()) {

        // 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;
}
QQnxRasterBackingStore::~QQnxRasterBackingStore()
{
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
}
void QQnxRasterBackingStore::endPaint()
{
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
}
Esempio n. 9
0
void QQnxRasterBackingStore::endPaint(const QRegion &region)
{
    Q_UNUSED(region);
    qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
}