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

Kevin Rushforth kcr at openjdk.java.net
Fri Aug 7 17:19:40 UTC 2020

On Tue, 28 Jul 2020 17:52:50 GMT, Bhawesh Choudhary <bchoudhary 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 RenderSVGResourceMasker changes and added fix for HIDPI mask rendering

While reviewing the most recent fix, I noticed that the call to `setCTM` in `GraphicsContextJava.cpp` was only done in
the `fillRect` case. I then took a closer look at the change in `WCGraphicsPrismContext.java` and I see that the
application of the mask is also only done for `fillRect`. A mask will still not be applied for filled rounded
rectangles, filled paths, and all stroked primitives.

So this is an incomplete fix. I will add a couple additional test cases to the bug report.

modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/GraphicsContextJava.cpp line 235:

> 234:         if (m_state.fillGradient) {
> 235:             setCTM(m_state.transform);
> 236:             setGradient(

Why is this needed here, but not in the other places `setGradient` is called? Won't there be a similar problem with
`strokeRect`, `fillPath`, etc?


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

More information about the openjfx-dev mailing list