} else if (data.window != 0 || data.control != 0) {
} else if (data.control != 0) {
public void copyArea(Image image, int x, int y) {	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);	if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);	if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);	if (data.image != null) {		copyArea(image, x, y, data.image.handle);	} else if (data.window != 0 || data.control != 0) {		int imageHandle = image.handle;		if (data.control != 0) {			Rect rect = new Rect ();			int window = OS.GetControlOwner (data.control);			if (OS.HIVIEW) {				CGPoint pt = new CGPoint ();				OS.HIViewConvertPoint (pt, data.control, 0);				x += (int) pt.x;				y += (int) pt.y;				OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);			} else {				OS.GetControlBounds (data.control, rect);				x += rect.left;				y += rect.top;				OS.GetWindowBounds (window, (short) OS.kWindowContentRgn, rect);			}			x += rect.left;			y += rect.top;			rect = data.insetRect;			x -= rect.left;			y -= rect.top;		}		CGRect rect = new CGRect();		rect.x = x;		rect.y = y;		rect.width = OS.CGImageGetWidth(imageHandle);		rect.height = OS.CGImageGetHeight(imageHandle);		int[] displays = new int[16];		int[] count = new int[1];		if (OS.CGGetDisplaysWithRect(rect, displays.length, displays, count) != 0) return;		for (int i = 0; i < count[0]; i++) {			int display = displays[i];			int address = OS.CGDisplayBaseAddress(display);			if (address != 0) {				int width = OS.CGDisplayPixelsWide(display);				int height = OS.CGDisplayPixelsHigh(display);				int bpr = OS.CGDisplayBytesPerRow(display);				int bpp = OS.CGDisplayBitsPerPixel(display);				int bps = OS.CGDisplayBitsPerSample(display);				int bitmapInfo = OS.kCGImageAlphaNoneSkipFirst;				switch (bpp) {					case 16: bitmapInfo |= OS.kCGBitmapByteOrder16Host; break;					case 32: bitmapInfo |= OS.kCGBitmapByteOrder32Host; break;				}				int srcImage = 0;				if (OS.__BIG_ENDIAN__() && OS.VERSION >= 0x1040) {					int context = OS.CGBitmapContextCreate(address, width, height, bps, bpr, data.device.colorspace, bitmapInfo);					srcImage = OS.CGBitmapContextCreateImage(context);					OS.CGContextRelease(context);				} else {					int provider = OS.CGDataProviderCreateWithData(0, address, bpr * height, 0);					srcImage = OS.CGImageCreate(width, height, bps, bpp, bpr, data.device.colorspace, bitmapInfo, provider, null, true, 0);					OS.CGDataProviderRelease(provider);				}				copyArea(image, x, y, srcImage);				if (srcImage != 0) OS.CGImageRelease(srcImage);			}		}	}	}