summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-06-22 13:31:15 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-06-22 13:31:15 -0400
commit4fe35b1b52649cec7a297800ae662f8dec04c322 (patch)
treeea4fc2003c74cac5bcaa5c92366e4c0d47d264d0
parent6f7e9db4a5109de2cb967f8161a35ca18fee8f28 (diff)
downloadeclipse.platform.swt-canvas_cairo.tar.gz
eclipse.platform.swt-canvas_cairo.tar.xz
eclipse.platform.swt-canvas_cairo.zip
Use Cairo in Canvas scroll() instead of GDK deprecated methodscanvas_cairo
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java20
1 files changed, 19 insertions, 1 deletions
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 1799563854..c2adcf0917 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.*;
@@ -275,11 +276,28 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
// GC gc = new GC (this);
// gc.copyArea (x, y, width, height, destX, destY);
// gc.dispose ();
- //TODO: Use Cairo
+ if (OS.USE_CAIRO) {
+ int /*long */ cairo = OS.gdk_cairo_create (window);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_rectangle(cairo, destX, destY, width, height);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_translate(cairo, deltaX, deltaY);
+ Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_SOURCE);
+ 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);
+ Cairo.cairo_rectangle(cairo, destX - deltaX, destY - deltaY, width, height);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_paint(cairo);
+ Cairo.cairo_restore(cairo);
+ Cairo.cairo_destroy(cairo);
+ }else{
int /*long*/ 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);
+ }
boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
if (disjoint) {
GdkRectangle rect = new GdkRectangle ();