Example #1
0
QT_BEGIN_NAMESPACE

QAndroidPlatformBackingStore::QAndroidPlatformBackingStore(QWindow *window)
    : QPlatformBackingStore(window)
{
    if (window->handle())
        setBackingStore(window);
}
Example #2
0
void QAndroidPlatformBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
    Q_UNUSED(offset);

    if (!m_backingStoreSet)
        setBackingStore(window);

    (static_cast<QAndroidPlatformWindow *>(window->handle()))->repaint(region);
}
Example #3
0
/*!
    Initialize the gadget from settings obtained from the system.  This
    function is called if the storage gadget is \l active() when it is
    constructed.
*/
void QUsbStorageGadgetProvider::initFromSystem()
{
    QSettings settings("Trolltech", "Usb");

    QString paramPath = settings.value("PeripheralController/Path").toString() +
                        "/gadget/driver/module/parameters/";

    QFile file(paramPath + "iManufacturer");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setVendor(file.readLine().trimmed());
        file.close();
    }

    file.setFileName(paramPath + "idVendor");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setVendorId(file.readLine().trimmed().toUInt());
        file.close();
    }

    file.setFileName(paramPath + "iProduct");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setProduct(file.readLine().trimmed());
        file.close();
    }

    file.setFileName(paramPath + "idProduct");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        setProductId(file.readLine().trimmed().toUInt());
        file.close();
    }

    file.setFileName(paramPath + "file");
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QStringList devices = QString(file.readLine().trimmed()).split(',');
        setBackingStore(devices);
        file.close();
    }

    setValue("active", true);
}
Example #4
0
/*!
    Initialize the gadget from settings in the configuration file.
*/
void QUsbStorageGadgetProvider::initFromConfig()
{
    QSettings settings("Trolltech", "Usb");

    settings.beginGroup(GADGET_NAME);

    QVariant v = settings.value("Vendor");
    if (v.isValid())
        setVendor(v.toByteArray());
    else
        removeValue("vendor");

    v = settings.value("VendorId");
    if (v.isValid())
        setVendorId(v.toUInt());
    else
        removeValue("vendorId");

    v = settings.value("Product");
    if (v.isValid())
        setProduct(v.toByteArray());
    else
        removeValue("product");

    v = settings.value("ProductId");
    if (v.isValid())
        setProductId(v.toUInt());
    else
        removeValue("productId");

    v = settings.value("BackingStore");
    if (v.isValid())
        setBackingStore(v.toStringList());
    else
        removeValue("backingStore");

    settings.endGroup();

    setValue("active", false);
}
Example #5
0
/*!
    Sets the list of backing store devices to \a paths.
*/
void QUsbStorageGadget::setBackingStore(const QStringList &paths)
{
    invoke(SLOT(setBackingStore(QStringList)), qVariantFromValue(paths));
}
Example #6
0
void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
{
    QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
    if (!m_windows.contains(window))
        return;

    WindowData &data = const_cast<WindowData &>(m_windows[window]);

    //If were not in grabOnly mode, dont render a non-renderable window
    if (!data.grabOnly && !cd->isRenderable())
        return;

    //Resize the backing store if necessary
    if (m_backingStores[window]->size() != window->size()) {
        m_backingStores[window]->resize(window->size());
    }

    // ### create QPainter and set up pointer to current window/painter
    QSGSoftwareRenderContext *ctx = static_cast<QSGSoftwareRenderContext*>(cd->context);
    ctx->initializeIfNeeded();

    bool alsoSwap = data.updatePending;
    data.updatePending = false;

    if (!data.grabOnly) {
        cd->flushFrameSynchronousEvents();
        // Event delivery/processing triggered the window to be deleted or stop rendering.
        if (!m_windows.contains(window))
            return;
    }
    QElapsedTimer renderTimer;
    qint64 renderTime = 0, syncTime = 0, polishTime = 0;
    bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();
    if (profileFrames)
        renderTimer.start();
    Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);

    cd->polishItems();

    if (profileFrames)
        polishTime = renderTimer.nsecsElapsed();
    Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
                              QQuickProfiler::SceneGraphRenderLoopFrame,
                              QQuickProfiler::SceneGraphPolishPolish);

    emit window->afterAnimating();

    cd->syncSceneGraph();
    rc->endSync();

    if (profileFrames)
        syncTime = renderTimer.nsecsElapsed();
    Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
                              QQuickProfiler::SceneGraphRenderLoopSync);

    //Tell the renderer about the windows backing store
    auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer);
    if (softwareRenderer)
        softwareRenderer->setBackingStore(m_backingStores[window]);

    cd->renderSceneGraph(window->size());

    if (profileFrames)
        renderTime = renderTimer.nsecsElapsed();
    Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
                              QQuickProfiler::SceneGraphRenderLoopRender);

    if (data.grabOnly) {
        grabContent = m_backingStores[window]->handle()->toImage();
        data.grabOnly = false;
    }

    if (alsoSwap && window->isVisible()) {
        //Flush backingstore to window
        if (!isNewExpose)
            m_backingStores[window]->flush(softwareRenderer->flushRegion());
        else
            m_backingStores[window]->flush(QRegion(QRect(QPoint(0,0), window->size())));
        cd->fireFrameSwapped();
    }

    qint64 swapTime = 0;
    if (profileFrames)
        swapTime = renderTimer.nsecsElapsed();
    Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
                           QQuickProfiler::SceneGraphRenderLoopSwap);

    if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
        static QTime lastFrameTime = QTime::currentTime();
        qCDebug(QSG_RASTER_LOG_TIME_RENDERLOOP,
                "Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d",
                int(swapTime / 1000000),
                int(polishTime / 1000000),
                int((syncTime - polishTime) / 1000000),
                int((renderTime - syncTime) / 1000000),
                int((swapTime - renderTime) / 10000000),
                int(lastFrameTime.msecsTo(QTime::currentTime())));
        lastFrameTime = QTime::currentTime();
    }

    // Might have been set during syncSceneGraph()
    if (data.updatePending)
        maybeUpdate(window);
}