src/share/classes/sun/awt/image/VolatileSurfaceManager.java

Print this page




 316     }
 317 
 318     /**
 319      * Called from SunGraphicsEnv when there has been a display mode change.
 320      * Note that we simply invalidate hardware surfaces here; we do not
 321      * attempt to recreate or re-render them.  This is to avoid threading
 322      * conflicts with the native toolkit and associated threads.  Instead,
 323      * we just nullify the old surface data object and wait for a future
 324      * method in the rendering process to recreate the surface.
 325      */
 326     public void displayChanged() {
 327         if (!isAccelerationEnabled()) {
 328             return;
 329         }
 330         lostSurface = true;
 331         if (sdAccel != null) {
 332             // First, nullify the software surface.  This guards against
 333             // using a SurfaceData that was created in a different
 334             // display mode.
 335             sdBackup = null;
 336             sdCurrent = getBackupSurface();
 337             // Now, invalidate the old hardware-based SurfaceData

 338             SurfaceData oldData = sdAccel;
 339             sdAccel = null;
 340             oldData.invalidate();

 341         }
 342         // Update graphicsConfig for the vImg in case it changed due to
 343         // this display change event
 344         vImg.updateGraphicsConfig();
 345     }
 346 
 347     /**
 348      * When device palette changes, need to force a new copy
 349      * of the image into our hardware cache to update the
 350      * color indices of the pixels (indexed mode only).
 351      */
 352     public void paletteChanged() {
 353         lostSurface = true;
 354     }
 355 
 356     /**
 357      * Called by validate() to see whether the GC passed in is ok for
 358      * rendering to.  This generic implementation checks to see
 359      * whether the GC is either null or is from the same
 360      * device as the one that this image was created on.  Platform-




 316     }
 317 
 318     /**
 319      * Called from SunGraphicsEnv when there has been a display mode change.
 320      * Note that we simply invalidate hardware surfaces here; we do not
 321      * attempt to recreate or re-render them.  This is to avoid threading
 322      * conflicts with the native toolkit and associated threads.  Instead,
 323      * we just nullify the old surface data object and wait for a future
 324      * method in the rendering process to recreate the surface.
 325      */
 326     public void displayChanged() {
 327         if (!isAccelerationEnabled()) {
 328             return;
 329         }
 330         lostSurface = true;
 331         if (sdAccel != null) {
 332             // First, nullify the software surface.  This guards against
 333             // using a SurfaceData that was created in a different
 334             // display mode.
 335             sdBackup = null;

 336             // Now, invalidate the old hardware-based SurfaceData
 337             // Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
 338             SurfaceData oldData = sdAccel;
 339             sdAccel = null;
 340             oldData.invalidate();
 341             sdCurrent = getBackupSurface();
 342         }
 343         // Update graphicsConfig for the vImg in case it changed due to
 344         // this display change event
 345         vImg.updateGraphicsConfig();
 346     }
 347 
 348     /**
 349      * When device palette changes, need to force a new copy
 350      * of the image into our hardware cache to update the
 351      * color indices of the pixels (indexed mode only).
 352      */
 353     public void paletteChanged() {
 354         lostSurface = true;
 355     }
 356 
 357     /**
 358      * Called by validate() to see whether the GC passed in is ok for
 359      * rendering to.  This generic implementation checks to see
 360      * whether the GC is either null or is from the same
 361      * device as the one that this image was created on.  Platform-