From 3a137ea1537f3ceaf6b87a730b651b18923b0707 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 26 Nov 2011 17:03:57 +0000 Subject: [PATCH] simplify curve algorithm, git-svn-id: svn://qnap.local/TwoTerm/branches/frameless@2337 5590a31f-7b70-45f8-8c82-aa3a8e5f4507 --- Views/CurveView.m | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/Views/CurveView.m b/Views/CurveView.m index 0d08718..991f7f9 100644 --- a/Views/CurveView.m +++ b/Views/CurveView.m @@ -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 }