summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-09 17:01:47 (EDT)
committer Alexander Kurtakov2012-10-10 08:31:20 (EDT)
commitf4412fc58eebec522777379819911580021557cf (patch)
treedc4ed75d14c486db715e7e651bfcf679d31ec2c0
parent963a1c83bf8816d807804bc6ebd98995a7e4827d (diff)
downloadeclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.zip
eclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.tar.gz
eclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.tar.bz2
Use Cairo instead of gdk_draw_drawable and gdk_gc_set_exposures
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java19
1 files changed, 14 insertions, 5 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 f45d843..f339294 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,19 @@ 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
- 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);
+ if (OS.USE_CAIRO) {
+ OS.gdk_window_invalidate_rect (window, copyRect, true);
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ OS.gdk_cairo_set_source_window (cairo, window, 0, 0);
+ Cairo.cairo_rectangle (cairo, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height);
+ Cairo.cairo_fill (cairo);
+ Cairo.cairo_destroy (cairo);
+ } 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);
+ }
boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
if (disjoint) {
GdkRectangle rect = new GdkRectangle ();