[Rev 04] RFR: 8218973: SVG with masking is not rendering image with mask effect

Kevin Rushforth kcr at openjdk.java.net
Thu Jun 11 20:49:21 UTC 2020

On Tue, 19 May 2020 10:13:44 GMT, Bhawesh Choudhary <github.com+4208131+bhaweshkc at openjdk.org> wrote:

>> Root cause of issue is Specifying a image mask from GraphicsContextJava.cpp in WebKit was not implemented, so masking
>> doesn't take place at all while rendering SVGRect. to fix this issue add implementation of function clipToImageBuffer()
>> in GraphicsContextJava.cpp and send clip image to WCGraphicsPrismContext.java  While rendering in
>> WCGraphicsPrismContext.java if image clip mask is available, use it for rendering using MaskTextureGraphics interface
>> otherwise use usual way of rendering.
> Bhawesh Choudhary has updated the pull request incrementally with one additional commit since the last revision:
>   Removed unnecessery Ceil Functions

The code looks good (with a couple minor formatting issues).

All of the onscreen testing I did  looks good on Windows. I'd like to test it on Mac as well.

There is an issue with printing in the case of Hi-DPI scaling, which is what I run by default on Windows. The gradient
texture appears to be scaled incorrectly (as if the scale was applied more than once). If I force scaling to 1 with
`-Dglass.win.uiScale=1` then it prints correctly.

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java line 531:

> 530:                     render(g, shadow, paint, null, node);
> 531:                 } else if(state.getClipMaskImageNoClone() != null) {
> 532:                     Rectangle rect = new Rectangle((int) x, (int) y, (int) w, (int) h);

space after `if`

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java line 553:

> 552:                     maskTexture.dispose();
> 553:                     if(g instanceof MaskTextureGraphics && !(g instanceof PrinterGraphics)) {
> 554:                         MaskTextureGraphics mg = (MaskTextureGraphics) (g);

space after `if`


PR: https://git.openjdk.java.net/jfx/pull/213

More information about the openjfx-dev mailing list