summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-07 16:05:28 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-07 16:05:28 -0400
commit1898d6947b35c977f6e75ea4a7d91f79c59af06c (patch)
tree739c0330c8bd6ea4c6e661cf7cdd62de60970399
parenteda05e5e1bfd7a8e6860cccbab7bfcd105765ca8 (diff)
downloadeclipse.platform.swt-gtk3_region_offset.tar.gz
eclipse.platform.swt-gtk3_region_offset.tar.xz
eclipse.platform.swt-gtk3_region_offset.zip
Use cairo_region_translate() instead of gdk_region_offset () for GTK+3gtk3_region_offset
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c10
-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.java12
-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.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java7
10 files changed, 60 insertions, 9 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..cc0f5812b8 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,16 @@ JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1reference)
}
#endif
+#ifndef NO__1cairo_1region_1translate
+JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1region_1translate)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, _1cairo_1region_1translate_FUNC);
+ cairo_region_translate((cairo_region_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, _1cairo_1region_1translate_FUNC);
+}
+#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..6c1a15a980 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_1translate",
"_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..1df6275faf 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_1translate_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..08fc88d0ef 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,18 @@ public static final int /*long*/ cairo_reference(int /*long*/ cr) {
lock.unlock();
}
}
+/**
+ * @param region cast=(cairo_region_t *)
+ */
+public static final native void _cairo_region_translate(int /*long*/ region, int dx, int dy);
+public static final void cairo_region_translate(int /*long*/ region, int dx, int dy) {
+ lock.lock();
+ try {
+ _cairo_region_translate(region, dx, dy);
+ } 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 90c1ebac16..9189dad029 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
@@ -6230,7 +6230,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1region_1offset)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2)
{
OS_NATIVE_ENTER(env, that, _1gdk_1region_1offset_FUNC);
- gdk_region_offset((GdkRegion *)arg0, (gint)arg1, (gint)arg2);
+/*
+ gdk_region_offset(arg0, (gint)arg1, (gint)arg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_region_offset)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, gint, gint))fp)(arg0, (gint)arg1, (gint)arg2);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1region_1offset_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 09073e9c3e..ffe0824cf1 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
@@ -230,6 +230,7 @@
#define gtk_widget_set_visible_LIB LIB_GTK
#define gtk_range_get_slider_range_LIB LIB_GTK
#define gdk_pango_context_set_colormap_LIB LIB_GDK
+#define gdk_region_offset_LIB LIB_GDK
#define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK
#define gdk_x11_screen_lookup_visual_LIB LIB_GDK
#define gdk_x11_window_lookup_for_display_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 c2310b7878..1d116c5d92 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
@@ -4707,7 +4707,7 @@ public static final int /*long*/ gdk_region_new() {
}
}
/**
- * @param region cast=(GdkRegion *)
+ * @method flags=dynamic
* @param dx cast=(gint)
* @param dy cast=(gint)
*/
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..524811507f 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
@@ -556,7 +556,7 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d
OS.gdk_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);
+ cairo_region_translate (invalidateRegion, deltaX, deltaY);
OS.gdk_window_invalidate_region(drawable, invalidateRegion, false);
OS.gdk_region_destroy (visibleRegion);
OS.gdk_region_destroy (copyRegion);
@@ -1084,9 +1084,9 @@ void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeig
int /*long*/ mask = OS.gdk_bitmap_create_from_data(0, maskData, newWidth, newHeight);
if (mask != 0) {
int /*long*/ gc = OS.gdk_gc_new(mask);
- OS.gdk_region_offset(data.clipRgn, -destX + srcX, -destY + srcY);
+ cairo_region_translate (data.clipRgn, -destX + srcX, -destY + srcY);
OS.gdk_gc_set_clip_region(gc, data.clipRgn);
- OS.gdk_region_offset(data.clipRgn, destX - srcX, destY - srcY);
+ cairo_region_translate (data.clipRgn, destX - srcX, destY - srcY);
GdkColor color = new GdkColor();
color.pixel = 1;
OS.gdk_gc_set_foreground(gc, color);
@@ -4170,4 +4170,12 @@ public String toString () {
return "GC {" + handle + "}";
}
+void cairo_region_translate(int /*long*/ region, int dx, int dy) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate(region, dx, dy);
+ } else {
+ OS.gdk_region_offset(region, dx, dy);
+ }
+}
+
}
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..62e8f38e4c 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.*;
@@ -559,7 +560,11 @@ public void subtract(Region region) {
*/
public void translate (int x, int y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- OS.gdk_region_offset (handle, x, y);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate(handle, x, y);
+ } else {
+ OS.gdk_region_offset (handle, x, y);
+ }
}
/**
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..428ac6fdb9 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.*;
@@ -260,7 +261,11 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
OS.gdk_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);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ Cairo.cairo_region_translate(invalidateRegion, deltaX, deltaY);
+ } else {
+ OS.gdk_region_offset (invalidateRegion, deltaX, deltaY);
+ }
GdkRectangle copyRect = new GdkRectangle();
OS.gdk_region_get_clipbox (copyRegion, copyRect);
if (copyRect.width != 0 && copyRect.height != 0) {