mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:10:48 +00:00
* Source/NSBezierPath.m (-appendBezierPathWithRoundedRect:xRadius:yRadius:):
Small rearangment of code. Patch by Fred Morcos <fred.morcos@gmail.com> git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28254 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
345f77f374
commit
70fe7f2bb0
2 changed files with 22 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-04-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSBezierPath.m (-appendBezierPathWithRoundedRect:xRadius:yRadius:):
|
||||
Small rearangment of code.
|
||||
Patch by Fred Morcos <fred.morcos@gmail.com>
|
||||
|
||||
2009-04-25 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSBezierPath.h,
|
||||
|
|
|
@ -1193,18 +1193,31 @@ typedef struct _PathElement
|
|||
{
|
||||
NSPoint startp, endp, controlp1, controlp2, topLeft, topRight, bottomRight;
|
||||
|
||||
xRadius = MIN(xRadius, aRect.size.width);
|
||||
yRadius = MIN(yRadius, aRect.size.height);
|
||||
xRadius = MIN(xRadius, aRect.size.width / 2.0);
|
||||
yRadius = MIN(yRadius, aRect.size.height / 2.0);
|
||||
|
||||
if (xRadius == 0.0 || yRadius == 0.0)
|
||||
{
|
||||
[self appendBezierPathWithRect: aRect];
|
||||
return;
|
||||
}
|
||||
|
||||
topLeft = NSMakePoint(NSMinX(aRect), NSMaxY(aRect));
|
||||
topRight = NSMakePoint(NSMaxX(aRect), NSMaxY(aRect));
|
||||
bottomRight = NSMakePoint(NSMaxX(aRect), NSMinY(aRect));
|
||||
|
||||
startp = NSMakePoint(topLeft.x + xRadius, topLeft.y);
|
||||
endp = NSMakePoint(topLeft.x, topLeft.y - yRadius);
|
||||
controlp1 = NSMakePoint(startp.x - (KAPPA * xRadius), startp.y);
|
||||
controlp2 = NSMakePoint(endp.x, endp.y + (KAPPA * yRadius));
|
||||
[self moveToPoint: startp];
|
||||
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
|
||||
|
||||
startp = NSMakePoint(aRect.origin.x, aRect.origin.y + yRadius);
|
||||
endp = NSMakePoint(aRect.origin.x + xRadius, aRect.origin.y);
|
||||
controlp1 = NSMakePoint(startp.x, startp.y - (KAPPA * yRadius));
|
||||
controlp2 = NSMakePoint(endp.x - (KAPPA * xRadius), endp.y);
|
||||
[self moveToPoint: startp];
|
||||
[self lineToPoint: startp];
|
||||
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
|
||||
|
||||
startp = NSMakePoint(bottomRight.x - xRadius, bottomRight.y);
|
||||
|
@ -1221,13 +1234,6 @@ typedef struct _PathElement
|
|||
[self lineToPoint: startp];
|
||||
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
|
||||
|
||||
startp = NSMakePoint(topLeft.x + xRadius, topLeft.y);
|
||||
endp = NSMakePoint(topLeft.x, topLeft.y - yRadius);
|
||||
controlp1 = NSMakePoint(startp.x - (KAPPA * xRadius), startp.y);
|
||||
controlp2 = NSMakePoint(endp.x, endp.y + (KAPPA * yRadius));
|
||||
[self lineToPoint: startp];
|
||||
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
|
||||
|
||||
[self closePath];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue