Menu

#252 QwtPlotRenderer

None
closed
nobody
None
5
2015-10-01
2015-09-01
Anonymous
No

line 300 of qwt_plot_renderer.cpp
QImage image( imageRect.size(), QImage::Format_ARGB32 );

From http://doc.qt.io/qt-5/qimage.html#Format-enum
Note: Do not render into ARGB32 images using QPainter. Using QImage::Format_ARGB32_Premultiplied is significantly faster.

Is there a good reason to render into ARGB32?
Qt recomment to use Format_ARGB32_Premultiplied instead.
Other way is to provide a setter to change the QImage Format in qwt_plot_renderer.cpp.

Discussion

  • Uwe Rathmann

    Uwe Rathmann - 2015-09-01

    I'm aware of the statement in the Qt docs, but I've never crossed an operation in the context of Qwt, where this statement proved to be true. Maybe for operations between images, but when manipualting RGB values directly ( spectrogram ) I would consider ARGB32 being faster - if there is much difference at all.

    In QwtPlotRenderer there is only one occurence of a QImage - a temporary buffer used on the way for writing it to disk. In this context you can be sure, that the format will completely unimportant compared to what it takes to convert/store it to disk.

    Just in case: QwtPlotRenderer::renderDocument() is a convenience method only and you could also decide to use a different format, when using a more low level method.

    But please try yourself and let me know if you found operations where you prove of being faster with Format_ARGB32_Premultiplied.

     
  • Anonymous

    Anonymous - 2015-09-14

    Hi Uwe,
    i checked ARGB32 and ARGB32_Premultiplied with a plot that contains same data with an export to PNG
    file with 300dpi and 600dpi.

    • filesize is nearly the same, but doesn't matter (the higher the dpi, the less the difference)
    • i checked the speed very simple with QTime::start() and QTime::elapsed() and
      ARGB32 was quicker. I cant' confirm the official statement from Qt that ARGB32_Premultiplied should be
      quicker. ARGB32 was less than 4% quicker.

    I think the current setting ARGB32 is the better choice for Qwt.

     
  • Uwe Rathmann

    Uwe Rathmann - 2015-10-01
    • status: open --> closed
    • Group: -->
     

Anonymous
Anonymous

Add attachments
Cancel