Antialias在调用setNeedsDisplayInRect时绘制一条额外的行

时间:2012-07-10 15:51:58

标签: objective-c cocoa quartz-graphics

以下代码在视图上按下鼠标时绘制了一条额外的行。这似乎是抗原造成的。有没有人见过这个?

Sample Image

- (void) drawRect:(NSRect)dirtyRect
{
    [[NSColor whiteColor] setFill];
    NSRectFill(dirtyRect);


    [[NSColor blueColor] setStroke];

    NSBezierPath *path1 = [NSBezierPath bezierPath];
    [path1 moveToPoint:NSMakePoint(0.00, 9.00)];
    [path1 lineToPoint:NSMakePoint(300.00, 8.00)];
    [path1 stroke];


    [[NSColor redColor] setStroke];

    NSBezierPath *path2 = [NSBezierPath bezierPath];
    [path2 moveToPoint:NSMakePoint(184.00, 15.00)];
    [path2 lineToPoint:NSMakePoint(8.00, 159.00)];
    [path2 stroke];
}

- (void) mouseDown:(NSEvent *)theEvent
{
    [super mouseDown:theEvent];

    [self setNeedsDisplayInRect:CGRectMake(0, 0, 369, 15)];
}

0 个答案:

没有答案