- Could you please also show the definition of ToRenderStructObject and did you check how much time it takes to fill it ?
- What type of color map do you use ?
- Did you enable DEBUG_RENDER and what values do you see ?
- And are you using more than one core ?
The image is rendered in the minimum of the resolutions of data/screen. But without implementing the pixelHint() the resolution of the data is not known and it will always end up in screen resolution.The resolution of the data is relatively high, 1080x500 in one occasion, and 2000x2000 in another occasion, and they are painted in rather small resolution widgets-graphs since they can't both fit in the screen.
I have not re implemented pixelHint(). Is that something that would help me?
Implementing a pixelHint helps, when the data resolution is below the resolution of the plot canvas ( = size in pixels ) - so in your case probably not.
This method is called for every pixel - for a resolution of 1000x1000 this will be a million times and removing any pointless operation from it will have a significant effect.My implementation of the value() function:
- Better do these "will never happen" checks in debug mode only.
- Everything that can be calculated in advance should be done in YourRasterData::initRaster. F.e something like "(data_.size() - 1) * interval_y.maxValue() - interval_y.minValue()" is constant and does not need to be calculated again and again.
- Don't use std::round() - casting to int should be good enough.
But the implementation is not totally bad and accessing data_ might be the bottleneck.
Why don't you simply use QwtPlotMatrixData - or at least copy the code and strip it down to the minimum you need ? It is faster than your code and the main reasons for not using it ( calculate the values on the fly or returning values from the original buffer without having an extra copy ) seem to be irrelevant in your situation.
Concerning using the GPU: as long as you don't have an OpenGL canvas you would need to:
- prepare data
- upload data
- create something with the GPU
- download the result
- translate it into an image
- draw the image
Uwe
Bookmarks