simplify curve algorithm,

git-svn-id: svn://qnap.local/TwoTerm/branches/frameless@2337 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
Kelvin Sherlock 2011-11-26 17:03:57 +00:00
parent 9a349b50fb
commit 3a137ea153

View File

@ -26,16 +26,27 @@
_color = [[NSColor blackColor] retain];
}
/*
-(BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
return YES;
}
*/
#define curveSize 4
#define curveSize 5
- (void)drawRect:(NSRect)dirtyRect {
NSGraphicsContext *nsgc = [NSGraphicsContext currentContext];
CGContextRef ctx = [nsgc graphicsPort];
//NSGraphicsContext *nsgc = [NSGraphicsContext currentContext];
//CGContextRef ctx = [nsgc graphicsPort];
NSRect bounds = [self bounds];
//[super drawRect: dirtyRect];
#if 0
[[NSColor clearColor] setFill];
NSRectFill(dirtyRect);
[_color setFill];
@ -58,6 +69,25 @@
CGContextAddQuadCurveToPoint(ctx, 0, 0, 0, curveSize);
CGContextFillPath(ctx);
#else
NSBezierPath *path;
[[NSColor clearColor] set];
NSRectFill(dirtyRect);
path = [NSBezierPath bezierPathWithRoundedRect:bounds xRadius: curveSize yRadius: curveSize];
[path addClip];
//path = [NSBezierPath bezierPathWithRect: dirtyRect];
//[path addClip];
[_color set];
NSRectFill(dirtyRect);
#endif
}