I have subclassed a NSView and placed it within a window. In this NSView I have to align my NSBezier rect to the pixel grid and stroke a perfect and aligned 1 pixel width rect. So, in the documentView's drawRect: method, I do [[NSGraphicsContext currentContext] setShouldAntialias:NO]; [NSBezierPath setDefaultLineWidth:0.0]; NSRect anyRect = NSMakeRect(50, 113.25, 110, 70.5); NSRect alignedRect = [self backingAlignedRect:anyRect options:NSAlignAllEdgesInward]; [NSBezierPath strokeRect:alignedRect]; It works when the clipView's is not magnified (scale 1:1), but if I magnify the view calling [self scaleUnitSquareToSize:NSMakeSize(scaleFactor, scaleFactor)]; from within the magnifyWithEvent: method, I get, sometimes, a 2 width pixels line (wrong!). Is it a bug or do I miss something? For instance, when the view's mScaleFactor is 5.057041 (frame.size / bounds.size), I get a 2 pixels width line (wrong), and I get this log mScaleFactor 5.057041; anyRect 50.000000, 113.250000, 110.000000, 70.500000 alignedRect 50.063373, 113.390257, 109.747964, 70.199148 My screen is not retina. My screen's DPI is 133. Any solution will be welcome.
Regards -- Leonardo _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com