boolean done = false;
boolean somebits = false;
Surface srcSurf = null;
if(image instanceof OffscreenImage){
OffscreenImage oi = (OffscreenImage) image;
if((oi.getState() & ImageObserver.ERROR) != 0) {
return false;
}
done = oi.prepareImage(imageObserver);
somebits = (oi.getState() & ImageObserver.SOMEBITS) != 0;
srcSurf = oi.getImageSurface();
}else{
done = true;
srcSurf = Surface.getImageSurface(image);
}