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

Snapping of values used in layout can be precomputed

    XMLWordPrintable

    Details

      Description

      From Richard's mail:


      Recomputing the same values between layout runs

              final double snaphgap = snapSpace(getHgap());
              final double snapvgap = snapSpace(getVgap());
              final double top = snapSpace(getInsets().getTop());
              final double bottom = snapSpace(getInsets().getBottom());
              final double left = snapSpace(getInsets().getLeft());
              final double right = snapSpace(getInsets().getRight());

      These for example, almost never change. The hgap and vgap rarely change, they're usually only set once. The Insets also are very rarely ever changed. Yet ever time we layoutChildren (and probably in other places throughout the class), we recompute the snapspace value for these. So we have the getter (or two), the snapSpace method call, which then calls snapSpace(d, isSnapToPixel()) which then calls Math.round. So there are a lot of method calls here.

      It seems like, for these properties, we could have a call field defined that contains the snapSpace equivalent, so that we don't have to do these calls over and over again.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              msladecek Martin Sládeček
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Imported: