diff options
author | das <das> | 2007-05-30 06:35:54 (GMT) |
---|---|---|
committer | das <das> | 2007-05-30 06:35:54 (GMT) |
commit | e37ef892e06f50859941c35f85b7f07ce98d756e (patch) | |
tree | d698fa040408e94632aa7a89b0599efb12078dfb /macosx/tkMacOSXRegion.c | |
parent | eea3d8a589c007592691cf767336a06b0f600c50 (diff) | |
download | tk-e37ef892e06f50859941c35f85b7f07ce98d756e.zip tk-e37ef892e06f50859941c35f85b7f07ce98d756e.tar.gz tk-e37ef892e06f50859941c35f85b7f07ce98d756e.tar.bz2 |
* macosx/tkMacOSXMenu.c (DrawMenuSeparator): use DrawingContext API.
* macosx/tkMacOSXWindowEvent.c (ClearPort): clip to updateRgn.
* macosx/tkMacOSXDebug.c: factor out debug region flashing.
* macosx/tkMacOSXDebug.h:
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXEvent.c: cleanup whitespace and formatting.
* macosx/tkMacOSXFont.c:
* macosx/tkMacOSXRegion.c:
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXXStubs.c:
* xlib/xgc.c:
* macosx/Wish.xcodeproj/project.pbxproj: delete references to removed
* macosx/Wish.xcodeproj/default.pbxuser: ttk files.
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 |