diff options
Diffstat (limited to 'macosx/tkMacOSXRegion.c')
-rw-r--r-- | macosx/tkMacOSXRegion.c | 118 |
1 files changed, 36 insertions, 82 deletions
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 1e51343..1206d5b 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -10,7 +10,7 @@ * 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.6 2007/04/23 21:24:34 das Exp $ + * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.7 2007/05/30 06:35:55 das Exp $ */ #include "tkMacOSXInt.h" @@ -36,9 +36,7 @@ TkRegion TkCreateRegion(void) { - RgnHandle rgn; - rgn = NewRgn(); - return (TkRegion) rgn; + return (TkRegion) NewRgn(); } /* @@ -62,8 +60,7 @@ void TkDestroyRegion( TkRegion r) { - RgnHandle rgn = (RgnHandle) r; - DisposeRgn(rgn); + DisposeRgn((RgnHandle) r); } /* @@ -89,10 +86,33 @@ TkIntersectRegion( TkRegion srb, TkRegion dr_return) { - RgnHandle srcRgnA = (RgnHandle) sra; - RgnHandle srcRgnB = (RgnHandle) srb; - RgnHandle destRgn = (RgnHandle) dr_return; - SectRgn(srcRgnA, srcRgnB, destRgn); + SectRgn((RgnHandle) sra, (RgnHandle) srb, (RgnHandle) dr_return); +} + +/* + *---------------------------------------------------------------------- + * + * TkSubtractRegion -- + * + * Implements the equivilent of the X window function + * XSubtractRegion. See X window documentation for more details. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +TkSubtractRegion( + TkRegion sra, + TkRegion srb, + TkRegion dr_return) +{ + DiffRgn((RgnHandle) sra, (RgnHandle) srb, (RgnHandle) dr_return); } /* @@ -119,13 +139,11 @@ TkUnionRectWithRegion( TkRegion src_region, TkRegion dest_region_return) { - RgnHandle srcRgn = (RgnHandle) src_region; - RgnHandle destRgn = (RgnHandle) dest_region_return; - TkMacOSXCheckTmpRgnEmpty(1); SetRectRgn(tkMacOSXtmpRgn1, rectangle->x, rectangle->y, rectangle->x + rectangle->width, rectangle->y + rectangle->height); - UnionRgn(srcRgn, tkMacOSXtmpRgn1, destRgn); + UnionRgn((RgnHandle) src_region, tkMacOSXtmpRgn1, + (RgnHandle) dest_region_return); SetEmptyRgn(tkMacOSXtmpRgn1); } @@ -154,15 +172,14 @@ TkRectInRegion( unsigned int width, unsigned int height) { - RgnHandle rgn = (RgnHandle) region; int result; TkMacOSXCheckTmpRgnEmpty(1); SetRectRgn(tkMacOSXtmpRgn1, x, y, x + width, y + height); - SectRgn(rgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1); + SectRgn((RgnHandle) region, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1); if (EmptyRgn(tkMacOSXtmpRgn1)) { result = RectangleOut; - } else if (EqualRgn(rgn, tkMacOSXtmpRgn1)) { + } else if (EqualRgn((RgnHandle) region, tkMacOSXtmpRgn1)) { result = RectangleIn; } else { result = RectanglePart; @@ -193,11 +210,9 @@ TkClipBox( TkRegion r, XRectangle* rect_return) { - RgnHandle rgn = (RgnHandle) r; - Rect rect; - - GetRegionBounds(rgn,&rect); + Rect rect; + GetRegionBounds((RgnHandle) r,&rect); rect_return->x = rect.left; rect_return->y = rect.top; rect_return->width = rect.right-rect.left; @@ -207,36 +222,6 @@ TkClipBox( /* *---------------------------------------------------------------------- * - * TkSubtractRegion -- - * - * Implements the equivilent of the X window function - * XSubtractRegion. See X window documentation for more details. - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void -TkSubtractRegion( - TkRegion sra, - TkRegion srb, - TkRegion dr_return) -{ - RgnHandle srcRgnA = (RgnHandle) sra; - RgnHandle srcRgnB = (RgnHandle) srb; - RgnHandle destRgn = (RgnHandle) dr_return; - - DiffRgn(srcRgnA, srcRgnB, destRgn); -} - -/* - *---------------------------------------------------------------------- - * * TkpBuildRegionFromAlphaData -- * * Set up a rectangle of the given region based on the supplied @@ -293,34 +278,3 @@ TkpBuildRegionFromAlphaData( dataPtr += lineStride; } } - -#if 0 -int -XSetClipRectangles(Display *d, GC gc, int clip_x_origin, int clip_y_origin, - XRectangle* rectangles, int n, int ordering) -{ - RgnHandle clipRgn; - - if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type - == TKP_CLIP_REGION) { - clipRgn = (RgnHandle) ((TkpClipMask*)gc->clip_mask)->value.region; - SetEmptyRgn(clipRgn); - } else { - clipRgn = NewRgn(); /* LEAK! */ - } - - TkMacOSXCheckTmpRgnEmpty(1); - while (n--) { - int x = clip_x_origin + rectangles->x; - int y = clip_y_origin + rectangles->y; - - SetRectRgn(tkMacOSXtmpRgn1, x, y, x + rectangles->width, - y + rectangles->height); - UnionRgn(tkMacOSXtmpRgn1, clipRgn, clipRgn); - rectangles++; - } - SetEmptyRgn(tkMacOSXtmpRgn1); - TkSetRegion(d, gc, (TkRegion) clipRgn); - return 1; -} -#endif |