diff options
author | Silenio Quarti <silenio> | 2002-12-06 16:38:32 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2002-12-06 16:38:32 +0000 |
commit | 28964173c341f5f58ee1a8e924fc70bb1a37d159 (patch) | |
tree | 2006a9d788eee797b9cb9811a3afdc113ac95434 | |
parent | cd78b9287fe6074147beec6d3981e34b0f01458a (diff) | |
download | eclipse.platform.swt-28964173c341f5f58ee1a8e924fc70bb1a37d159.tar.gz eclipse.platform.swt-28964173c341f5f58ee1a8e924fc70bb1a37d159.tar.xz eclipse.platform.swt-28964173c341f5f58ee1a8e924fc70bb1a37d159.zip |
*** empty log message ***
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java | 45 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java | 1 |
2 files changed, 37 insertions, 9 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 c277bcd34b..77495bea26 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 @@ -149,7 +149,7 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d if (data.control != 0) { int window = OS.GetControlOwner(data.control); int port = OS.GetWindowPort(window); - + /* Calculate src and dest rectangles/regions */ Rect rect = new Rect(); OS.GetControlBounds(data.control, rect); @@ -171,15 +171,42 @@ public void copyArea(int srcX, int srcY, int width, int height, int destX, int d OS.RectRgn(destRgn, destRect); /* Copy bits with appropriated clipping region */ - int clipRgn = OS.NewRgn(); - OS.CopyRgn(data.visibleRgn, clipRgn); - if (data.clipRgn != 0) { - OS.SectRgn(data.clipRgn, clipRgn, clipRgn); + 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.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); } - int portBitMap = OS.GetPortBitMapForCopyBits (port); - OS.CopyBits(portBitMap, portBitMap, srcRect, destRect, (short)OS.srcCopy, clipRgn); - OS.QDFlushPortBuffer(port, destRgn); - OS.DisposeRgn(clipRgn); /* Invalidate src and obscured areas */ int invalRgn = OS.NewRgn(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java index 9bb4ee4cc6..d3c85bedef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java @@ -322,6 +322,7 @@ public void setVisible (boolean visible) { } OS.HIViewSetVisible (handle, visible); sendEvent (visible ? SWT.Show : SWT.Hide); + parent.layoutControl(); } void setZOrder () { |