On May 4, 2012, at 8:19 PM, Peter Teeson wrote:
> - (void)drawRect:(NSRect)dirtyRect
> {
> // Drawing code here.
> NSRect bounds = [self bounds];
> NSBezierPath *path = [NSBezierPath bezierPathWithRect:bounds];
> [path stroke];
> }
>
> In the specific case of the Cinema Display having a resolution setting of
> 1280 x 800
> the rectangle is not fully drawn every time. The top and right edges are
> missing.
Well, I don't think you're drawing what you think you are. The bounds rect is
outside of the view. It's the exterior boundary of the view. Now, when you
stroke it, assuming you haven't changed the default line width of NSBezierPath,
the stroke will be 1 point wide, half a point inside the view and half outside.
This may involve anti-aliasing or, under HiDPI, perhaps a one-pixel wide line
since that's half a point.
It's probably up to the graphics driver to decide precisely how to render that
half-point-wide line.
Generally, if you actually want to draw just within the view's bounds, you
would inset the rectangle by half the line width.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]