On Thu, 7 May 2020 09:19:28 GMT, Bhawesh Choudhary 
<[email protected]> 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.

I verified that this does fix the bug, although there is a resource issue you 
will need to address. When I run a simple
test (the one attached to the bug report) I get the following warning messages:

Outstanding resource locks detected:
D3D Vram Pool: 21,073,412 used (3.9%), 67,108,864 target (12.5%), 536,870,912 
max
13 total resources being managed
average resource age is 0.6 frames
0 resources at maximum supported age (0.0%)
5 resources marked permanent (38.5%)
3 resources have had mismatched locks (23.1%)
3 resources locked (23.1%)
8 resources contain interesting data (61.5%)
0 resources disappeared (0.0%)

You need to `unlock()` and `dispose()` the temporary RTTs when you are done 
with them. You should also `dispose()` the
temporary Texture.

I left a couple inline comments as well, the main question being about whether 
we really need a second RTT for the mask
texture.

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

> 548:                             Texture.WrapMode.CLAMP_NOT_NEEDED);
> 549:                     RTTexture maskRtTexture = 
> g.getResourceFactory().createRTTexture(nativeMaskImage.getWidth(),
> 550:                             nativeMaskImage.getHeight(), 
> Texture.WrapMode.CLAMP_NOT_NEEDED);

Why do you need to create a second RTT here? I would have thought you could use 
the mask texture directly (you may need
to scale the image in order to do that).

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

> 565:                             filterContext = 
> PrFilterContext.getInstance(screen);
> 566:                         }
> 567:                         PrDrawable imagePrDrawable = 
> PrDrawable.create(filterContext, paintRtTexture);

Did you test both the SW pipeline and printing paths?

-------------

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

Reply via email to