[Kde-games-devel] [Patch] Fix QPainter usage

Ian Wadham ianw2 at optusnet.com.au
Thu Dec 27 10:54:15 CET 2007


On Thu, 27 Dec 2007 05:28 am, Christian Ehrlicher wrote:
> I now found the place where I've my information about QPainter::end()
> from. Looks like it's outdated:
> http://doc.trolltech.com/3.3/qpainter.html#end
> see also QPainter::flush(). I've also looked through the Qt examples and
> demos and there QPainter::end() is used every time before accessing the
> QImage. So it's good practice :)
>
Ah yes, it said more than the newer stuff ... :-)

> <snip>
> Now QPixmap::fromImage() works different on windows than on linux. On
> linux the pixmap data is created from scratch, on windows the qimage
> data is simply copied -> the ref counter is inceased and detach() does a
> deep copy later:
>
IIUC, in Windows QImage and QPixmap are identical formats and both
are objects at the client (or only) end.  In Linux, QPixmap is a format
used by the X Server and QPixmap::fromImage() would have to create a
new object and transmit it to the X Server.  So I suppose that is why it
works in Linux, even if the QPainter (technically) is still active on the
QImage and has not been "ended" yet.

It's nice to get to the bottom of things.  Thanks Christian, Ian W.


More information about the kde-games-devel mailing list