RFR: 8242861: Update ImagePattern to apply SVG pattern transforms [v6]

Kevin Rushforth kcr at openjdk.java.net
Fri Oct 9 22:19:13 UTC 2020


On Mon, 24 Aug 2020 07:48:27 GMT, Arun Joseph <ajoseph at openjdk.org> wrote:

>> fillPath() and fillRect() functions in
>> [GraphicsContextJava.cpp](https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/WebCore/platform/graphics/java/GraphicsContextJava.cpp)
>> use Image::drawPattern() for applying patterns as fill. But drawPattern() doesn't use patternTransform argument as
>> ImagePattern doesn't have the same attribute. So, the final image won't be transformed.
>
> Arun Joseph has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Update copyright year
>  - Minor refactoring

This looks good to me with one suggestion and one request for a clarifying comment.

modules/javafx.graphics/src/main/java/com/sun/prism/j2d/J2DPrismGraphics.java line 742:

> 740:                 }
> 741:
> 742:                 g2d.fill(tmpAT.createTransformedShape(shape));

Maybe move the `fill` call inside the try/catch so it won't draw anything if the transform is non-invertible? That
matches what `drawMappedTextureRaw` does.

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

> 788:                     Affine3D at = new Affine3D();
> 789:                     at.translate(phase.getX(), phase.getY());
> 790:                     at.concatenate(m[0], -m[1], m[4], -m[2], m[3], m[5]);

Can you explain why the matrix is transformed in this way (specifically the negation of elements 1 and 2)? A code
comment would be helpful since it is non-obvious.

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

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


More information about the openjfx-dev mailing list