Bug 30823 - Fix alpha handling when using wxWidgets 2.9
Summary: Fix alpha handling when using wxWidgets 2.9
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit wx (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Kevin Ollivier
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-27 08:29 PDT by Vadim Zeitlin
Modified: 2009-11-09 12:37 PST (History)
1 user (show)

See Also:


Attachments
Patch fixing alpha transparency handling for wx port (3.68 KB, patch)
2009-10-27 08:29 PDT, Vadim Zeitlin
no flags Details | Formatted Diff | Diff
Patch fixing alpha transparency handling for wx port (v2) (3.80 KB, patch)
2009-10-27 17:29 PDT, Vadim Zeitlin
kevino: review-
Details | Formatted Diff | Diff
"Standalone" version of the patch (2.01 KB, patch)
2009-11-06 18:35 PST, Vadim Zeitlin
kevino: review+
kevino: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim Zeitlin 2009-10-27 08:29:54 PDT
Created attachment 41955 [details]
Patch fixing alpha transparency handling for wx port

Transparency in PNG images didn't work in wxWebKit because the wxBitmap "has alpha" internal flag was not set before wxGraphicsBitmap was created from it. This flag is set in wxPixelData dtor and, generally speaking, bitmap data can't be accessed at all while it is locked for the raw access via wxPixelData so we must ensure that the local "data" variable is destroyed before using bitmap in any way.

This patch does just this: in spite of many apparent changes it simply adds a block around "data" variable to ensure that it is destroyed (this should be more clear if the patch is applied and "diff -b" is done).
Comment 1 Vadim Zeitlin 2009-10-27 08:32:17 PDT
Sorry, I forgot to mention that this patch was done on top of bug 30822. However even if 30822 is not applied, this one should still be as it fixes a real user-visible bug. Please let me know if I should redo the patch against the base line (OTOH it basically just adds two lines with "{" and "}" so maybe there is no need for this).
Comment 2 Eric Seidel (no email) 2009-10-27 11:48:45 PDT
Comment on attachment 41955 [details]
Patch fixing alpha transparency handling for wx port

Your ChangeLog does not make it clear what this patch does.

I believe webkit style is to use spaces around operators:
+            p.Red() = bytes[i+2];
+            p.Green() = bytes[i+1];
+            p.Blue() = bytes[i+0];
+            p.Alpha() = bytes[i+3];
Comment 3 Vadim Zeitlin 2009-10-27 17:28:17 PDT
(In reply to comment #2)
> (From update of attachment 41955 [details])
> Your ChangeLog does not make it clear what this patch does.

I've tried to make it more precise while still remaining brief. I hope it's more clear now.
 
> I believe webkit style is to use spaces around operators:
> +            p.Red() = bytes[i+2];
> +            p.Green() = bytes[i+1];
> +            p.Blue() = bytes[i+0];
> +            p.Alpha() = bytes[i+3];

Sorry, I just indented this code, I didn't modify it at all. I've reformatted it now and will attach the new patch in a moment.
Comment 4 Vadim Zeitlin 2009-10-27 17:29:13 PDT
Created attachment 41997 [details]
Patch fixing alpha transparency handling for wx port (v2)
Comment 5 Kevin Ollivier 2009-11-05 20:55:17 PST
Hi Vadim,

The patch itself does resolve the problem, but this patch won't apply cleanly because you made the patch on top of a branch that has your changes to NativeImagePtr in it. If you submit a fixed patch against stock trunk sources, I'll be happy to r+ and land it.
Comment 6 Vadim Zeitlin 2009-11-06 18:35:08 PST
Created attachment 42682 [details]
"Standalone" version of the patch 

Here is the version of the patch which should apply cleanly. As I wrote, it's completely trivial: it just adds a scope (and also spaces around "+" operator as requested although IMO this shouldn't be applied together with this patch at all as it has nothing to do with it...).
Comment 7 Kevin Ollivier 2009-11-09 12:37:58 PST
Landed in r50677, thanks! Note that the patch didn't conform to WebKit style since the code inside the braces was not indented, but as I wanted to get this landed, I fixed the issue before commit this time. However, most reviewers will r- a patch that doesn't conform, so things will go quicker if you make sure style issues are addressed before submission.