mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2024-09-27 08:54:24 +00:00
simplify curve algorithm,
git-svn-id: svn://qnap.local/TwoTerm/branches/frameless@2337 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
parent
9a349b50fb
commit
3a137ea153
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user