Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-06-30 11:02:02 +0000
committerAlexander Kurtakov2017-06-30 11:02:40 +0000
commit60b40763faed12c9fa3816d0d424004bd2023ed0 (patch)
tree41a3e3be5cd92c5dee9be2ec4d4f5af9a06da83f
parent49a8e387437d8e4859511fda57778d2dd800473d (diff)
downloadeclipse.platform.swt-60b40763faed12c9fa3816d0d424004bd2023ed0.tar.gz
eclipse.platform.swt-60b40763faed12c9fa3816d0d424004bd2023ed0.tar.xz
eclipse.platform.swt-60b40763faed12c9fa3816d0d424004bd2023ed0.zip
Bug 519026 - Make Canvas scroll use only cairo drawing
Cairo drawing was used only on GTK3 but it works without modifications on GTK 2 too. Unused bindings removed. Change-Id: Ic41799460d360ebca4bf2c3e95d1ccf95718b0bb Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c18
-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/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.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java35
6 files changed, 14 insertions, 54 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 2b8ba9da6c..0c566ad17d 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
@@ -5065,24 +5065,6 @@ fail:
}
#endif
-#ifndef NO__1gdk_1gc_1set_1exposures
-JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1gc_1set_1exposures)
- (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
-{
- OS_NATIVE_ENTER(env, that, _1gdk_1gc_1set_1exposures_FUNC);
-/*
- gdk_gc_set_exposures(arg0, arg1);
-*/
- {
- OS_LOAD_FUNCTION(fp, gdk_gc_set_exposures)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1);
- }
- }
- OS_NATIVE_EXIT(env, that, _1gdk_1gc_1set_1exposures_FUNC);
-}
-#endif
-
#ifndef NO__1gdk_1gc_1set_1fill
JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1gc_1set_1fill)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
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 2640e3bfe5..d2d68ca4b6 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
@@ -169,7 +169,6 @@
#define gdk_gc_set_fill_LIB LIB_GDK
#define gdk_gc_set_clip_origin_LIB LIB_GDK
#define gdk_gc_set_dashes_LIB LIB_GDK
-#define gdk_gc_set_exposures_LIB LIB_GDK
#define gdk_gc_set_line_attributes_LIB LIB_GDK
#define gdk_gc_set_tile_LIB LIB_GDK
#define gdk_gc_set_ts_origin_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 3018109fb9..82b878ef74 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
@@ -451,7 +451,6 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1gc_1set_1clip_1origin",
"_1gdk_1gc_1set_1clip_1region",
"_1gdk_1gc_1set_1dashes",
- "_1gdk_1gc_1set_1exposures",
"_1gdk_1gc_1set_1fill",
"_1gdk_1gc_1set_1foreground",
"_1gdk_1gc_1set_1function",
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 80cb115801..5983ccc2bc 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
@@ -461,7 +461,6 @@ typedef enum {
_1gdk_1gc_1set_1clip_1origin_FUNC,
_1gdk_1gc_1set_1clip_1region_FUNC,
_1gdk_1gc_1set_1dashes_FUNC,
- _1gdk_1gc_1set_1exposures_FUNC,
_1gdk_1gc_1set_1fill_FUNC,
_1gdk_1gc_1set_1foreground_FUNC,
_1gdk_1gc_1set_1function_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 3e3b1b0f89..eb43706b48 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
@@ -4320,18 +4320,6 @@ public static final void gdk_gc_set_dashes(long /*int*/ gc, int dash_offset, byt
lock.unlock();
}
}
-/**
- * @method flags=dynamic
- */
-public static final native void _gdk_gc_set_exposures(long /*int*/ gc, boolean exposures);
-public static final void gdk_gc_set_exposures(long /*int*/ gc, boolean exposures) {
- lock.lock();
- try {
- _gdk_gc_set_exposures(gc, exposures);
- } finally {
- lock.unlock();
- }
-}
/** @method flags=dynamic */
public static final native void _gdk_gc_set_fill(long /*int*/ gc, int fill);
public static final void gdk_gc_set_fill(long /*int*/ gc, int fill) {
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 dfb7e778fa..0c41667c0c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -381,28 +381,21 @@ void scrollInPixels (int destX, int destY, int x, int y, int width, int height,
redrawWidget (x, y, width, height, false, false, false);
redrawWidget (destX, destY, width, height, false, false, false);
} else {
- if (OS.GTK3) {
- long /*int*/ cairo = OS.gdk_cairo_create(window);
- if (Cairo.cairo_version() < Cairo.CAIRO_VERSION_ENCODE(1, 12, 0)) {
- OS.gdk_cairo_set_source_window(cairo, window, 0, 0);
- } else {
- Cairo.cairo_push_group(cairo);
- OS.gdk_cairo_set_source_window(cairo, window, 0, 0);
- Cairo.cairo_paint(cairo);
- Cairo.cairo_pop_group_to_source(cairo);
- }
- double[] matrix = {1, 0, 0, 1, -deltaX, -deltaY};
- Cairo.cairo_pattern_set_matrix(Cairo.cairo_get_source(cairo), matrix);
- Cairo.cairo_rectangle(cairo, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height);
- Cairo.cairo_clip(cairo);
- Cairo.cairo_paint(cairo);
- Cairo.cairo_destroy(cairo);
+ long /*int*/ cairo = OS.gdk_cairo_create(window);
+ if (Cairo.cairo_version() < Cairo.CAIRO_VERSION_ENCODE(1, 12, 0)) {
+ OS.gdk_cairo_set_source_window(cairo, window, 0, 0);
} else {
- long /*int*/ gdkGC = OS.gdk_gc_new (window);
- OS.gdk_gc_set_exposures (gdkGC, true);
- OS.gdk_draw_drawable (window, gdkGC, window, copyRect.x, copyRect.y, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height);
- OS.g_object_unref (gdkGC);
+ Cairo.cairo_push_group(cairo);
+ OS.gdk_cairo_set_source_window(cairo, window, 0, 0);
+ Cairo.cairo_paint(cairo);
+ Cairo.cairo_pop_group_to_source(cairo);
}
+ double[] matrix = {1, 0, 0, 1, -deltaX, -deltaY};
+ Cairo.cairo_pattern_set_matrix(Cairo.cairo_get_source(cairo), matrix);
+ Cairo.cairo_rectangle(cairo, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_paint(cairo);
+ Cairo.cairo_destroy(cairo);
boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
if (disjoint) {
GdkRectangle rect = new GdkRectangle ();

Back to the top