[Qt-interest] bliking when overpainting on the XvImage with QPainter
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Jul 8 18:02:32 CEST 2009
Knoll Oliver, ITS-CMT-SUI-SL-PDC-FIN-DEV wrote on Wednesday, July 08, 2009 5:48 PM:
> ...
> Also refer to the Qt specific way (ooooold, from 1996 - and it still
> metions hardware such as Amstrad CPC and Amiga - nice :). Computers
> from the times when programmers still knew about assembler and stuff
> and tweaked every CPU cycle to get smooth scrolling. Flicker-free off
> course ;) - but I think the technique described there still applies,
> at least you'd get some inspiration from it):
>
> http://lists.trolltech.com/qt-interest/1996-09/thread00036-0.html
Hmmm, seems like the "good old times" have changed, I should have mentioned the following URL:
http://doc.trolltech.com/4.5/qt4-arthur.html#widget-double-buffering
Seems like Qt widgets nowadays feature double-buffering by default (unless you set the attribute Qt::WA_PaintOnScreen - which you DID! Leave it to the default setting).
Now my assumption is that your
m_scene->put(m_window, m_gc, rect());
(which on its turn calls XvPutImage) seems to trigger an update of the visible screen, before your text is actually drawn - just a wild guess, and I am not sure how the synX does help here (or make things even worse), I am not an X11 expert.
Try to put your XvImage into a QPixmap and draw that QPixmap into your widget, together with the text. This should avoid the flickering. Then try to optimise that solution, the method
http://doc.trolltech.com/4.5/qpixmap.html#fromX11Pixmap
(which was introduced with Qt 4.5!) might be useful. Try to access/draw the XvImage data directly into the "Qt double buffer", without copying it first into a QPixmap, as in the following pseudo-code:
...
XvImage xvImage = XvGetImage();
QPixmap pixmap = QPixmap::fromX11Pixmap(xvImage.pixmap());
painter.drawPixmap(pixmap);
painter.drawText(...);
...
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list