summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-17 10:07:21 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-17 10:07:21 -0400
commit5e62d15ba85e6c1f31dde0fab38cdc13e6efa8c2 (patch)
tree740734b6d9a7f4efbe507cfdf390e7da34e4e77a
parent98eede2304ef21382ba2912864be9fe9af86265e (diff)
downloadeclipse.platform.swt-gtk3_region_union.tar.gz
eclipse.platform.swt-gtk3_region_union.tar.xz
eclipse.platform.swt-gtk3_region_union.zip
Use cairo_region_union() instead of gdk_region_union() for GTK+ 3gtk3_region_union
This patch substitutes gdk_region_union() with cairo_region_union() for GTK+ 3 and higher.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java13
10 files changed, 76 insertions, 17 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
index 72220cf07f..bd5759966c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
@@ -1179,6 +1179,18 @@ JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1reference)
}
#endif
+#ifndef NO__1cairo_1region_1union
+JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1region_1union)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ Cairo_NATIVE_ENTER(env, that, _1cairo_1region_1union_FUNC);
+ rc = (jintLong)cairo_region_union((cairo_region_t *)arg0, (const cairo_region_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, _1cairo_1region_1union_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1cairo_1rel_1curve_1to
JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1rel_1curve_1to)
(JNIEnv *env, jclass that, jintLong arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jdouble arg6)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
index 67b21fe5c2..6275f7ddff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
@@ -24,8 +24,8 @@
#ifdef NATIVE_STATS
-int Cairo_nativeFunctionCount = 157;
-int Cairo_nativeFunctionCallCount[157];
+int Cairo_nativeFunctionCount = 158;
+int Cairo_nativeFunctionCallCount[158];
char * Cairo_nativeFunctionNames[] = {
"CAIRO_1VERSION_1ENCODE",
"_1cairo_1append_1path",
@@ -117,6 +117,7 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1push_1group",
"_1cairo_1rectangle",
"_1cairo_1reference",
+ "_1cairo_1region_1union",
"_1cairo_1rel_1curve_1to",
"_1cairo_1rel_1line_1to",
"_1cairo_1rel_1move_1to",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
index 62206dc2a8..f085ad77a1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
@@ -125,6 +125,7 @@ typedef enum {
_1cairo_1push_1group_FUNC,
_1cairo_1rectangle_FUNC,
_1cairo_1reference_FUNC,
+ _1cairo_1region_1union_FUNC,
_1cairo_1rel_1curve_1to_FUNC,
_1cairo_1rel_1line_1to_FUNC,
_1cairo_1rel_1move_1to_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
index 8f342be036..c9b9f0c1ce 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
@@ -1039,6 +1039,19 @@ public static final int /*long*/ cairo_reference(int /*long*/ cr) {
lock.unlock();
}
}
+/**
+ * @param dst cast=(cairo_region_t *)
+ * @param other cast=(const cairo_region_t *)
+ * */
+public static final native int /*long*/ _cairo_region_union(int /*long*/ dst, int /*long*/ other);
+public static final int /*long*/ cairo_region_union(int /*long*/ dst, int /*long*/ other) {
+ lock.lock();
+ try {
+ return _cairo_region_union(dst,other);
+ } finally {
+ lock.unlock();
+ }
+}
/** @param cr cast=(cairo_t *) */
public static final native void _cairo_rel_curve_to(int /*long*/ cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
public static final void cairo_rel_curve_to(int /*long*/ cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3) {
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 4e3b0f2d57..faf3b2a2a6 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
@@ -6376,7 +6376,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1union)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1union_FUNC);
- gdk_region_union((GdkRegion *)arg0, (GdkRegion *)arg1);
+/*
+ gdk_region_union(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_union)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1union_FUNC);
}
#endif
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 08633b994f..cfc6125ae1 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
@@ -247,6 +247,7 @@
#define gtk_widget_set_receives_default_LIB LIB_GTK
#define gtk_widget_set_visible_LIB LIB_GTK
#define gtk_range_get_slider_range_LIB LIB_GTK
+#define gdk_region_union_LIB LIB_GDK
#define gdk_pango_context_set_colormap_LIB LIB_GDK
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
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 457369a96d..fba866a4f4 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
@@ -4839,10 +4839,7 @@ public static final void gdk_region_subtract(int /*long*/ source1, int /*long*/
lock.unlock();
}
}
-/**
- * @param source1 cast=(GdkRegion *)
- * @param source2 cast=(GdkRegion *)
- */
+/** @method flags=dynamic */
public static final native void _gdk_region_union(int /*long*/ source1, int /*long*/ source2);
public static final void gdk_region_union(int /*long*/ source1, int /*long*/ source2) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
index dddb83a991..c07937ca6e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
public class Theme {
@@ -188,7 +189,7 @@ void transferClipping(GC gc, int /*long*/ style) {
if (damageRgn != 0) {
if (clipping != 0) {
clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, clipRgn);
+ cairo_region_union(clipping, clipRgn);
OS.gdk_region_intersect(clipping, damageRgn);
} else {
clipping = damageRgn;
@@ -219,4 +220,12 @@ void transferClipping(GC gc, int /*long*/ style) {
OS.gdk_region_destroy(clipping);
}
}
+
+void cairo_region_union (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
}
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 61021eb94a..3e5271119f 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
@@ -421,7 +421,7 @@ int /*long*/ convertRgn(int /*long*/ rgn, double[] matrix) {
pointArray[6] = (int)x[0];
pointArray[7] = (int)Math.round(y[0]);
int /*long*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_union(newRgn, polyRgn);
+ cairo_region_union(newRgn, polyRgn);
OS.gdk_region_destroy(polyRgn);
}
if (rects[0] != 0) OS.g_free(rects[0]);
@@ -1157,7 +1157,7 @@ void drawImageXRender(Image srcImage, int srcX, int srcY, int srcWidth, int srcH
clipping = data.damageRgn;
} else {
clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, data.clipRgn);
+ cairo_region_union(clipping, data.clipRgn);
OS.gdk_region_intersect(clipping, data.damageRgn);
}
}
@@ -2444,10 +2444,10 @@ public void getClipping(Region region) {
/* Convert clipping to device space if needed */
if (data.clippingTransform != null) {
int /*long*/ rgn = convertRgn(clipRgn, data.clippingTransform);
- OS.gdk_region_union(clipping, rgn);
+ cairo_region_union(clipping, rgn);
OS.gdk_region_destroy(rgn);
} else {
- OS.gdk_region_union(clipping, clipRgn);
+ cairo_region_union(clipping, clipRgn);
}
}
if (data.damageRgn != 0) {
@@ -2460,7 +2460,7 @@ public void getClipping(Region region) {
Cairo.cairo_matrix_invert(matrix);
int /*long*/ rgn = convertRgn(clipping, matrix);
OS.gdk_region_subtract(clipping, clipping);
- OS.gdk_region_union(clipping, rgn);
+ cairo_region_union(clipping, rgn);
OS.gdk_region_destroy(rgn);
}
}
@@ -3316,7 +3316,7 @@ void setClipping(int /*long*/ clipRgn) {
} else {
if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
OS.gdk_region_subtract(data.clipRgn, data.clipRgn);
- OS.gdk_region_union(data.clipRgn, clipRgn);
+ cairo_region_union(data.clipRgn, clipRgn);
if (cairo != 0) {
if (data.clippingTransform == null) data.clippingTransform = new double[6];
Cairo.cairo_get_matrix(cairo, data.clippingTransform);
@@ -3325,7 +3325,7 @@ void setClipping(int /*long*/ clipRgn) {
int /*long*/ clipping = clipRgn;
if (data.damageRgn != 0) {
clipping = OS.gdk_region_new();
- OS.gdk_region_union(clipping, clipRgn);
+ cairo_region_union(clipping, clipRgn);
OS.gdk_region_intersect(clipping, data.damageRgn);
}
OS.gdk_gc_set_clip_region(handle, clipping);
@@ -4170,4 +4170,12 @@ public String toString () {
return "GC {" + handle + "}";
}
+void cairo_region_union (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
index a2b8995ec7..ebafbc69cd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
@@ -11,6 +11,7 @@
package org.eclipse.swt.graphics;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.*;
@@ -110,7 +111,7 @@ public void add (int[] pointArray) {
*/
if (pointArray.length < 6) return;
int /*long*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_union(handle, polyRgn);
+ cairo_region_union(handle, polyRgn);
OS.gdk_region_destroy(polyRgn);
}
@@ -182,7 +183,7 @@ public void add(Region region) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.gdk_region_union(handle, region.handle);
+ cairo_region_union(handle, region.handle);
}
/**
@@ -593,4 +594,12 @@ public String toString () {
if (isDisposed()) return "Region {*DISPOSED*}";
return "Region {" + handle + "}";
}
+
+void cairo_region_union (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_union (dst, other);
+ } else {
+ OS.gdk_region_union (dst, other);
+ }
+}
}