On Fri, Mar 17, 2006 at 10:19:09AM +0000, Angus Leeming wrote:
> Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> > Hum, after thinking a bit more about this, I am maybe wrong here
> > when the windowing system is an X11 server. Georg's post pushed me
> > to try using a backing QImage instead of a QPixmap. I cannot feel
> > any speed difference within Windows but I guess it can make a big
> > difference on X11. Especially over the network as pointed by Georg.
> > Besides, the code is cleaner and a bit shorter.
> 
> class QWorkArea {
> 
> A     /// Comment is now incorrect...  /// return the backing pixmap A
> /// Two thoughts here: A      /// 1. pixmap_.get() will never return 0, so
> the fact that A       ///    you store a (smart) pointer is an
> implementation detail.  A     ///    This function should return
> QPaintDevice&.  A     /// 2. Don't use C-style casts. Also, why is a cast
> necessary anyway?  A  ///    Doesn't QImage derive from QPaintDevice?
> -     QPixmap * pixmap() const { return pixmap_.get(); } +    QPaintDevice *
> paintDevice() const { return (QPaintDevice*) pixmap_.get(); }
> 
> 
> A     /// Do an old man a favour and rename the underlying store ;-)
> boost::scoped_ptr<QImage> pixmap_; };
> 
> 
> I think that this change is wrong (QPixmap -> QImage for the cursor).

Me too.

> I seeem to remember in the dim and distant past that we used a QImage
> and that that resulted in traffic down an ADSL line. Remember, the
> underlying pixmap of a QPixmap is stored on the machine that's doing
> the drawing, so the flashing cursor requires only an instruction to
> switch from one pixmap to the other rather than sending a new pixmap
> down the line each time.
> 
> Of course, I may well be remembering incorrectly! I'm sure that Martin
> will have more details because it was his ADSL line. At least, that's
> what I remember ;-) class QScreen { /// our owning widget QWorkArea &
> owner_;

I think this was pretty much the scenario.

If something ('small') is cached for drawing it should be a pixmap.

Images are good for pixel wise manipulations by the client CPU.

The problem with Qt is that 4.x on windows uses the raster painter only,
so all graphics is done by the CPU and so using QImage appears to be
fast in cases were it is conceptionally wrong.

Andre'

Reply via email to