AUG
26
2008
|
How to get faster Qt painting on N810 right nowMy previous post touched on the horrid FPS you can expect from any graphics intensive Qt app on the N810 at the moment. Ariya has pointed out one reason for the bad numbers: Qt decides to convert all 16 bit pixmaps to 32 bit before blitting even if the source QPaintDevice and the destination QPaintDevice are both 16 bit. Well, here is a workaround I found while we wait for some pretty big changes in the Qt painting engine for 4.5 that Ariya hinted at. Mind you it is a big hack, but it seems to work well for my use case and perhaps it would be useful to others. Introducing QX11RasterWidget:
class QX11RasterWidget : public QWidget { QImage *rasterDevice() const; protected: private: private:
#include #include QX11RasterWidget::QX11RasterWidget(QWidget *parent, Qt::WindowFlags f) m_rasterDevice = 0; QX11RasterWidget::~QX11RasterWidget() QImage *QX11RasterWidget::rasterDevice() const bool QX11RasterWidget::event(QEvent *event) void QX11RasterWidget::paintEvent(QPaintEvent *event) void QX11RasterWidget::resizeEvent(QResizeEvent *event) delete m_rasterDevice; void QX11RasterWidget::flushToX11() //Flush the m_rasterDevice to the X11 window XImage *xi = XCreateImage(display, visual, depth, ZPixmap, 0, GC gc = XCreateGC(display, hd, 0, 0); |
![]() |