diff options
author | Grant Gayed <ggayed> | 2009-02-18 15:14:32 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2009-02-18 15:14:32 +0000 |
commit | 420ecc6978c2595bdf9b71ed40b757930d738678 (patch) | |
tree | 8950a003154af592ef0cba3a9e16254061c28bdf /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java | |
parent | 0c265790d48c978702367475ec1c694c7aa98881 (diff) | |
download | eclipse.platform.swt-420ecc6978c2595bdf9b71ed40b757930d738678.tar.gz eclipse.platform.swt-420ecc6978c2595bdf9b71ed40b757930d738678.tar.xz eclipse.platform.swt-420ecc6978c2595bdf9b71ed40b757930d738678.zip |
264714 - drawing to Image can fail
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java index ff127de99e..12929a35c0 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java @@ -481,6 +481,21 @@ public void setImage (Image image) { } this.image = image; isImage = true; + + /* + * Feature in Cocoa. If the NSImage object being set into the view is + * the same NSImage object that is already there then the new image is + * not taken. This results in the view's image not changing even if the + * NSImage object's content has changed since it was last set into the + * view. The workaround is to temporarily set the view's image to null + * so that the new image will then be taken. + */ + if (image != null) { + NSImage current = imageView.image (); + if (current != null && current.id == image.handle.id) { + imageView.setImage (null); + } + } imageView.setImage(image != null ? image.handle : null); ((NSBox)view).setContentView(imageView); } |