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

Redundant Math.ceil calls in GLXSurfaceData

XMLWordPrintable

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

      There is a couple methods in 'sun.java2d.opengl.GLXSurfaceData' which call 'Math.ceil' with 'int' argument. Calling Math.ceil with integer argument is useless - it will just return the same passed value.

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

              public Rectangle getBounds() {
                  if (type == FLIP_BACKBUFFER) {
                      Rectangle r = peer.getBounds();
                      r.x = r.y = 0;
                      r.width = (int) Math.ceil(r.width * scale);
                      r.height = (int) Math.ceil(r.height * scale);
                      return r;
                  } else {
                      return new Rectangle(width, height);
                  }
              }

      sun.java2d.opengl.GLXSurfaceData.GLXWindowSurfaceData#getBounds

              public Rectangle getBounds() {
                  Rectangle r = peer.getBounds();
                  r.x = r.y = 0;
                  r.width = (int) Math.ceil(r.width * scale);
                  r.height = (int) Math.ceil(r.height * scale);
                  return r;
              }

      All 4 calls are useless. Seems we should remove it.

            prr Philip Race
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: