On Thu, Jun 08, 2006 at 10:29:39AM +0200, Abdelrazak Younes wrote: > >>>Abdelrazak> The QPicture class "records" painting operations, it is > >>>Abdelrazak> similar to vector based painting (SVG or windows Meta > >>>Abdelrazak> file). So when you paint onto a QPicture it is not a real > >>>Abdelrazak> painting. The real painting happens when you "replay" the > >>>Abdelrazak> QPicture onto another pixmap oriented device. The fact > >>>Abdelrazak> that all painting operations happen in one go (during the > >>>Abdelrazak> update to the screen) is the winning factor here because > >>>Abdelrazak> the painting operation are "unified" first. > >> [...] > >>_I_ think it is faster because of there is only one pixmap drawing. > > > >I bet against it. > > My preliminary assessment (scrolldown with PageDown) says the opposite > though. Besides, I never said I was sure of it. I explained my > reasoning... would you care to explain yours?
Storing lots of things in a QPicture eats a lot of memory. That's one. For two: I cannot see a conceptional difference on Win: There all the drawing is done using that (Gunnar, look away!) insane raster painter. That's basically the same thing that's used when painting to a QImage on all platforms, and that's were the QPicture contents will end up eventually as well. Flushing the raster painter buffer to the 'native' window is done exactly once in each case, namely at the end of the paintEvent() [And unconditionally so if I may add.] So going through the QPicture should be really just a diversion. Well... when I think about it, it might be possible that QPicture compresses some operations and avoid, say, changing pens too often. So in theory there might be a gain (note that I haven't checked the code here). But then one might ask why TT puts energy into a rarely used device (QPicture) yet leave the main road in that unfortunate state it is in now. Things are a bit different on X11 were most painter calls result in a direct communication from client to server. Flushing a single QPixmap in the end might be less total net traffic, but I doubt you'll see better speed either because the full data chunk is sent at the end whereas the piece-by-piece strategy produces a data flow that's more streched over time. Thing might be completely different in case TT fell into some trap and uses bi-directional communication. I am not aware of this being the case, though, but I haven't checked the X11 painting code as intensively as I did for the Windows code. Andre'