Efficiently update vector image in Qml Flickable on Android



  • I'm trying to view large vector image in Qml Flickable on Android. I created an instance of QQuickPaintedItem (named ViewItem) as a child of Flickable and reimplemented paint function in such way:

    @void ViewItem::paint(QPainter *painter)
    {
    ...
    // width,height - sizes of Flickable item
    QImage image(width, height);
    ...

    // x,y - left-top coordinates of ViewItem on Flickable surface
    painter->drawImage(QPoint(x,y), image);
    }@

    It works so: when image is moved new pixmap of the whole ViewItem is created and rendered. And it's very slow. With an old Qt realization only a part of ViewItem was updated with the help of QScrollView::drawContents() function.

    Maybe it's possible to make viewer work faster with the help of update() function but I failed to understand how it works. Can you advise principles to build efficient vector image viewer for Android with scaling and moving functions? Thanks!



  • Hi, you may try and use a QOpenGLFramebufferObject instead of the QImage as the render target, also if your image doesn't change much you can cache the painted image/texture in your class I guess?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.