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

Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 19
    • client-libs
    • None
    • 2d
    • behavioral
    • low
    • Hide
      Since the specification permits tight bounds this change is allowed but applications which relied upon loose bounds may be surprised with rendering layout and sizing issues the probable consequences of such application bugs.
      Show
      Since the specification permits tight bounds this change is allowed but applications which relied upon loose bounds may be surprised with rendering layout and sizing issues the probable consequences of such application bugs.
    • Java API

      Summary

      The getBounds2D() method in java.awt.geom.Path2D, java.awt.geom.CubicCurve2D and java.awt.geom.QuadCurve2D now return a more concise bounding box.

      Problem

      Without this change the getBounds2D() methods may return a bounding box based on the bezier control points of curves. Sometimes it would return a bounding box that has too much space between the visual bounds of the shape and the bounding box.

      Solution

      Update the implementation to be more precise in the returned bounding box. The caveat is that applications which used the imprecise bounds to (for example) size a UI may be adversely impacted. However that would definitely be an application bug.

      Specification

      There is no change to the Java SE specification for the affected methods which are

      public Rectangle java.awt.geom.Path2D.getBounds();
      public Rectangle java.awt.geom.CubicCurve2D.getBounds();
      public Rectangle java.awt.geom.QuadCurve2D.getBounds();
      

            prr Philip Race
            webbuggrp Webbug Group
            Alexander Zvegintsev, Alexey Ivanov, Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: