[webkit-qt] performance opportunities in graphics processing

chunrong lai chunronglai at gmail.com
Tue Oct 26 09:11:52 PDT 2010

    I might see some performance opportunities in the graphics processing.
Maybe you can help for a check?
    (1) I see that since https://bugs.webkit.org/show_bug.cgi?id=41774 smooth
pixmap transforms are enabled but with some overhead.
          In my understanding we do not need such transforms if we
draw/scale a pixmap to a smaller size. Isn't it?

--- ./WebKit-trunk.orig/WebCore/platform/graphics/qt/ImageQt.cpp 2010-10-13
17:09:53.147679299 +0800
+++ ./WebKit-trunk/WebCore/platform/graphics/qt/ImageQt.cpp 2010-10-20
15:24:43.714650408 +0800
@@ -205,12 +204,15 @@ void BitmapImage::draw(GraphicsContext*
        p.drawPixmap(QRect(0, 0, normalizedDst.width(),
normalizedDst.height()), *image, normalizedSrc);
        painter->drawImage(shadowImageRect, shadowImage, normalizedSrc);

     // Test using example site at
     // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
+    float tsw = src.width();
+    float tsh = src.height();
+    float tw = dst.width();
+    float th = dst.height();
+    if( tw <= tsw && th <= tsh
) painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
     painter->drawPixmap(dst, *image, src);

 (2) Also from ImageQt.cpp I see statements due to
    if (!image->hasAlpha() && painter->compositionMode() ==
        compositionMode = QPainter::CompositionMode_Source;

    This statement often disable raster graphics engine optimization in
void QRasterPaintEnginePrivate::recalculateFastImages()
    s->flags.fast_images = !(s->renderHints &
                           && rasterBuffer->compositionMode ==
                           && s->matrix.type() <= QTransform::TxShear;
   for some QImage::Format_RGB32 pages which are stored using a 32-bit RGB
format (0xffRRGGBB) but regarded as without alpha channel according to
   I wonder if QImage::Format_RGB32 can be just regarded as a special case
(always 0xFF alpha) of Format_ARGB32? What is the side-effect to keep the
CompositionMode_SourceOver mode here beside the observed performance gain?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20101027/2955925b/attachment.html>

More information about the webkit-qt mailing list