Which Qt version?

https://bugreports.qt.io/browse/QTBUG-42330

Is perhaps related?

Harri

On 03/02/2015 08:55, Alexander Semke wrote:
Hi,

I'm one of the developers of LabPlot, a KDE-application for interactive
plotting and analysis of data. I'm struggling with a problem since long time
that prevents the next release of the software. So, any help on this issue
will be highly appreciated :-)

To speed up the painting of large curves we use the "double buffering"
technique - the curve is painted on a QPixmap in updatePixmap()-function (only
called when the user changes the properties of the curve) and then painted to
Curve (derived from QGraphicsItem) in the paint()-function (called much more
frequently)

Curve::updatePixmap() {
        QPixmap pixmap(boundingRectangle.width(), boundingRectangle.height());
        QPainter painter(&pixmap);
        painter.setRenderHint(QPainter::Antialiasing, true);
        //perform drawing

        m_pixmap = pixmap;
}

Curve::paint((QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) {
        painter->save();
        painter->setPen(Qt::NoPen);
        painter->setBrush(Qt::NoBrush);
        painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
        painter->drawPixmap(boundingRectangle.topLeft(), m_pixmap);
        painter->restore();
}

The performance gain is huge. But there is also a huge drop in the quality
that I cannot explain. I attached two screenshots - with and without double
buffering. Without double buffering just means that all the drawing stuff is
done in paint() directly.

What am I doing here wrong? Any ideas?




_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to