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

Bhawesh Choudhary bchoudhary at openjdk.java.net
Tue Jul 21 22:05:36 UTC 2020


On Fri, 12 Jun 2020 22:01:47 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> 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.
>
> It behaves the same on Mac with a Retina display as it does on Windows with Hi-DPI scaling. The gradient doesn't appear
> to be scaled correctly when printing. It's fine with on-screen rendering (with both HW and SW pipeline).

Issue related to hidpi rendering was caused due to correct pixel scale factor not being set to the context in which
mask texture was getting rendered. setting correct device scale factor in `RenderSVGResourceMasker.cpp` fixed the
issue. Below images shows the rendered mask texture in both case (HiDpi and Normal respectively)

![HiDpi_Mask_1](https://user-images.githubusercontent.com/4208131/88110579-125ae300-cbca-11ea-9c02-ceec2ccdf7d1.png)
![Normal_Mask_1](https://user-images.githubusercontent.com/4208131/88110582-138c1000-cbca-11ea-88ce-5e15ccccd124.png)

Another issue was in Hi DPI printing. PrintGraphics draws with different resolution than the mask texture. Before the
fix mask was not drawn correctly to RTTexture, due to which only top left portion which comes inside current draw
bounds was taken to draw the whole image. After fix, entire mask texture is always considered while doing final drawing.

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

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


More information about the openjfx-dev mailing list