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

Luciano Montanaro mikelima at gmail.com
Thu Dec 27 12:16:54 CET 2007


Il Thursday 27 December 2007 10:54:15 Ian Wadham ha scritto:
> 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.

Well, I hope there are no new surprises. I'd like to try to render to pixmaps 
directly (isntead on QImages), since it should be possible to do so wit Qt4, 
and it should use the hardware acceleration for rendering operations. I hope 
such a change will not disrupt the Windows port again. 

Anyway -- the release is in two weeks. I'll start breaking stuff again after 
that :)

Luciano

>
> It's nice to get to the bottom of things.  Thanks Christian, Ian W.
> _______________________________________________
> kde-games-devel mailing list
> kde-games-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-games-devel




More information about the kde-games-devel mailing list