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

Useless Math.ceil calls in GLXSurfaceData

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • 11, 17, 20
    • client-libs
    • None
    • 2d
    • 9

      There are 4 confusing calls to Math.ceil with int argument.
      sun.java2d.opengl.GLXSurfaceData.GLXOffScreenSurfaceData#getBounds:

                  r.width = (int) Math.ceil(r.width * scale);
                  r.height = (int) Math.ceil(r.height * scale);

      sun.java2d.opengl.GLXSurfaceData.GLXWindowSurfaceData#getBounds:

                  r.width = (int) Math.ceil(r.width * scale);
                  r.height = (int) Math.ceil(r.height * scale);

      r.width, r.height and scale variables have 'int' type. It means Math.ceil is called with 'int' argument too. Math.ceil is useless when called with integer values - it just returns its argument.
      Seems like scale was supposed to have 'double' type?

            jdv Jayathirth D V
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: