src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java

Print this page




 424     private static final Rectangle totalDisplayBounds = new Rectangle();
 425 
 426     private static void updateTotalDisplayBounds() {
 427         synchronized (totalDisplayBounds) {
 428             Rectangle virtualBounds = new Rectangle();
 429             for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
 430                 for (GraphicsConfiguration gc : gd.getConfigurations()) {
 431                     virtualBounds = virtualBounds.union(gc.getBounds());
 432                 }
 433             }
 434             totalDisplayBounds.setBounds(virtualBounds);
 435         }
 436     }
 437 
 438     // 7160609: GL still fails to create a square texture of this size,
 439     //          so we use this value to cap the total display bounds.
 440     native private static int getMaxTextureSize();
 441 
 442     @Override
 443     public int getMaxTextureWidth() {


 444         int width;
 445 
 446         synchronized (totalDisplayBounds) {
 447             if (totalDisplayBounds.width == 0) {
 448                 updateTotalDisplayBounds();
 449             }
 450             width = totalDisplayBounds.width;
 451         }
 452 
 453         return Math.min(width, getMaxTextureSize());


 454     }
 455 
 456     @Override
 457     public int getMaxTextureHeight() {


 458         int height;
 459 
 460         synchronized (totalDisplayBounds) {
 461             if (totalDisplayBounds.height == 0) {
 462                 updateTotalDisplayBounds();
 463             }
 464             height = totalDisplayBounds.height;
 465         }
 466 
 467         return Math.min(height, getMaxTextureSize());


 468     }
 469 }


 424     private static final Rectangle totalDisplayBounds = new Rectangle();
 425 
 426     private static void updateTotalDisplayBounds() {
 427         synchronized (totalDisplayBounds) {
 428             Rectangle virtualBounds = new Rectangle();
 429             for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
 430                 for (GraphicsConfiguration gc : gd.getConfigurations()) {
 431                     virtualBounds = virtualBounds.union(gc.getBounds());
 432                 }
 433             }
 434             totalDisplayBounds.setBounds(virtualBounds);
 435         }
 436     }
 437 
 438     // 7160609: GL still fails to create a square texture of this size,
 439     //          so we use this value to cap the total display bounds.
 440     native private static int getMaxTextureSize();
 441 
 442     @Override
 443     public int getMaxTextureWidth() {
 444         //Temporary disable this logic and use some magic constrain.
 445         /*
 446          int width;
 447 
 448          synchronized (totalDisplayBounds) {
 449          if (totalDisplayBounds.width == 0) {
 450          updateTotalDisplayBounds();
 451          }
 452          width = totalDisplayBounds.width;
 453          }
 454 
 455          return Math.min(width, getMaxTextureSize());
 456          */
 457         return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
 458     }
 459 
 460     @Override
 461     public int getMaxTextureHeight() {
 462         //Temporary disable this logic and use some magic constrain.
 463         /*
 464          int height;
 465 
 466          synchronized (totalDisplayBounds) {
 467          if (totalDisplayBounds.height == 0) {
 468          updateTotalDisplayBounds();
 469          }
 470          height = totalDisplayBounds.height;
 471          }
 472 
 473          return Math.min(height, getMaxTextureSize());
 474          */
 475         return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
 476     }
 477 }