Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solved: slow drawRect not displaying correctly



Some graphical output of my scientific application draws many objects (mostly NSBezierPath's) in an NSView subclass within the drawRect method. It all works fine until the number of objects gets too large. When it is too large, some symptoms are:

1. Changing plot data and using [plotView setNeedsDisplay:YES] does indeed result in drawRect being called, but the plot does not change. Problems common when more than 2000 objects to draw.


[snip]

I remembered I had a similar problem before. I was plotting by setting the view bounds to match the bounds of the coordinates of my data. The problem I had before, which is the same problem here, is that Cocoa's NSView breaks if the view units from the frame per pixel gets less than about 0.0025 (or extent of bounds about 1 for a view with a frame width of 400 pixels). These scientific calculations were for a nano-scale device and thus had very small coordinates. I solved the problem by drawing my plot in micron or nanometer units instead of the previous millimeter units.

---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/nairn.php (under construction)
FEA/MPM Web Page: http://oregonstate.edu/~nairnj



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.