Redundant Math.ceil calls in GLXSurfaceData

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P5
    • tbd
    • Affects Version/s: 9, 24
    • Component/s: 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.

            Assignee:
            Philip Race
            Reporter:
            Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: