diff options
| author | Anatoly Spektor | 2012-10-09 21:01:47 +0000 |
|---|---|---|
| committer | Alexander Kurtakov | 2012-10-10 12:31:20 +0000 |
| commit | f4412fc58eebec522777379819911580021557cf (patch) | |
| tree | dc4ed75d14c486db715e7e651bfcf679d31ec2c0 | |
| parent | 963a1c83bf8816d807804bc6ebd98995a7e4827d (diff) | |
| download | eclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.tar.gz eclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.tar.xz eclipse.platform.swt-f4412fc58eebec522777379819911580021557cf.zip | |
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.java | 19 |
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 f45d8438fd..f3392944bf 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 (); |
