From 2b1f2830b8d411e84c9809819724a5df17bd0813 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Fri, 19 Oct 2012 10:31:34 -0400 Subject: Not use gdk_colormap_alloc_color and gdk_colormap_free_color in GTK+3 This patch version guards calls to GdkColormap methods as they are not used in GTK+3, the only exception where GdkColormap is still used is Tracker.drawRectangles, as suitable Cairo implementation is not yet implemented for this method. --- .../Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java') diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index b065cb0b5d..04d595bbee 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -1065,8 +1065,7 @@ void drawImageAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHei } long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, true, 8, srcWidth, srcHeight); if (pixbuf == 0) return; - long /*int*/ colormap = OS.gdk_colormap_get_system(); - gdk_pixbuf_get_from_window (pixbuf, srcImage.pixmap, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight); + gdk_pixbuf_get_from_window (pixbuf, srcImage.pixmap, srcX, srcY, 0, 0, srcWidth, srcHeight); int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] line = new byte[stride]; @@ -1102,11 +1101,10 @@ void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeig if (srcWidth != destWidth || srcHeight != destHeight) { long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, true, 8, srcWidth, srcHeight); if (pixbuf != 0) { - long /*int*/ colormap = OS.gdk_colormap_get_system(); - gdk_pixbuf_get_from_window (pixbuf, colorPixmap, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight); + gdk_pixbuf_get_from_window (pixbuf, colorPixmap, srcX, srcY, 0, 0, srcWidth, srcHeight); long /*int*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, srcWidth, srcHeight); if (maskPixbuf != 0) { - gdk_pixbuf_get_from_window (maskPixbuf, maskPixmap, 0, srcX, srcY, 0, 0, srcWidth, srcHeight); + gdk_pixbuf_get_from_window (maskPixbuf, maskPixmap, srcX, srcY, 0, 0, srcWidth, srcHeight); int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] line = new byte[stride]; @@ -1257,8 +1255,7 @@ void drawImageXRender(Image srcImage, int srcX, int srcY, int srcWidth, int srcH long /*int*/ scale(long /*int*/ src, int srcX, int srcY, int srcWidth, int srcHeight, int destWidth, int destHeight) { long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, srcWidth, srcHeight); if (pixbuf == 0) return 0; - long /*int*/ colormap = OS.gdk_colormap_get_system(); - gdk_pixbuf_get_from_window (pixbuf, src, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight); + gdk_pixbuf_get_from_window (pixbuf, src, srcX, srcY, 0, 0, srcWidth, srcHeight); long /*int*/ scaledPixbuf = OS.gdk_pixbuf_scale_simple(pixbuf, destWidth, destHeight, OS.GDK_INTERP_BILINEAR); OS.g_object_unref(pixbuf); return scaledPixbuf; @@ -4374,10 +4371,11 @@ void cairo_region_get_rectangles (long /*int*/ region, long /*int*/[] rectangles } } -long /*int*/ gdk_pixbuf_get_from_window(long /*int*/ dest, long /*int*/ src, long /*int*/ cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { +long /*int*/ gdk_pixbuf_get_from_window(long /*int*/ dest, long /*int*/ src, int src_x, int src_y, int dest_x, int dest_y, int width, int height) { if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { return OS.gdk_pixbuf_get_from_window (dest, src_x, src_y, width, height); } else { + long /*int*/ cmap = OS.gdk_colormap_get_system(); return OS.gdk_pixbuf_get_from_drawable (dest, src, cmap, src_x, src_y, dest_x, dest_y, width, height); } } -- cgit