diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-27 11:55:44 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-27 11:55:44 (GMT) |
commit | 957201cb93aa79eb303379cbfd71c1d37f4772ab (patch) | |
tree | ef28b1355dbaebeb1a8e7476dd622f89bd35c406 /macosx/tkMacOSXRegion.c | |
parent | 1f5835f567b76c544877c30f2eb28456a0db5643 (diff) | |
download | tk-957201cb93aa79eb303379cbfd71c1d37f4772ab.zip tk-957201cb93aa79eb303379cbfd71c1d37f4772ab.tar.gz tk-957201cb93aa79eb303379cbfd71c1d37f4772ab.tar.bz2 |
Code style improvements, especially including making code less deeply nested.
Diffstat (limited to 'macosx/tkMacOSXRegion.c')
-rw-r--r-- | macosx/tkMacOSXRegion.c | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 28ec005..b52596f 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -7,10 +7,10 @@ * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2006-2007 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.11 2007/12/13 15:27:10 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.12 2008/10/27 11:55:45 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -21,8 +21,8 @@ * * TkCreateRegion -- * - * Implements the equivelent of the X window function - * XCreateRegion. See X window documentation for more details. + * Implements the equivelent of the X window function XCreateRegion. See + * Xwindow documentation for more details. * * Results: * Returns an allocated region handle. @@ -44,8 +44,8 @@ TkCreateRegion(void) * * TkDestroyRegion -- * - * Implements the equivelent of the X window function - * XDestroyRegion. See X window documentation for more details. + * Implements the equivelent of the X window function XDestroyRegion. See + * Xwindow documentation for more details. * * Results: * None. @@ -70,8 +70,8 @@ TkDestroyRegion( * * TkIntersectRegion -- * - * Implements the equivalent of the X window function - * XIntersectRegion. See X window documentation for more details. + * Implements the equivalent of the X window function XIntersectRegion. + * See Xwindow documentation for more details. * * Results: * None. @@ -97,8 +97,8 @@ TkIntersectRegion( * * TkSubtractRegion -- * - * Implements the equivalent of the X window function - * XSubtractRegion. See X window documentation for more details. + * Implements the equivalent of the X window function XSubtractRegion. + * See X window documentation for more details. * * Results: * None. @@ -125,8 +125,7 @@ TkSubtractRegion( * TkUnionRectWithRegion -- * * Implements the equivelent of the X window function - * XUnionRectWithRegion. See X window documentation for more - * details. + * XUnionRectWithRegion. See Xwindow documentation for more details. * * Results: * None. @@ -163,8 +162,8 @@ TkUnionRectWithRegion( * * TkRectInRegion -- * - * Implements the equivelent of the X window function - * XRectInRegion. See X window documentation for more details. + * Implements the equivelent of the X window function XRectInRegion. See + * Xwindow documentation for more details. * * Results: * Returns RectanglePart or RectangleOut. Note that this is not a @@ -218,7 +217,7 @@ TkRectInRegion( #endif CFRelease(sectRgn); CFRelease(rectRgn); - ) TK_ENDIF + ) TK_ENDIF; return result; } @@ -227,8 +226,8 @@ TkRectInRegion( * * TkClipBox -- * - * Implements the equivelent of the X window function XClipBox. - * See X window documentation for more details. + * Implements the equivelent of the X window function XClipBox. See + * Xwindow documentation for more details. * * Results: * None. @@ -258,8 +257,8 @@ TkClipBox( * * TkpBuildRegionFromAlphaData -- * - * Set up a rectangle of the given region based on the supplied - * alpha data. + * Set up a rectangle of the given region based on the supplied alpha + * data. * * Results: * None @@ -290,13 +289,20 @@ TkpBuildRegionFromAlphaData( for (y1 = 0; y1 < height; y1++) { lineDataPtr = dataPtr; for (x1 = 0; x1 < width; x1 = end) { - /* search for first non-transparent pixel */ + /* + * Search for first non-transparent pixel. + */ + while ((x1 < width) && !*lineDataPtr) { x1++; lineDataPtr += pixelStride; } end = x1; - /* search for first transparent pixel */ + + /* + * Search for first transparent pixel. + */ + while ((end < width) && *lineDataPtr) { end++; lineDataPtr += pixelStride; @@ -509,7 +515,7 @@ TkMacOSXHIShapeCreateEmpty(void) CFRelease(rgn); } result = HIShapeCreateCopy(emptyRgn); - ) TK_ENDIF + ) TK_ENDIF; return result; } @@ -527,7 +533,7 @@ TkMacOSXHIShapeCreateMutableWithRect( result = HIShapeCreateMutableCopy(rgn); CFRelease(rgn); - ) TK_ENDIF + ) TK_ENDIF; return result; } @@ -546,7 +552,7 @@ TkMacOSXHIShapeSetWithShape( if (result == noErr) { result = HIShapeDifference(inSrcShape, inDestShape, inDestShape); } - ) TK_ENDIF + ) TK_ENDIF; return result; } @@ -595,7 +601,7 @@ TkMacOSHIShapeUnionWithRect( result = TkMacOSHIShapeUnion(rgn, inShape, inShape); CFRelease(rgn); - ) TK_ENDIF + ) TK_ENDIF; return result; } @@ -611,7 +617,10 @@ TkMacOSHIShapeUnion( TK_IF_HI_TOOLBOX (4, result = HIShapeUnion(inShape1, inShape2, outResult); ) TK_ELSE_HI_TOOLBOX (4, - /* Workaround HIShapeUnion bug in 10.3 and earlier */ + /* + * Workaround HIShapeUnion bug in 10.3 and earlier. + */ + HIShapeRef rgn = HIShapeCreateCopy(outResult); result = HIShapeUnion(inShape1, inShape2, (HIMutableShapeRef) rgn); @@ -622,7 +631,16 @@ TkMacOSHIShapeUnion( } } CFRelease(rgn); - ) TK_ENDIF + ) TK_ENDIF; return result; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * coding: utf-8 + * End: + */ |