Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144718

Pisces / Marlin Strokers may generate invalid curves with huge coordinates and round joins

    Details

    • Subcomponent:
      2d
    • Introduced In Version:
      6
    • Resolved In Build:
      b105

      Backports

        Description

        In both Pisces & Marlin, the Stroker may generate invalid round joins with huge coordinates that may cause rendering artefacts.

        See http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/2015-December/000421.html

        The problem is in the Stroker.drawBezApproxForArc()
        method (from Pisces):
        cv = NaN because sqrt(0.5 - cosext2) = NaN if cosext2 > 0.5 !

        It happens when floating-point rounding errors lead to cosext2 > 0.5 !

        After discussion with Jim Graham, the proper fix is very simple:

                // check cos(ext) <= 1 to avoid cv = NaN:
                if (cosext2 > 0.5f) {
                    // just return to avoid generating a flat curve:
                    return;
                }

        This impacts all renderers derived from OpenJDK Pisces (since java 1.6 ?) ie Marlin but maybe also OpenPisces.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lbourges Laurent Bourgès
                  Reporter:
                  lbourges Laurent Bourgès
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: