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