mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
(NSContainsRect): Return NO if the second rect is empty. (NSIntegralRect): Calculate new width and height correctly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18258 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7fce9c8ad0
commit
8041f0f996
3 changed files with 18 additions and 9 deletions
|
@ -1,3 +1,11 @@
|
|||
2003-12-06 12:34 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Headers/Foundation/NSGeometry.h (NSContainsRect): Return NO
|
||||
if bRect is empty.
|
||||
|
||||
* Source/NSGeometry.m (NSIntegralRect): Calculate the new width
|
||||
and height correctly.
|
||||
|
||||
2003-12-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSObject.m: Fix error setting sigpipe handling where
|
||||
|
|
|
@ -276,7 +276,7 @@ NSInsetRect(NSRect aRect, float dX, float dY)
|
|||
|
||||
/* Divides ARECT into two rectangles (namely SLICE and REMAINDER) by
|
||||
* "cutting" ARECT---parallel to, and a distance AMOUNT from the edge
|
||||
v * of ARECT determined by EDGE. You may pass 0 in as either of SLICE or
|
||||
* of ARECT determined by EDGE. You may pass 0 in as either of SLICE or
|
||||
* REMAINDER to avoid obtaining either of the created rectangles. */
|
||||
GS_EXPORT void
|
||||
NSDivideRect(NSRect aRect,
|
||||
|
@ -442,7 +442,8 @@ NSContainsRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
|||
GS_GEOM_SCOPE BOOL
|
||||
NSContainsRect(NSRect aRect, NSRect bRect)
|
||||
{
|
||||
return ((NSMinX(aRect) < NSMinX(bRect))
|
||||
return (!NSIsEmptyRect(bRect)
|
||||
&& (NSMinX(aRect) < NSMinX(bRect))
|
||||
&& (NSMinY(aRect) < NSMinY(bRect))
|
||||
&& (NSMaxX(aRect) > NSMaxX(bRect))
|
||||
&& (NSMaxY(aRect) > NSMaxY(bRect))) ? YES : NO;
|
||||
|
|
|
@ -82,10 +82,10 @@ NSIntegralRect(NSRect aRect)
|
|||
if (NSIsEmptyRect(aRect))
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
|
||||
rect.origin.x = floor(aRect.origin.x);
|
||||
rect.origin.y = floor(aRect.origin.y);
|
||||
rect.size.width = ceil(aRect.size.width);
|
||||
rect.size.height = ceil(aRect.size.height);
|
||||
rect.origin.x = floor(NSMinX(aRect));
|
||||
rect.origin.y = floor(NSMinY(aRect));
|
||||
rect.size.width = ceil(NSMaxX(aRect)) - rect.origin.x;
|
||||
rect.size.height = ceil(NSMaxY(aRect)) - rect.origin.y;
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue