[OpenJDK 2D-Dev] [10] RFR JDK-8176795: Wrong color drawn when painting translucent colors on volatile images using XRender.

Phil Race philip.race at oracle.com
Mon Dec 11 18:45:27 UTC 2017

The explanation sounds reasonable, although I'd like to give Clemens a 
chance to review this.


On 12/07/2017 07:16 AM, Jayathirth D V wrote:
> Hello All,
> Please review the following fix in JDK10 :
> Bug : https://bugs.openjdk.java.net/browse/JDK-8176795
> Webrev : http://cr.openjdk.java.net/~jdv/8176795/webrev.00/ 
> <http://cr.openjdk.java.net/%7Ejdv/8176795/webrev.00/>
> Issue : When we draw translucent color over an opaque color in Unix 
> from JDK 8 we get different color after composition compared to any 
> other platform.
> Root cause : From JDK 8, X Rendering extension is enabled in Unix and 
> we see this problem only when we use XRender in Unix if we use GLX or 
>  X11 we don’t see any issue.  Also X Rendering extension expects 
> pre-multiplied alpha color values, so we need to convert the 
> non-premultiplied alpha color values to pre-multiplied alpha color 
> values before give pixel value to XRender for drawing. The main 
> problem is we do this operation of conversion twice:
> 1)When we call Graphics2D.setColor() it uses ArgbPre PixelConverter 
> based on SurfaceData(here it is XRenderPixMap ArgbPre surface) and 
> converts the color to pre-multiplied values.
> 2)When we call Graphics2D.fillRect() internally before we compose the 
> destination(opaque color) and source(translucent color) we prepare 
> source render rectangle for X Render extension. Here again we convert 
> the already converted color values to premultiplied values.
> Solution : There is no need for us to do non-pre to pre color 
> conversion again at XRender level so it should be removed. Also this 
> logic of non-pre to pre color conversion at XRender was only used when 
> source is Solid color and not Texture/Gradient. So I have completely 
> removed this logic itself as it not needed anywhere else.
> Thanks,
> Jay

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20171211/30e6182b/attachment.html>

More information about the 2d-dev mailing list