Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2004-03-14 00:01:59 +0000
committerSilenio Quarti2004-03-14 00:01:59 +0000
commitae02d4e8ceee481611678c2c5fac135f01be1cd8 (patch)
treea01ed1976de583291359ecb1a79bd04eb1148649
parent82a765d186d34f3c199c8f6abf25c1c03e189c53 (diff)
downloadeclipse.platform.swt-ae02d4e8ceee481611678c2c5fac135f01be1cd8.tar.gz
eclipse.platform.swt-ae02d4e8ceee481611678c2c5fac135f01be1cd8.tar.xz
eclipse.platform.swt-ae02d4e8ceee481611678c2c5fac135f01be1cd8.zip
43893
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java72
1 files changed, 38 insertions, 34 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
index 2447a3b699..4fa739cf06 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
@@ -189,41 +189,45 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d
/* Copy bits with appropriated clipping region */
if (!OS.EmptyRect(srcRect)) {
- int clipRgn = data.visibleRgn;
- if (data.clipRgn != 0) {
- clipRgn = OS.NewRgn();
- OS.SectRgn(data.clipRgn, clipRgn, clipRgn);
- }
-
- /*
- * Feature in the Macintosh. ScrollRect() only copies bits
- * that are inside the specified rectangle. This means that
- * it is not possible to copy non overlaping bits without
- * copying the bits in between the source and destination
- * rectangles. The fix is to check if the source and
- * destination rectangles are disjoint and use CopyBits()
- * instead.
- */
- boolean disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
- if (!disjoint && (deltaX == 0 || deltaY == 0)) {
- int[] currentPort = new int[1];
- OS.GetPort(currentPort);
- OS.SetPort(port);
- int oldClip = OS.NewRgn();
- OS.GetClip(oldClip);
- OS.SetClip(clipRgn);
- OS.UnionRect(srcRect, destRect, rect);
- OS.ScrollRect(rect, (short)deltaX, (short)deltaY, 0);
- OS.SetClip(oldClip);
- OS.DisposeRgn(oldClip);
- OS.SetPort(currentPort[0]);
- } else {
- int portBitMap = OS.GetPortBitMapForCopyBits (port);
- OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, (short)OS.srcCopy, clipRgn);
- OS.QDFlushPortBuffer(port, destRgn);
+ if (data.visibleRgn == 0 || OS.RectInRgn(srcRect, data.visibleRgn)) {
+ int clipRgn = data.visibleRgn;
+ if (data.clipRgn != 0) {
+ clipRgn = OS.NewRgn();
+ OS.SectRgn(data.clipRgn, data.visibleRgn, clipRgn);
+ }
+
+ /*
+ * Feature in the Macintosh. ScrollRect() only copies bits
+ * that are inside the specified rectangle. This means that
+ * it is not possible to copy non overlaping bits without
+ * copying the bits in between the source and destination
+ * rectangles. The fix is to check if the source and
+ * destination rectangles are disjoint and use CopyBits()
+ * instead.
+ */
+ if (!OS.EmptyRgn(clipRgn)) {
+ boolean disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
+ if (!disjoint && (deltaX == 0 || deltaY == 0)) {
+ int[] currentPort = new int[1];
+ OS.GetPort(currentPort);
+ OS.SetPort(port);
+ int oldClip = OS.NewRgn();
+ OS.GetClip(oldClip);
+ OS.SetClip(clipRgn);
+ OS.UnionRect(srcRect, destRect, rect);
+ OS.ScrollRect(rect, (short)deltaX, (short)deltaY, 0);
+ OS.SetClip(oldClip);
+ OS.DisposeRgn(oldClip);
+ OS.SetPort(currentPort[0]);
+ } else {
+ int portBitMap = OS.GetPortBitMapForCopyBits (port);
+ OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, (short)OS.srcCopy, clipRgn);
+ OS.QDFlushPortBuffer(port, destRgn);
+ }
+ }
+
+ if (clipRgn != data.visibleRgn) OS.DisposeRgn(clipRgn);
}
-
- if (clipRgn != data.visibleRgn) OS.DisposeRgn(clipRgn);
}
/* Invalidate src and obscured areas */

Back to the top