static void handleVItoScreenOp(SurfaceData src,SurfaceData dst){
  if (src instanceof D3DSurfaceData && dst instanceof GDIWindowSurfaceData) {
    D3DSurfaceData d3dsd=(D3DSurfaceData)src;
    SurfaceManager mgr=SurfaceManager.getManager((Image)d3dsd.getDestination());
    if (mgr instanceof D3DVolatileSurfaceManager) {
      D3DVolatileSurfaceManager vsm=(D3DVolatileSurfaceManager)mgr;
      if (vsm != null) {
        d3dsd.setSurfaceLost(true);
        GDIWindowSurfaceData wsd=(GDIWindowSurfaceData)dst;
        WComponentPeer p=wsd.getPeer();
        if (D3DScreenUpdateManager.canUseD3DOnScreen(p,(Win32GraphicsConfig)p.getGraphicsConfiguration(),p.getBackBuffersNum())) {
          vsm.setRestoreCountdown(10);
        }
 else {
          vsm.setAccelerationEnabled(false);
        }
      }
    }
  }
}

static void handleVItoScreenOp ( SurfaceData src , SurfaceData dst ) { if ( src instanceof D3DSurfaceData && dst instanceof GDIWindowSurfaceData ) { D3DSurfaceData d3dsd = ( D3DSurfaceData ) src ; SurfaceManager mgr = SurfaceManager . getManager ( ( Image ) d3dsd . getDestination ( ) ) ; if ( mgr instanceof D3DVolatileSurfaceManager ) { D3DVolatileSurfaceManager vsm = ( D3DVolatileSurfaceManager ) mgr ; if ( vsm != null ) { d3dsd . setSurfaceLost ( true ) ; GDIWindowSurfaceData wsd = ( GDIWindowSurfaceData ) dst ; WComponentPeer p = wsd . getPeer ( ) ; if ( D3DScreenUpdateManager . canUseD3DOnScreen ( p , ( Win32GraphicsConfig ) p . getGraphicsConfiguration ( ) , p . getBackBuffersNum ( ) ) ) { vsm . setRestoreCountdown ( 10 ) ; } else { vsm . setAccelerationEnabled ( false ) ; } } } } }
if the destination surface ' s peer can potentially handle accelerated on - screen rendering then it is likely that the condition which resulted in vi to screen operation is temporary , so this method sets the restore countdown in hope that the on - screen accelerated rendering will resume . in the meantime the backup surface of the vism will be used . the countdown is needed because otherwise we may never break out of " do { vi . validate ( ) . . } while ( vi . lost ) " loop since validate ( ) could restore the source surface every time and it will get lost again on the next copy attempt , and we would never get a chance to use the backup surface . by using the countdown we allow the backup surface to be used while the screen surface gets sorted out , or if it for some reason can never be restored . if the destination surface ' s peer could never do accelerated onscreen rendering then the acceleration for the surfacemanager associated with the source surface is disabled forever .
