aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-17 16:07:08 (EDT)
committerAlexander Kurtakov2012-10-17 17:02:40 (EDT)
commit5673881707cbfd963bc0ed943607494119f5edb9 (patch)
tree3cdf8be9af2813e2bc821fd28d3c70d254c8da3f
parent4f987457057386ef5b3185c0437c20a5571b49d9 (diff)
downloadeclipse.platform.swt-5673881707cbfd963bc0ed943607494119f5edb9.zip
eclipse.platform.swt-5673881707cbfd963bc0ed943607494119f5edb9.tar.gz
eclipse.platform.swt-5673881707cbfd963bc0ed943607494119f5edb9.tar.bz2
Use gdk_pixbuf_get_from_window instead of gdk_pixbuf_get_from_drawable
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java13
8 files changed, 84 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index f040013..c101c02 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -6028,12 +6028,40 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixbuf_1get_1from_1drawable)
{
jintLong rc = 0;
OS_NATIVE_ENTER(env, that, _1gdk_1pixbuf_1get_1from_1drawable_FUNC);
- rc = (jintLong)gdk_pixbuf_get_from_drawable((GdkPixbuf *)arg0, (GdkDrawable *)arg1, (GdkColormap *)arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+/*
+ rc = (jintLong)gdk_pixbuf_get_from_drawable((GdkPixbuf *)arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_pixbuf_get_from_drawable)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkPixbuf *, jintLong, jintLong, jint, jint, jint, jint, jint, jint))fp)((GdkPixbuf *)arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1pixbuf_1get_1from_1drawable_FUNC);
return rc;
}
#endif
+#ifndef NO__1gdk_1pixbuf_1get_1from_1window
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixbuf_1get_1from_1window)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1pixbuf_1get_1from_1window_FUNC);
+/*
+ rc = (jintLong)gdk_pixbuf_get_from_window((GdkWindow *)arg0, (gint)arg1, (gint)arg2, (gint)arg3, (gint)arg4);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_pixbuf_get_from_window)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *, gint, gint, gint, gint))fp)((GdkWindow *)arg0, (gint)arg1, (gint)arg2, (gint)arg3, (gint)arg4);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1pixbuf_1get_1from_1window_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1pixbuf_1get_1has_1alpha
JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1pixbuf_1get_1has_1alpha)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 32943e6..9f72de0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -211,6 +211,8 @@
#define gdk_gc_set_values_LIB LIB_GDK
#define gdk_gc_get_values_LIB LIB_GDK
#define gdk_pixbuf_save_to_bufferv_LIB LIB_GDK
+#define gdk_pixbuf_get_from_drawable_LIB LIB_GDK
+#define gdk_pixbuf_get_from_window_LIB LIB_GDK
#define gdk_pixbuf_render_pixmap_and_mask_LIB LIB_GDK
#define gdk_pointer_grab_LIB LIB_GDK
#define gdk_pointer_ungrab_LIB LIB_GDK
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 0eab77a..05c1483 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -485,6 +485,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1pango_1layout_1get_1clip_1region",
"_1gdk_1pixbuf_1copy_1area",
"_1gdk_1pixbuf_1get_1from_1drawable",
+ "_1gdk_1pixbuf_1get_1from_1window",
"_1gdk_1pixbuf_1get_1has_1alpha",
"_1gdk_1pixbuf_1get_1height",
"_1gdk_1pixbuf_1get_1pixels",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index f2b2cf6..16a103b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -495,6 +495,7 @@ typedef enum {
_1gdk_1pango_1layout_1get_1clip_1region_FUNC,
_1gdk_1pixbuf_1copy_1area_FUNC,
_1gdk_1pixbuf_1get_1from_1drawable_FUNC,
+ _1gdk_1pixbuf_1get_1from_1window_FUNC,
_1gdk_1pixbuf_1get_1has_1alpha_FUNC,
_1gdk_1pixbuf_1get_1height_FUNC,
_1gdk_1pixbuf_1get_1pixels_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index ea27101..f63333b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -4513,9 +4513,8 @@ public static final void gdk_pixbuf_copy_area(long /*int*/ src_pixbuf, int src_x
}
}
/**
+ * @method flags=dynamic
* @param dest cast=(GdkPixbuf *)
- * @param src cast=(GdkDrawable *)
- * @param cmap cast=(GdkColormap *)
*/
public static final native long /*int*/ _gdk_pixbuf_get_from_drawable(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);
public static final long /*int*/ gdk_pixbuf_get_from_drawable(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) {
@@ -4526,6 +4525,23 @@ public static final long /*int*/ gdk_pixbuf_get_from_drawable(long /*int*/ dest,
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param window cast=(GdkWindow *)
+ * @param src_x cast=(gint)
+ * @param src_y cast=(gint)
+ * @param width cast=(gint)
+ * @param height cast=(gint)
+ */
+public static final native long /*int*/ _gdk_pixbuf_get_from_window(long /*int*/ window, int src_x, int src_y, int width, int height);
+public static final long /*int*/ gdk_pixbuf_get_from_window(long /*int*/ window, int src_x, int src_y, int width, int height) {
+ lock.lock();
+ try {
+ return _gdk_pixbuf_get_from_window(window, src_x, src_y, width, height);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param pixbuf cast=(const GdkPixbuf *) */
public static final native boolean _gdk_pixbuf_get_has_alpha(long /*int*/ pixbuf);
public static final boolean gdk_pixbuf_get_has_alpha(long /*int*/ pixbuf) {
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 5de2642..b065cb0 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
@@ -1066,7 +1066,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();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, srcImage.pixmap, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight);
+ gdk_pixbuf_get_from_window (pixbuf, srcImage.pixmap, colormap, 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];
@@ -1103,10 +1103,10 @@ void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeig
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();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, colorPixmap, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight);
+ gdk_pixbuf_get_from_window (pixbuf, colorPixmap, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight);
long /*int*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, srcWidth, srcHeight);
if (maskPixbuf != 0) {
- OS.gdk_pixbuf_get_from_drawable(maskPixbuf, maskPixmap, 0, srcX, srcY, 0, 0, srcWidth, srcHeight);
+ gdk_pixbuf_get_from_window (maskPixbuf, maskPixmap, 0, 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];
@@ -1258,7 +1258,7 @@ long /*int*/ scale(long /*int*/ src, int srcX, int srcY, int srcWidth, int srcHe
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();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, src, colormap, srcX, srcY, 0, 0, srcWidth, srcHeight);
+ gdk_pixbuf_get_from_window (pixbuf, src, colormap, 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;
@@ -4373,4 +4373,12 @@ void cairo_region_get_rectangles (long /*int*/ region, long /*int*/[] rectangles
OS.gdk_region_get_rectangles (region, rectangles, n_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) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return OS.gdk_pixbuf_get_from_window (dest, src_x, src_y, width, height);
+ } else {
+ return OS.gdk_pixbuf_get_from_drawable (dest, src, cmap, src_x, src_y, dest_x, dest_y, width, height);
+ }
+}
}
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 bdb9f1d..676d2e0 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
@@ -411,7 +411,7 @@ public Image(Device device, Image srcImage, int flag) {
long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height);
if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES);
long /*int*/ colormap = OS.gdk_colormap_get_system();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, srcImage.pixmap, colormap, 0, 0, 0, 0, width, height);
+ gdk_pixbuf_get_from_window (pixbuf, srcImage.pixmap, colormap, 0, 0, 0, 0, width, height);
int stride = OS.gdk_pixbuf_get_rowstride(pixbuf);
long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf);
@@ -885,7 +885,7 @@ void createSurface() {
long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, true, 8, width, height);
if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES);
long /*int*/ colormap = OS.gdk_colormap_get_system();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, pixmap, colormap, 0, 0, 0, 0, width, height);
+ gdk_pixbuf_get_from_window (pixbuf, pixmap, colormap, 0, 0, 0, 0, width, height);
int stride = OS.gdk_pixbuf_get_rowstride(pixbuf);
long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf);
byte[] line = new byte[stride];
@@ -898,7 +898,7 @@ void createSurface() {
if (mask != 0 && OS.gdk_drawable_get_depth(mask) == 1) {
long /*int*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height);
if (maskPixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable(maskPixbuf, mask, 0, 0, 0, 0, 0, width, height);
+ gdk_pixbuf_get_from_window (maskPixbuf, mask, 0, 0, 0, 0, 0, width, height);
int maskStride = OS.gdk_pixbuf_get_rowstride(maskPixbuf);
long /*int*/ maskPixels = OS.gdk_pixbuf_get_pixels(maskPixbuf);
byte[] maskLine = new byte[maskStride];
@@ -1165,7 +1165,7 @@ public ImageData getImageData() {
long /*int*/ pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height);
if (pixbuf == 0) SWT.error(SWT.ERROR_NO_HANDLES);
long /*int*/ colormap = OS.gdk_colormap_get_system();
- OS.gdk_pixbuf_get_from_drawable(pixbuf, pixmap, colormap, 0, 0, 0, 0, width, height);
+ gdk_pixbuf_get_from_window (pixbuf, pixmap, colormap, 0, 0, 0, 0, width, height);
int stride = OS.gdk_pixbuf_get_rowstride(pixbuf);
long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf);
byte[] srcData = new byte[stride * height];
@@ -1687,4 +1687,11 @@ public String toString () {
}
}
+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) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return OS.gdk_pixbuf_get_from_window (dest, src_x, src_y, width, height);
+ } else {
+ return OS.gdk_pixbuf_get_from_drawable (dest, src, cmap, src_x, src_y, dest_x, dest_y, width, height);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
index 39d0c33..fea52ad 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java
@@ -112,10 +112,10 @@ public static long /*int*/ createPixbuf(Image image) {
if (hasMask) {
pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, true, 8, w [0], h [0]);
if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
+ gdk_pixbuf_get_from_window (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
long /*int*/ maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, w [0], h [0]);
if (maskPixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable(maskPixbuf, image.mask, 0, 0, 0, 0, 0, w [0], h [0]);
+ gdk_pixbuf_get_from_window (maskPixbuf, image.mask, 0, 0, 0, 0, 0, w [0], h [0]);
int stride = OS.gdk_pixbuf_get_rowstride(pixbuf);
long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf);
byte[] line = new byte[stride];
@@ -140,7 +140,7 @@ public static long /*int*/ createPixbuf(Image image) {
boolean hasAlpha = data.getTransparencyType () == SWT.TRANSPARENCY_ALPHA;
pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w [0], h [0]);
if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
+ gdk_pixbuf_get_from_window (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
if (hasAlpha) {
byte [] alpha = data.alphaData;
int stride = OS.gdk_pixbuf_get_rowstride (pixbuf);
@@ -287,4 +287,11 @@ public int size () {
return result;
}
+static 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) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ return OS.gdk_pixbuf_get_from_window (dest, src_x, src_y, width, height);
+ } else {
+ return OS.gdk_pixbuf_get_from_drawable (dest, src, cmap, src_x, src_y, dest_x, dest_y, width, height);
+ }
+}
}