Are you trying to have selectable text?
If not, NSImage has a nice API for drawing to the image context. Then you just 
have an NSImage. Let AppKit do the work. It will cache the drawing of that 
image until you change it. 
You can assign that to a layer or use one for each string. 

+ (NSImage *)imageWithSize:(NSSize)size
                   flipped:(BOOL)drawingHandlerShouldBeCalledWithFlippedContext
            drawingHandler:(BOOL (^)(NSRectdstRect))drawingHandler

Sent from my iPhone

> On Sep 29, 2015, at 6:11 AM, Ben <ben_cocoa_dev_l...@yahoo.co.uk> wrote:
> 
> 
>> On 28 Sep 2015, at 17:08, Jens Alfke <j...@mooseyard.com> wrote:
>> 
>> 
>>> On Sep 28, 2015, at 1:41 AM, Ben <ben_cocoa_dev_l...@yahoo.co.uk 
>>> <mailto:ben_cocoa_dev_l...@yahoo.co.uk>> wrote:
>>> 
>>> When scrolling vertically, there could be up to 100,000 strings to be 
>>> drawn, horizontally, much fewer, less than 10,000. I'm assuming a maximum 
>>> grid size of 100 columns and 10k rows. This should be a worst-case 
>>> assumption.
>> 
>> As various people have said, there is no reason to draw any text that’s 
>> outside the dirtyRect passed to your -drawRect: call. So you never need to 
>> draw 100k strings at once. I’m confused by your statements in this thread ― 
>> you do say that you abide by the dirtyRect, so why are you drawing so many 
>> strings?
>> 
>>> Unfortunately NSTableView doesn't offer the type of interactions I want. I 
>>> have filed a radar requesting enhancements.
>> 
>> It’s very customizable. What’s missing for you?
> 
> I am sorry for the poor explanations. I hope this clears up my phrasing:
> 
> I am only drawing the area requested by the dirtyRect parameter.
> I mention the large number of strings since when scrolling I am being asked 
> to draw a larger number of dirtyRect blocks in quick succession. This means a 
> correspondingly larger number of strings to be drawn.
> 
> True, they are not all in the same drawRect call, but in sufficiently close 
> proximity that I thought speeding up the largest consumer of cpu time (ie. 
> string drawing) would help the improve the scroll lag.
> 
> 
> The biggest thing missing for me in NSTableView is single-cell selection and 
> highlighting. There was also a drawing bug which I filed a radar for. 
> 
> 
> ―
> 
> Thank you all for the suggestions though, I will try each of them.
> 
> _______________________________________________
> 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com
_______________________________________________

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

Reply via email to