summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-17 10:24:37 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-17 10:24:37 -0400
commita64e6ec5663b6dd0ebe0c55e277147f875cd3224 (patch)
tree0b998e5cd1e41078430e4f37a2b4787eb10e1527
parent98eede2304ef21382ba2912864be9fe9af86265e (diff)
downloadeclipse.platform.swt-gtk3_region_intersect.tar.gz
eclipse.platform.swt-gtk3_region_intersect.tar.xz
eclipse.platform.swt-gtk3_region_intersect.zip
Use cairo_region_intersect() instead of gdk_region_intersect() for GTK3gtk3_region_intersect
This patch substitutes gdk_region_intersect() with cairo_region_intersect() 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
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java11
12 files changed, 95 insertions, 19 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..299fd15ca8 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_1intersect
+JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1region_1intersect)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ Cairo_NATIVE_ENTER(env, that, _1cairo_1region_1intersect_FUNC);
+ rc = (jintLong)cairo_region_intersect((cairo_region_t *)arg0, (const cairo_region_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, _1cairo_1region_1intersect_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..6f9138a82a 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_1intersect",
"_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..3cb1b4a0ab 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_1intersect_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..eb1fd57634 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_intersect(int /*long*/ dst, int /*long*/ other);
+public static final int /*long*/ cairo_region_intersect(int /*long*/ dst, int /*long*/ other) {
+ lock.lock();
+ try {
+ return _cairo_region_intersect(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..ca2bdd75b9 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
@@ -6276,7 +6276,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1intersect)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1intersect_FUNC);
- gdk_region_intersect((GdkRegion *)arg0, (GdkRegion *)arg1);
+/*
+ gdk_region_intersect(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_intersect)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1intersect_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..94b0403620 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_intersect_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..51e69700a4 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
@@ -4740,10 +4740,7 @@ public static final void gdk_region_get_rectangles(int /*long*/ region, int /*lo
lock.unlock();
}
}
-/**
- * @param source1 cast=(GdkRegion *)
- * @param source2 cast=(GdkRegion *)
- */
+/** @method flags=dynamic */
public static final native void _gdk_region_intersect(int /*long*/ source1, int /*long*/ source2);
public static final void gdk_region_intersect(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..3754b54de9 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 {
@@ -189,7 +190,7 @@ void transferClipping(GC gc, int /*long*/ style) {
if (clipping != 0) {
clipping = OS.gdk_region_new();
OS.gdk_region_union(clipping, clipRgn);
- OS.gdk_region_intersect(clipping, damageRgn);
+ cairo_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_intersect (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (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..2672319816 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
@@ -553,7 +553,7 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d
srcRect.width = width;
srcRect.height = height;
int /*long*/ copyRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_intersect(copyRegion, visibleRegion);
+ cairo_region_intersect(copyRegion, visibleRegion);
int /*long*/ invalidateRegion = OS.gdk_region_rectangle (srcRect);
OS.gdk_region_subtract (invalidateRegion, visibleRegion);
OS.gdk_region_offset (invalidateRegion, deltaX, deltaY);
@@ -1158,7 +1158,7 @@ void drawImageXRender(Image srcImage, int srcX, int srcY, int srcWidth, int srcH
} else {
clipping = OS.gdk_region_new();
OS.gdk_region_union(clipping, data.clipRgn);
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ cairo_region_intersect(clipping, data.damageRgn);
}
}
if (clipping != 0) {
@@ -2379,17 +2379,17 @@ public Rectangle getClipping() {
rect.height = height;
OS.gdk_region_union_with_rect(rgn, rect);
if (damageRgn != 0) {
- OS.gdk_region_intersect (rgn, damageRgn);
+ cairo_region_intersect (rgn, damageRgn);
}
/* Intersect visible bounds with clipping */
if (clipRgn != 0) {
/* Convert clipping to device space if needed */
if (data.clippingTransform != null) {
clipRgn = convertRgn(clipRgn, data.clippingTransform);
- OS.gdk_region_intersect(rgn, clipRgn);
+ cairo_region_intersect(rgn, clipRgn);
OS.gdk_region_destroy(clipRgn);
} else {
- OS.gdk_region_intersect(rgn, clipRgn);
+ cairo_region_intersect(rgn, clipRgn);
}
}
/* Convert to user space */
@@ -2451,7 +2451,7 @@ public void getClipping(Region region) {
}
}
if (data.damageRgn != 0) {
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ cairo_region_intersect(clipping, data.damageRgn);
}
/* Convert to user space */
if (cairo != 0) {
@@ -3326,7 +3326,7 @@ void setClipping(int /*long*/ clipRgn) {
if (data.damageRgn != 0) {
clipping = OS.gdk_region_new();
OS.gdk_region_union(clipping, clipRgn);
- OS.gdk_region_intersect(clipping, data.damageRgn);
+ cairo_region_intersect(clipping, data.damageRgn);
}
OS.gdk_gc_set_clip_region(handle, clipping);
if (clipping != clipRgn) OS.gdk_region_destroy(clipping);
@@ -4170,4 +4170,12 @@ public String toString () {
return "GC {" + handle + "}";
}
+void cairo_region_intersect (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (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..cd059b7d98 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.*;
@@ -332,7 +333,7 @@ public void intersect(int x, int y, int width, int height) {
gdkRect.width = width;
gdkRect.height = height;
int /*long*/ rectRgn = OS.gdk_region_rectangle(gdkRect);
- OS.gdk_region_intersect(handle, rectRgn);
+ cairo_region_intersect(handle, rectRgn);
OS.gdk_region_destroy(rectRgn);
}
@@ -357,7 +358,7 @@ public void intersect(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_intersect(handle, region.handle);
+ cairo_region_intersect(handle, region.handle);
}
/**
@@ -593,4 +594,12 @@ public String toString () {
if (isDisposed()) return "Region {*DISPOSED*}";
return "Region {" + handle + "}";
}
+
+void cairo_region_intersect (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
index 67695a3d5d..6d70fdea3e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
@@ -854,7 +854,7 @@ public Rectangle getBounds(int start, int end) {
rect.height = OS.PANGO_PIXELS(pangoRect.height);
OS.gdk_region_union_with_rect(linesRegion, rect);
} while (lineEnd + 1 <= byteEnd);
- OS.gdk_region_intersect(clipRegion, linesRegion);
+ cairo_region_intersect(clipRegion, linesRegion);
OS.gdk_region_destroy(linesRegion);
OS.pango_layout_iter_free(iter);
@@ -2223,4 +2223,12 @@ int width () {
return OS.PANGO_PIXELS(w[0]);
}
+void cairo_region_intersect (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
index 9ebbe8e7e9..9a30ef477d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.*;
@@ -257,7 +258,7 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
srcRect.width = width;
srcRect.height = height;
int /*long*/ copyRegion = OS.gdk_region_rectangle (srcRect);
- OS.gdk_region_intersect(copyRegion, visibleRegion);
+ cairo_region_intersect(copyRegion, visibleRegion);
int /*long*/ invalidateRegion = OS.gdk_region_rectangle (srcRect);
OS.gdk_region_subtract (invalidateRegion, visibleRegion);
OS.gdk_region_offset (invalidateRegion, deltaX, deltaY);
@@ -408,4 +409,12 @@ void updateCaret () {
OS.gtk_im_context_set_cursor_location (imHandle, rect);
}
+void cairo_region_intersect (int /*long*/ dst, int /*long*/ other) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_intersect (dst, other);
+ } else {
+ OS.gdk_region_intersect (dst, other);
+ }
+}
+
}