summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXRegion.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXRegion.c')
-rw-r--r--macosx/tkMacOSXRegion.c113
1 files changed, 14 insertions, 99 deletions
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index b52596f..2a0eda7 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -4,13 +4,13 @@
* Implements X window calls for manipulating regions
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright 2001-2009, Apple Inc.
+ * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
- * See the file "license.terms" for information on usage and redistribution of
- * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.12 2008/10/27 11:55:45 dkf Exp $
+ * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.13 2009/06/29 14:35:01 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -186,38 +186,8 @@ TkRectInRegion(
int result;
const CGRect r = CGRectMake(x, y, width, height);
- TK_IF_MAC_OS_X_API (4, HIShapeIntersectsRect,
- result = HIShapeIntersectsRect((HIShapeRef) region, &r) ?
- RectanglePart : RectangleOut;
- ) TK_ELSE_MAC_OS_X (4,
- HIShapeRef rectRgn = HIShapeCreateWithRect(&r);
- HIShapeRef sectRgn = HIShapeCreateIntersection((HIShapeRef) region,
- rectRgn);
-
-#if 1
- result = !HIShapeIsEmpty(sectRgn) ? RectanglePart : RectangleOut;
-#else
- /*
- * More expensive full implementation that tests for RectangleIn,
- * unused by Tk at present.
- */
-
- if (!HIShapeIsEmpty(sectRgn)) {
- HIShapeRef diffRgn = HIShapeCreateDifference(rectRgn, sectRgn);
-
- if (HIShapeIsEmpty(diffRgn)) {
- result = RectangleIn;
- } else {
- result = RectanglePart;
- }
- CFRelease(diffRgn);
- } else {
- result = RectangleOut;
- }
-#endif
- CFRelease(sectRgn);
- CFRelease(rectRgn);
- ) TK_ENDIF;
+ result = HIShapeIntersectsRect((HIShapeRef) region, &r) ?
+ RectanglePart : RectangleOut;
return result;
}
@@ -244,7 +214,7 @@ TkClipBox(
XRectangle* rect_return)
{
CGRect rect;
-
+
HIShapeGetBounds((HIShapeRef) r, &rect);
rect_return->x = rect.origin.x;
rect_return->y = rect.origin.y;
@@ -503,20 +473,7 @@ TkMacOSXHIShapeCreateEmpty(void)
{
HIShapeRef result;
- TK_IF_MAC_OS_X_API (4, HIShapeCreateEmpty,
- result = HIShapeCreateEmpty();
- ) TK_ELSE_MAC_OS_X (4,
- static HIShapeRef emptyRgn = NULL;
-
- if (!emptyRgn) {
- HIMutableShapeRef rgn = HIShapeCreateMutable();
-
- emptyRgn = HIShapeCreateCopy(rgn);
- CFRelease(rgn);
- }
- result = HIShapeCreateCopy(emptyRgn);
- ) TK_ENDIF;
-
+ result = HIShapeCreateEmpty();
return result;
}
@@ -526,15 +483,7 @@ TkMacOSXHIShapeCreateMutableWithRect(
{
HIMutableShapeRef result;
- TK_IF_MAC_OS_X_API (5, HIShapeCreateMutableWithRect,
- result = HIShapeCreateMutableWithRect(inRect);
- ) TK_ELSE_MAC_OS_X (5,
- HIShapeRef rgn = HIShapeCreateWithRect(inRect);
-
- result = HIShapeCreateMutableCopy(rgn);
- CFRelease(rgn);
- ) TK_ENDIF;
-
+ result = HIShapeCreateMutableWithRect(inRect);
return result;
}
@@ -545,15 +494,7 @@ TkMacOSXHIShapeSetWithShape(
{
OSStatus result;
- TK_IF_MAC_OS_X_API (5, HIShapeSetWithShape,
- result = HIShapeSetWithShape(inDestShape, inSrcShape);
- ) TK_ELSE_MAC_OS_X (5,
- result = HIShapeSetEmpty(inDestShape);
- if (result == noErr) {
- result = HIShapeDifference(inSrcShape, inDestShape, inDestShape);
- }
- ) TK_ENDIF;
-
+ result = HIShapeSetWithShape(inDestShape, inSrcShape);
return result;
}
@@ -594,15 +535,7 @@ TkMacOSHIShapeUnionWithRect(
{
OSStatus result;
- TK_IF_MAC_OS_X_API (5, HIShapeUnionWithRect,
- result = HIShapeUnionWithRect(inShape, inRect);
- ) TK_ELSE_MAC_OS_X (5,
- HIShapeRef rgn = HIShapeCreateWithRect(inRect);
-
- result = TkMacOSHIShapeUnion(rgn, inShape, inShape);
- CFRelease(rgn);
- ) TK_ENDIF;
-
+ result = HIShapeUnionWithRect(inShape, inRect);
return result;
}
@@ -614,25 +547,7 @@ TkMacOSHIShapeUnion(
{
OSStatus result;
- TK_IF_HI_TOOLBOX (4,
- result = HIShapeUnion(inShape1, inShape2, outResult);
- ) TK_ELSE_HI_TOOLBOX (4,
- /*
- * Workaround HIShapeUnion bug in 10.3 and earlier.
- */
-
- HIShapeRef rgn = HIShapeCreateCopy(outResult);
-
- result = HIShapeUnion(inShape1, inShape2, (HIMutableShapeRef) rgn);
- if (result == noErr) {
- result = HIShapeSetEmpty(outResult);
- if (result == noErr) {
- result = HIShapeDifference(rgn, outResult, outResult);
- }
- }
- CFRelease(rgn);
- ) TK_ENDIF;
-
+ result = HIShapeUnion(inShape1, inShape2, outResult);
return result;
}
@@ -640,7 +555,7 @@ TkMacOSHIShapeUnion(
* Local Variables:
* mode: c
* c-basic-offset: 4
- * fill-column: 78
+ * fill-column: 79
* coding: utf-8
* End:
*/