diff options
author | Billy Biggs <bbiggs> | 2005-02-23 16:35:52 +0000 |
---|---|---|
committer | Billy Biggs <bbiggs> | 2005-02-23 16:35:52 +0000 |
commit | b2ef8a6279b37707cb201f32394e995cfb449f54 (patch) | |
tree | 49a5323e91edae6e4a6a1a28006ede3f6df3ecdd | |
parent | d99686d4a205a545dbfb69d5d0b60d14960d18b0 (diff) | |
download | eclipse.platform.swt-b2ef8a6279b37707cb201f32394e995cfb449f54.tar.gz eclipse.platform.swt-b2ef8a6279b37707cb201f32394e995cfb449f54.tar.xz eclipse.platform.swt-b2ef8a6279b37707cb201f32394e995cfb449f54.zip |
86145
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java index 4610944cba..777d1bb10a 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java @@ -250,10 +250,16 @@ public Image(Device device, Image srcImage, int flag) { OS.memmove(srcData, srcXImage.data, srcData.length); /* Create destination image */ int destPixmap = OS.XCreatePixmap(xDisplay, drawable, width, height, srcXImage.depth); + int visualPtr = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay)); + int screenDepth = OS.XDefaultDepthOfScreen(OS.XDefaultScreenOfDisplay(xDisplay)); + int destXImagePtr = OS.XCreateImage(xDisplay, visualPtr, screenDepth, OS.ZPixmap, 0, 0, width, height, srcXImage.bitmap_pad, 0); XImage destXImage = new XImage(); - int destXImagePtr = OS.XGetImage(xDisplay, drawable, 0, 0, width, height, OS.AllPlanes, OS.ZPixmap); OS.memmove(destXImage, destXImagePtr, XImage.sizeof); - byte[] destData = new byte[destXImage.bytes_per_line * destXImage.height]; + int bufSize = destXImage.bytes_per_line * destXImage.height; + int bufPtr = OS.XtMalloc(bufSize); + destXImage.data = bufPtr; + OS.memmove(destXImagePtr, destXImage, XImage.sizeof); + byte[] destData = new byte[bufSize]; /* Find the colors to map to */ Color zeroColor = device.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); Color oneColor = device.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); @@ -311,8 +317,6 @@ public Image(Device device, Image srcImage, int flag) { index = 0; /* Get masks */ Visual visual = new Visual(); - int screenNum = OS.XDefaultScreen(xDisplay); - int visualPtr = OS.XDefaultVisual(xDisplay, screenNum); OS.memmove(visual, visualPtr, Visual.sizeof); int redMask = visual.red_mask; int greenMask = visual.green_mask; @@ -356,8 +360,6 @@ public Image(Device device, Image srcImage, int flag) { index = 0; /* Get masks */ visual = new Visual(); - screenNum = OS.XDefaultScreen(xDisplay); - visualPtr = OS.XDefaultVisual(xDisplay, screenNum); OS.memmove(visual, visualPtr, Visual.sizeof); redMask = visual.red_mask; greenMask = visual.green_mask; |