I have program, written on QT 4.3.3, which displays and allows to scroll over large SVG files.
It uses standard SVG module from QT for rendering.

SVG files, which i must display, are large - more than 100mb.
Rendering of entire SVG file using native QPixmap takes up to 10 sec.
If use OpenGL, rendering may be faster, but anyway takes several seconds.
That is why i placed rendering in another thread so that interface would not "freeze" while image is prepared.
And i could do it only for native rendering on QPixmap. OpenGL rendering in 2 concurrent threads crushes my program. (One thread - active screen, other - buffer for new image)

But Adobe illustrator displays same images much more faster. Is it using OpenGL?
My task is made my program as fast as Illustrator.
Can you give me some hints for it?

Can i do openGL so fast, so that second thread would not be needed?

Dark Photon

04-06-2009, 04:37 PM

I have program, written on QT 4.3.3, which displays and allows to scroll over large SVG files.
It uses standard SVG module from QT for rendering. ... SVG files, which i must display, are large - more than 100mb.
Rendering of entire SVG file using native QPixmap takes up to 10 sec. ... But Adobe illustrator displays same images much more faster. Is it using OpenGL?
My task is made my program as fast as Illustrator.
Can you give me some hints for it?

The key question here is where is your current rendering pipeline bottlenecked. You need to profile your app and see where it's spending all its time. If you have the source for all this, it should be easy since it's all running on the CPU.

Once you know why it's bottlenecked, you can explore what you can do about it. If it's doing something really stupid like rendering this "huge" image (QPixmap) in insane levels of detail for the resolution its displayed at and/or rendering a bunch of detail totally outside the view of the QPixmap you can see in the window (for instance), and assuming you can't change the way that SVG module is doing its job, then you can probably make some performance headway by doing the rendering yourself.

For instance, you can do "culling" and not waste time rendering any nonsense that's outside the view your rendering. You can use a bounding volume heirarchy to group objects so that this culling executes as quickly as possible.

You can also be smarter about the density that lines/edges/curves are sampled than maybe the default SVG module is being, reducing the amount of work to be done for the primitives that "are" in the view.

However, first, makes sure you don't have some finer controls over how the SVG module does rendering, such as the target QPixmap resolution, sampling rate, quality settings, etc.