diff options
author | das <das> | 2007-05-30 06:39:37 (GMT) |
---|---|---|
committer | das <das> | 2007-05-30 06:39:37 (GMT) |
commit | 354d7ea3b9178402bf28ae063c5e62f647f7d087 (patch) | |
tree | bbd79c7a2b425288ac6c592cd05b8613c3dbdfd7 /macosx/tkMacOSXRegion.c | |
parent | 48d6dbc41b0b9cd9e07d7ad699bd0e90a90424c7 (diff) | |
download | tk-354d7ea3b9178402bf28ae063c5e62f647f7d087.zip tk-354d7ea3b9178402bf28ae063c5e62f647f7d087.tar.gz tk-354d7ea3b9178402bf28ae063c5e62f647f7d087.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:
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 c64a45d..8bf2a6f 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.2.2.3 2007/04/29 02:26:50 das Exp $ + * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.2.2.4 2007/05/30 06:39:38 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,74 +210,11 @@ 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; rect_return->height = rect.bottom-rect.top; } - -/* - *---------------------------------------------------------------------- - * - * 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); -} - -#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 |