Results 1 to 3 of 3

Thread: Random-memory image in QwtPlotSpectrogram when using invalid Z-interval

  1. #1
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Random-memory image in QwtPlotSpectrogram when using invalid Z-interval

    Hello,

    Our application sometimes triggers a condition when the Z-interval set for QwtMatrixRasterData is invalid (contains NaNs, for example) because the data itself is invalid. The result is that QwtPlotSpectrogram draws unfilled image from uninitialized memory.

    This seems to happen in QwtPlotSpectrogram::renderImage(), near
    Qt Code:
    1. if ( !intensityRange.isValid() )
    2. return image;
    To copy to clipboard, switch view to plain text mode 

    If I modify it to the following, a proper transparent image is returned and the random-colored blocks go away.
    Qt Code:
    1. if ( !intensityRange.isValid() ) {
    2. image.fill(qRgba(0, 0, 0, 0));
    3. return image;
    4. }
    To copy to clipboard, switch view to plain text mode 

    To reproduce, just change
    setInterval( Qt::ZAxis, QwtInterval(1.0, 6.0) );
    to
    setInterval( Qt::ZAxis, QwtInterval(1.0, -1.0) );
    in the rasterview example.

    Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Random-memory image in QwtPlotSpectrogram when using invalid Z-interval

    Hm - isn't a null image ( QImage() ) a more adequate return value for this situation ?

    Uwe

  3. #3
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Random-memory image in QwtPlotSpectrogram when using invalid Z-interval

    I'm not sure - for me it's the random-colored blocks on the plot (because of uninitialized memory) that are the problem. As long as the plot behaves normally (that is, not randomly, like now), I'm ok.
    Note that there are other items on the plot (besides the spectrogram) which should still work, that's why I picked a transparent image. Also, since NaN behaves like a transparent pixel, and if all my data is composed of NaNs (so the intervals are NaNs as well), I guess that's what I expected. If null image provides all that, I have nothing against it.
    Thanks

Similar Threads

  1. Image: out of memory, returning null image
    By darek_hecpl in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 22nd September 2010, 13:48
  2. Loading an image into memory
    By Luc4 in forum Qt Programming
    Replies: 6
    Last Post: 12th April 2010, 08:44
  3. Replies: 1
    Last Post: 7th April 2010, 16:26
  4. Replies: 2
    Last Post: 18th February 2010, 15:57
  5. how to read in image date from memory zone
    By elflord in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2009, 19:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.