public void validateAsDestination(SunGraphics2D sg2d,Region clip){
  if (!isValid()) {
    throw new InvalidPipeException("bounds changed");
  }
  boolean updateGCClip=false;
  if (clip != validatedClip) {
    renderQueue.setClipRectangles(picture,clip);
    validatedClip=clip;
    updateGCClip=true;
  }
  if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
    if (validatedXorComp != sg2d.getComposite()) {
      validatedXorComp=(XORComposite)sg2d.getComposite();
      renderQueue.setGCMode(xgc,false);
    }
    int pixel=sg2d.pixel;
    if (validatedGCForegroundPixel != pixel) {
      int xorpixelmod=validatedXorComp.getXorPixel();
      renderQueue.setGCForeground(xgc,pixel ^ xorpixelmod);
      validatedGCForegroundPixel=pixel;
    }
    if (updateGCClip) {
      renderQueue.setGCClipRectangles(xgc,clip);
    }
  }
}

public void validateAsDestination ( SunGraphics2D sg2d , Region clip ) { if ( ! isValid ( ) ) { throw new InvalidPipeException ( "bounds changed" ) ; } boolean updateGCClip = false ; if ( clip != validatedClip ) { renderQueue . setClipRectangles ( picture , clip ) ; validatedClip = clip ; updateGCClip = true ; } if ( sg2d != null && sg2d . compositeState == SunGraphics2D . COMP_XOR ) { if ( validatedXorComp != sg2d . getComposite ( ) ) { validatedXorComp = ( XORComposite ) sg2d . getComposite ( ) ; renderQueue . setGCMode ( xgc , false ) ; } int pixel = sg2d . pixel ; if ( validatedGCForegroundPixel != pixel ) { int xorpixelmod = validatedXorComp . getXorPixel ( ) ; renderQueue . setGCForeground ( xgc , pixel ^ xorpixelmod ) ; validatedGCForegroundPixel = pixel ; } if ( updateGCClip ) { renderQueue . setGCClipRectangles ( xgc , clip ) ; } } }
validates the surface when used as destination .
