Bug 49377

Summary: [Qt][WK2] Implement BackingStore
Product: WebKit Reporter: Balazs Kelemen <kbalazs>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: kling, noam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
Patch none

Description Balazs Kelemen 2010-11-11 04:56:24 PST
Fill stubbed BackingStore with implmentation!
Comment 1 Balazs Kelemen 2010-11-11 05:10:25 PST
I have a weird problem with implementing this method:
PassOwnPtr<GraphicsContext> BackingStore::createGraphicsContext()
I need to create a QImage and a QPainter on heap to create the GraphicsContext.
Our GC implementation does not own the painter so this would cause a leak.
I took a look at the CoreGraphics and Cairo implementation of GC and those
owns the platform specific data. Unfortunately we cannot tweak the GC to
behave like those because:
1. in some cases we get the painter from the user so we are not allowed to
   own that
2. there is no way to create a copy from an active painter
   (active = begin has been called)

So what I did in the change that will be uploaded is adding a way to explicitly
take off ownership of the painter and the paint device to the GC.
Comment 2 Balazs Kelemen 2010-11-11 05:31:22 PST
Created attachment 73601 [details]
Patch
Comment 3 Andreas Kling 2010-11-11 07:35:38 PST
Comment on attachment 73601 [details]
Patch

r=me
Comment 4 Balazs Kelemen 2010-11-11 07:47:52 PST
Comment on attachment 73601 [details]
Patch

Clearing flags on attachment: 73601

Committed r71821: <http://trac.webkit.org/changeset/71821>
Comment 5 Balazs Kelemen 2010-11-11 07:48:01 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Balazs Kelemen 2010-11-11 08:30:10 PST
Noam, could you take a post review on the patch? Maybe it should be tweaked for
performance (maybe the QImage format).
Comment 7 Noam Rosenthal 2010-11-11 08:59:35 PST
Post review looks good!
Comment 8 Andreas Kling 2010-11-11 09:22:40 PST
One thing we might want to look at later is letting QImage align its scanlines on 32-bit boundaries (the default behavior) instead of using the cramped W*H*4 format.

It basically just means overriding UpdateChunk::size() and removing the stride (width * 4) arguments to QImage constructors.