diff options
author | Silenio Quarti <Silenio_Quarti@ca.ibm.com> | 2011-10-20 16:03:26 -0400 |
---|---|---|
committer | Silenio Quarti <Silenio_Quarti@ca.ibm.com> | 2011-10-20 16:03:26 -0400 |
commit | 966531c8bcdaaa6d602257d97118cca4cedf54d7 (patch) | |
tree | 86a5e2d0c04c30eb40345b06f31f78b069a64553 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | |
parent | 5490853b5c3594d14688ab1c5595c53977b8ead0 (diff) | |
download | eclipse.platform.swt-966531c8bcdaaa6d602257d97118cca4cedf54d7.tar.gz eclipse.platform.swt-966531c8bcdaaa6d602257d97118cca4cedf54d7.tar.xz eclipse.platform.swt-966531c8bcdaaa6d602257d97118cca4cedf54d7.zip |
fixing draw background to use image surface
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 4aaf4d362b..75ba4c2204 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -372,14 +372,19 @@ public void drawBackground (GC gc, int x, int y, int width, int height, int offs Cairo.cairo_translate (cairo, -pt.x - offsetX, -pt.y - offsetY); x += pt.x + offsetX; y += pt.y + offsetY; - int /*long*/ xDisplay = OS.GDK_DISPLAY (); - int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual (OS.gdk_visual_get_system()); - int /*long*/ drawable = control.backgroundImage.pixmap; - int /*long*/ xDrawable = OS.GDK_PIXMAP_XID (drawable); - int [] w = new int [1], h = new int [1]; - OS.gdk_drawable_get_size (drawable, w, h); - int /*long*/ surface = Cairo.cairo_xlib_surface_create (xDisplay, xDrawable, xVisual, w [0], h [0]); - if (surface == 0) error (SWT.ERROR_NO_HANDLES); + int /*long*/ surface = control.backgroundImage.surface; + if (surface == 0) { + int /*long*/ xDisplay = OS.GDK_DISPLAY (); + int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual (OS.gdk_visual_get_system()); + int /*long*/ drawable = control.backgroundImage.pixmap; + int /*long*/ xDrawable = OS.GDK_PIXMAP_XID (drawable); + int [] w = new int [1], h = new int [1]; + OS.gdk_drawable_get_size (drawable, w, h); + surface = Cairo.cairo_xlib_surface_create (xDisplay, xDrawable, xVisual, w [0], h [0]); + if (surface == 0) error (SWT.ERROR_NO_HANDLES); + } else { + Cairo.cairo_surface_reference(surface); + } int /*long*/ pattern = Cairo.cairo_pattern_create_for_surface (surface); if (pattern == 0) error (SWT.ERROR_NO_HANDLES); Cairo.cairo_pattern_set_extend (pattern, Cairo.CAIRO_EXTEND_REPEAT); |