graphics.draw(Shape) doesn't always display the line in Java 10

17 views
Skip to first unread message

Paul Austin

unread,
Aug 8, 2018, 4:16:31 PM8/8/18
to marlin-renderer
Using Java 10 with the Marlin Renderer that is packages with 10.0.2:

The graphics.draw(Shape) method doesn't always display the line for a polygon. Where as graphics.fill(Shape) will fill it correctly.

Not sure if it's related to the following.

Exactly the same code using the MarlinRenderer in JDK 8 works correctly.

I'll see if I can come up with some sample code that I can share.

Laurent Bourgès

unread,
Aug 9, 2018, 4:16:53 AM8/9/18
to marlin-...@googlegroups.com
Hi Paul,

Thanks for your feedback, I like bug reports as it makes me happy to help & improve the Marlin renderer even more.

In jdk10, marlin 0.8.2 performs path clipping with 2 different algorithms for drawing or filling operations. 
You could test marlin 0.9.2 on jdk8 or 10 (2 different releases) to check if your problem is already fixed.
Or disable clipping via a system property: -Dsun.java2d.renderer.doClip=false

If you could figure out a simple reproducer that would be wonderful (shape + stroke + clip).

PS: I am on holidays so I have no computer for 2 weeks but I answer emails when I have some free time.

Cheers,
Laurent

--
You received this message because you are subscribed to the Google Groups "marlin-renderer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marlin-render...@googlegroups.com.
To post to this group, send email to marlin-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Laurent Bourgès

unread,
Aug 20, 2018, 9:39:42 AM8/20/18
to marlin-...@googlegroups.com
Paul,

Could you give me any further information on your issue ?
(polygon, clip ...) or screenshot ?

Laurent

2018-08-09 10:16 UTC+02:00, Laurent Bourgès <bourges...@gmail.com>:
--
--
Laurent Bourgès

Paul Austin

unread,
Aug 22, 2018, 10:27:54 AM8/22/18
to marlin-renderer
Laurent,

I've finally managed to make a repeatable test case (ClipTest.java) that doesn't use any of my other code.

The test is to fill and draw 4 polygons using antialiasing.

The attached java8.png shows what it should look like. The java10.png is what happens in java10.

Have a look in: sun.java2d.marlin.DMarlinRenderingEngine.strokeTo(DRendererContext, Shape, AffineTransform, double, NormMode, int, int, float, float[], float, DPathConsumer2D)

I think it's some kind of issue where in some cases where the scaleX and scaleY fail the nearZero test and the strokerat is set to not null.

In that case it looks like the edge[Min|Max][X|Y] in sun.java2d.marlin.DRenderer aren't being updated. So the clipping thinks nothing was drawn.

If I disable clipping then it works.

Hope that helps,
Paul
java8.png
java10.png
ClipTest.java

Laurent Bourgès

unread,
Aug 22, 2018, 1:30:34 PM8/22/18
to marlin-...@googlegroups.com
Thank you very much for your test case,
I will look at it during the week end or early next week.

Cheers,
Laurent

--

Laurent Bourgès

unread,
Aug 27, 2018, 4:23:38 PM8/27/18
to marlin-...@googlegroups.com
Paul,

I looked at your test code and fixed one trivial bug in the code adusting the clip area with a negative scale factor.

I will take time to review how the clip area is adusted with complex transforms (scale + shear) in the stroker as it looks possibly affected too (2 steps) and make more tests.

Thanks again,
Laurent

Le mer. 22 août 2018 à 16:27, Paul Austin <paul.d...@gmail.com> a écrit :
--

Laurent Bourgès

unread,
Aug 31, 2018, 4:48:24 PM8/31/18
to marlin-...@googlegroups.com
Paul,

I fixed the computation of the transformed clipping rectangle in Marlin (all branches) and published the Marlin 0.9.3 EA release:

Could you test your application on JDK10 using this module-patch to confirm your problems are fixed ?

java --patch-module java.desktop=<path>/marlin-0.9.3-Unsafe-OpenJDK9.jar ...

Enjoy Marlin,
Cheers,
Laurent

--
--
Laurent Bourgès

Paul Austin

unread,
Aug 31, 2018, 6:24:23 PM8/31/18
to marlin-renderer
Laurent,

I have verified both in the test case and my application that the patched renderer seems to work correctly. In my application (A map viewer) I zoomed in and out and panned around at many zoom levels and it works in all cases for my app.

I'm curious would this make it into the Java 11 release? I'm still on Java 8 and am hoping to upgrade this fall.

Thanks,
Paul

Laurent Bourgès

unread,
Sep 1, 2018, 3:29:55 AM9/1/18
to marlin-...@googlegroups.com
Paul,


I have verified both in the test case and my application that the patched renderer seems to work correctly. In my application (A map viewer) I zoomed in and out and panned around at many zoom levels and it works in all cases for my app.

Good. 
I must write new 2 test cases proving the fix is KO/OK.


I'm curious would this make it into the Java 11 release? I'm still on Java 8 and am hoping to upgrade this fall.

It is too late for jdk11, only P1 bugs. 
I will propose patches for jdk12 (upstream) then ask for backport to jdk11u and I will also propose patches for jfx11/12...

This process is quite long but this fix will be released in the future, but I do not know the date ~ sept + 2/3 months.

Cheers,
Laurent
Reply all
Reply to author
Forward
0 new messages