diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-13 12:49:56 -0400 |
---|---|---|
committer | Arun Thondapu <arunkumar.thondapu@in.ibm.com> | 2012-08-14 14:45:36 +0530 |
commit | 73b8760cc71f23fc1adf4097ba30ab56c13451ed (patch) | |
tree | e33f8414ecff2894d424832622f04bf1db92da35 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java | |
parent | 31720edb505f97bebd7f644d62b276e4d39389cb (diff) | |
download | eclipse.platform.swt-73b8760cc71f23fc1adf4097ba30ab56c13451ed.tar.gz eclipse.platform.swt-73b8760cc71f23fc1adf4097ba30ab56c13451ed.tar.xz eclipse.platform.swt-73b8760cc71f23fc1adf4097ba30ab56c13451ed.zip |
Omit use of gdk_drawable_get_size for newer GTK+ and make it dynamic
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java index 9f7fda7368..ddc093187a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java @@ -363,7 +363,11 @@ public Image(Device device, Image srcImage, int flag) { /* Get source image size */ int[] w = new int[1], h = new int[1]; - OS.gdk_drawable_get_size(srcImage.pixmap, w, h); + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + OS.gdk_pixmap_get_size(pixmap, w, h); + } else { + OS.gdk_drawable_get_size(srcImage.pixmap, w, h); + } int width = w[0]; int height = h[0]; @@ -869,7 +873,11 @@ void createSurface() { /* Generate the mask if necessary. */ if (transparentPixel != -1) createMask(); int[] w = new int[1], h = new int[1]; - OS.gdk_drawable_get_size(pixmap, w, h); + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + OS.gdk_pixmap_get_size(pixmap, w, h); + } else { + OS.gdk_drawable_get_size(pixmap, w, h); + } int width = w[0], height = h[0]; if (mask != 0 || alpha != -1 || alphaData != null) { int /*long*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, true, 8, width, height); @@ -1069,7 +1077,11 @@ public Rectangle getBounds() { return new Rectangle(0, 0, width, height); } int[] w = new int[1]; int[] h = new int[1]; - OS.gdk_drawable_get_size(pixmap, w, h); + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + OS.gdk_pixmap_get_size(pixmap, w, h); + } else { + OS.gdk_drawable_get_size(pixmap, w, h); + } return new Rectangle(0, 0, width = w[0], height = h[0]); } @@ -1142,7 +1154,11 @@ public ImageData getImageData() { return data; } int[] w = new int[1], h = new int[1]; - OS.gdk_drawable_get_size(pixmap, w, h); + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + OS.gdk_pixmap_get_size(pixmap, w, h); + } else { + OS.gdk_drawable_get_size(pixmap, w, h); + } int width = w[0], height = h[0]; int /*long*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES); |