Bug 30211 - [Qt] Consider prefering QImage* over QPixmap* as NativeImagePtr
Summary: [Qt] Consider prefering QImage* over QPixmap* as NativeImagePtr
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2009-10-08 07:43 PDT by Holger Freyther
Modified: 2014-02-03 03:13 PST (History)
3 users (show)

See Also:


Attachments
Proposed change to change NativeImagePtr to QImage and method to cache certain images as QPixmap (17.96 KB, patch)
2009-10-08 07:48 PDT, Holger Freyther
abarth: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Freyther 2009-10-08 07:43:22 PDT
We need to find out if for the majority of cases of painting images we are going through the raster fallback or through the accelerated path of the PaintEngine. The problem in Bitmap::drawImage is that we will probably scale the image which means that the raster engine will need to convert the QPixmap back to a QImage which is requiring a roundtrip for every image we paint.

The performance test content should be used to determine how often we are going through the draw_helper for image painting.
Comment 1 Holger Freyther 2009-10-08 07:48:05 PDT
Created attachment 40870 [details]
Proposed change to change NativeImagePtr to QImage and method to cache certain images as QPixmap

If measurements show that this patch is faster I would heavily encourage to use it. For now I'm seeking for review, advice and ideas on how to fill the findScaledOrCreatePixmap with content. I'm searching for criteria where we would like to create a QPixmap for performance reasons and assume we have access to CachedImage as well.
Comment 2 Simon Hausmann 2009-10-12 22:18:29 PDT
Hmm, is the goal to distinguish between a paintengine that _can_ draw transformed pixmaps efficiently (i.e. openvg or opengl) and a paintengine that fails to do so (x11) ?

If yes, I guess we could try to use the paint engine's feature flags to determine this at run-time.
Comment 3 Holger Freyther 2009-10-12 22:45:39 PDT
(In reply to comment #2)
> Hmm, is the goal to distinguish between a paintengine that _can_ draw
> transformed pixmaps efficiently (i.e. openvg or opengl) and a paintengine that
> fails to do so (x11) ?
> 
> If yes, I guess we could try to use the paint engine's feature flags to
> determine this at run-time.

This would be one idea, in general this is about collecting ideas and then measuring. My impression is that blindly converting to a QPixmap even if it is only painted once will not be a win so we should have a better strategy.


Some more background information. When looking at the Szeged Image test site we load big images and scale them down to 100x100. So what happens there is we load the big QImage, convert it to a bigger QPixmap (XImage..) and upload, convert it back to a bigger QImage, paint.

After having instrumented the BitmapImage::drawImage routine on the test content I see that the above is the minority. From my instrumentation something like 10% of draw operations are scaling images.
Comment 4 Adam Barth 2009-10-18 22:56:03 PDT
Comment on attachment 40870 [details]
Proposed change to change NativeImagePtr to QImage and method to cache certain images as QPixmap

I'm not an expert on this code, but in general terms, this patch seems fine.  However, the patch itself either has tabs or incorrect indenting.
Comment 5 Jocelyn Turcotte 2014-02-03 03:13:08 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.