diff options
author | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-01-18 15:35:33 -0500 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-01-18 15:35:33 -0500 |
commit | 81769f86af686a9108c70f5eccca90f204a41cef (patch) | |
tree | 9912c22874e1dbac3277088c93428bafa59b1a4f | |
parent | 7a90781a0b4efe2d1023e9b9e3985d7144df555d (diff) | |
download | eclipse.platform.swt-81769f86af686a9108c70f5eccca90f204a41cef.tar.gz eclipse.platform.swt-81769f86af686a9108c70f5eccca90f204a41cef.tar.xz eclipse.platform.swt-81769f86af686a9108c70f5eccca90f204a41cef.zip |
Fix Cairo XOR and drawImage width and height
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java | 14 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java | 21 |
2 files changed, 15 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java index 3e4dabcbaa..4d60a7c5f0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java @@ -39,20 +39,8 @@ public class Cairo extends Platform { public static final int CAIRO_FORMAT_RGB24 = 1; public static final int CAIRO_FORMAT_A8 = 2; public static final int CAIRO_FORMAT_A1 = 3; - public static final int CAIRO_OPERATOR_CLEAR = 0; public static final int CAIRO_OPERATOR_SOURCE = 1; - public static final int CAIRO_OPERATOR_DST = 2; - public static final int CAIRO_OPERATOR_OVER = 3; - public static final int CAIRO_OPERATOR_OVER_REVERSE = 4; - public static final int CAIRO_OPERATOR_IN = 5; - public static final int CAIRO_OPERATOR_IN_REVERSE = 6; - public static final int CAIRO_OPERATOR_OUT = 7; - public static final int CAIRO_OPERATOR_OUT_REVERSE = 8; - public static final int CAIRO_OPERATOR_ATOP = 9; - public static final int CAIRO_OPERATOR_ATOP_REVERSE = 10; - public static final int CAIRO_OPERATOR_XOR = 11; - public static final int CAIRO_OPERATOR_ADD = 12; - public static final int CAIRO_OPERATOR_SATURATE = 13; + public static final int CAIRO_OPERATOR_OVER = 2; public static final int CAIRO_OPERATOR_DIFFERENCE = 23; public static final int CAIRO_FILL_RULE_WINDING = 0; public static final int CAIRO_FILL_RULE_EVEN_ODD = 1; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index 09cb7b4d21..b5d2458746 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -14,7 +14,6 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.widgets.*; import org.eclipse.swt.*; /** @@ -838,11 +837,17 @@ public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeig } void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) { -// int[] width = new int[1]; -// int[] height = new int[1]; -// OS.gdk_drawable_get_size(srcImage.pixmap, width, height); - int imgWidth = srcImage.width; - int imgHeight = srcImage.height; + int imgWidth, imgHeight; + if (OS.USE_CAIRO){ + imgWidth = srcImage.width; + imgHeight = srcImage.height; + } else { + int[] width = new int[1]; + int[] height = new int[1]; + OS.gdk_drawable_get_size(srcImage.pixmap, width, height); + imgWidth = width[0]; + imgHeight = height[0]; + } if (simple) { srcWidth = destWidth = imgWidth; srcHeight = destHeight = imgHeight; @@ -4026,7 +4031,9 @@ public void setTransform(Transform transform) { */ public void setXORMode(boolean xor) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (!OS.USE_CAIRO) { + if (OS.USE_CAIRO) { + Cairo.cairo_set_operator(handle, xor ? Cairo.CAIRO_OPERATOR_DIFFERENCE : Cairo.CAIRO_OPERATOR_OVER); + } else { OS.gdk_gc_set_function(handle, xor ? OS.GDK_XOR : OS.GDK_COPY); } data.xorMode = xor; |