[webkit-qt] QImage vs QPixmap as native image

Konstantin Tokarev annulen at yandex.ru
Fri Sep 13 04:58:33 PDT 2013

13.09.2013, 15:50, "Jocelyn Turcotte" <jocelyn.turcotte at digia.com>:
> On Fri, Sep 13, 2013 at 03:12:59PM +0400, Konstantin Tokarev wrote:
>>  Hi all,
>>  There was a patch [1] that was later reverted because of performance degradation on DirectFB, where QPixmap is hardware accelerated.
>>  We use QtWebKit 2.3.3 with Qt 4.8 on embedded system. We have internally written gfxdriver for QWS which does not provide hardware acceleration for QPixmap's, but allows to create hardware accelerated QImage's (I know it's rather strange, but it's what we have right now).
>>  Now I'd like to provide hardware acceleration for images in QtWebKit.  What route is better for me:
>>  1) apply [1] again on top of QtWebKit 2.3 and use accelerated QImage's;
>>  2) add hardware acceleration for QPixmap's (it does not seem too difficult from implementation point of view for me)?
>>  Are there any performance advantages from using QImage with WebKit native decoders as compared to QPixmap?
> If my memory serves me right, QPixmap and QImage are the same up to the point where they are given to a paint engine through QPainter.
> Since decoding in QtWebKit happens before that point, any operation on a QPixmap will just be delegated to its internal QImage.
> In Qt4 the X11 paint engine is converting them to an XPixmap, which would allow hardware assisted blitting. Performances should be the same between QPixmap and QImage when using the raster paint engine.
> In Qt5 linux now uses the raster paint engine as well, the only advantage of QPixmap that I'm aware of is for the image blitting special case of the DirectFB platform plugin that you mentioned.

Thank you for reply,

I was more interested in possible advantages of QImage over QPixmap in QtWebKit (not vice versa). For example, QPixmap does not allow direct manipulations with its pixel buffer which might be used to speed up some operations. I'm just wondering if such trick was an initial motivation for QPixmap -> QImage conversion.

(I'm not using X11 and I can get hardware blitting for QImage)


More information about the webkit-qt mailing list