diff options
author | Silenio Quarti <silenio> | 2004-04-08 18:47:47 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2004-04-08 18:47:47 +0000 |
commit | c57e6709ba1f97c13687499427427413c1eb3b48 (patch) | |
tree | 888d14424b03f71c66d8b3edf11bdb66ee6a2c38 /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java | |
parent | 08734f1d9217f5c1e4c2264ddc5ef8916987021c (diff) | |
download | eclipse.platform.swt-c57e6709ba1f97c13687499427427413c1eb3b48.tar.gz eclipse.platform.swt-c57e6709ba1f97c13687499427427413c1eb3b48.tar.xz eclipse.platform.swt-c57e6709ba1f97c13687499427427413c1eb3b48.zip |
53632
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java index 82b342e963..fd636e8100 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java @@ -1352,21 +1352,19 @@ void init(Device device, int width, int height) { } this.device = device; type = SWT.BITMAP; - - /* Get the HDC for the device */ int hDC = device.internal_new_GC(null); - - /* Fill the bitmap with the current background color */ handle = OS.CreateCompatibleBitmap(hDC, width, height); - if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); - int memDC = OS.CreateCompatibleDC(hDC); - int hOldBitmap = OS.SelectObject(memDC, handle); - OS.PatBlt(memDC, 0, 0, width, height, OS.PATCOPY); - OS.SelectObject(memDC, hOldBitmap); - OS.DeleteDC(memDC); - - /* Release the HDC for the device */ + if (handle != 0) { + int memDC = OS.CreateCompatibleDC(hDC); + int hOldBitmap = OS.SelectObject(memDC, handle); + OS.PatBlt(memDC, 0, 0, width, height, OS.PATCOPY); + OS.SelectObject(memDC, hOldBitmap); + OS.DeleteDC(memDC); + } device.internal_dispose_GC(hDC, null); + if (handle == 0) { + SWT.error(SWT.ERROR_NO_HANDLES, null, device.getLastError()); + } } /** |