| Summary: | [JFace] CompositeImageDescriptor mixes images with alpha channel wrong | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Stephan Wahlbrink <sw> | ||||||||||
| Component: | UI | Assignee: | Oleg Besedin <ob1.eclipse> | ||||||||||
| Status: | VERIFIED FIXED | QA Contact: | Susan McCourt <susan> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | ob1.eclipse, remy.suen, Silenio_Quarti | ||||||||||
| Version: | 3.7 | ||||||||||||
| Target Milestone: | 3.7 M7 | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Stephan Wahlbrink
Created attachment 192415 [details]
Example for icon which is not painted correctly
Created attachment 192416 [details]
Screenshot of the painted DemoIcon
Created attachment 192417 [details]
Patch proposal
That code was originally added in bug 147072. Silenio, do you remember if that was a copy from SWT-something? I believe it came from org.eclipse.swt.graphics.GC line#1367. Created attachment 192665 [details]
Updated patch
Nice find and a very good fix!
The current code is only correct if dstAlpha is 1.0. Which it is in many / most cases, but obviously not always. Even then the calculation of dstAlpha we have is wrong as for a semi-transparent overlay of opaque image it will produce result which will be partially transparent.
I'd like to make a few updates to the patch:
- Keep current formulas for when dstAlpha == 1.0, expect calculation of the result alpha channel which is alway going to be 1.0 in this case. This is both for performance and to minimize effect of the change.
- Add a check for re-calculated dstAlpha being 0 (it could happen if both original image and overlay are transparent at some point).
- Updated copyright
Updated patch applied to CVS Head. Thank you Stephan, excellent job! Thanks. (In reply to comment #6) > - Add a check for re-calculated dstAlpha being 0 (it could happen if both > original image and overlay are transparent at some point). I think it will not happen because sourceAlpha == 0 is already checked some lines above. Of course, the check is no problem. Ciao, Stephan Verified in I20110425-1800. |