diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-10-09 17:01:47 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-10-09 17:01:47 -0400 |
commit | 4cd26b3a6f3cad2a92cb1ef8d14b7253a740c740 (patch) | |
tree | f49683118a7270c3aa63710f09b6a137d06aaf6e | |
parent | c159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4 (diff) | |
download | eclipse.platform.swt-canvas_cairo_64.tar.gz eclipse.platform.swt-canvas_cairo_64.tar.xz eclipse.platform.swt-canvas_cairo_64.zip |
Use Cairo instead of gdk_draw_drawable and gdk_gc_set_exposurescanvas_cairo_64
-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 (); |