Bug 515094: [cocoa][hidpi] Image(Device, Image, int) constructor doesn't
retain drawings on top of *provider image

Added check to fix AIOBE.

Change-Id: I0303a4850603f0027430a07808466202496ca861
Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
index 0290622..d0ccede 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
@@ -968,7 +968,7 @@
 			long /*int*/ width = imageRep.pixelsWide();
 			int offset = 0, alphaOffset = (format & OS.NSAlphaFirstBitmapFormat) != 0 ? 0 : 3;
 			for (int y = 0; y<height; y++) {
-				for (int x = 0; x<width; x++) {
+				for (int x = 0; x<width && alphaOffset<info.alphaData.length && offset<srcData.length; x++) {
 					srcData[offset] = info.alphaData[alphaOffset];
 					offset += 4;
 					alphaOffset += 1;