Re: Slow horizontal scrolling w/NSMutableAttributedStrings
Re: Slow horizontal scrolling w/NSMutableAttributedStrings
- Subject: Re: Slow horizontal scrolling w/NSMutableAttributedStrings
- From: "John H. Lee" <email@hidden>
- Date: Thu, 26 May 2005 10:08:05 -0700
copiesOnScroll didn't do the trick. 24 hours and several pots of
coffee later, I'm pre-rendering the attributed strings into an
NSImage and displaying the image in a scroll view. This makes for
*very* quick scrolling!
Thanks to Bob and everyone else who offered help.
-J
On May 25, 2005, at 5:10 AM, Robert Clair wrote:
Your problem is probably that scrolling horizontally triggers
layout on all 30 strings at once. Since you have only a few
characters, GACT with some background colors, in (I presume) a mono-
spaced font and a very simple layout that you know in advance, you
could make your own "sequence string" object that keeps its string
data and draws itself by sequentially copying the pixel
representation of the characters to the screen. You would want to
keep track of the visible region and only actually draw what is
visible. It's not as easy as drawing an attributed string but it's
not really that much work.
Another thing to check (although I'd guess that the layout business
is your problem) is that the clip view of your scroll view has
copiesOnScroll set to YES. There was some problem with this on 10.2
when I started but I don't remember whether it didn't want to copy
on a pure horizontal scroll or whether it was a scroll with both a
horizontal and vertical component where it gave up. (I hate scroll
bars and a was making a "hand" tool to drag the view around.) I
wound up doing the pixel copy and redraw of the exposed areas
myself (which *is* a pain to do without artifacts).
You can check this by overriding the drawRect: routine of the clip
view and logging the rect argument to see what is getting redrawn
(or use QuartzDebug).
......Bob Clair
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40berkeley.edu
This email sent to email@hidden
--
John H. Lee
Berkeley Phylogenomics Group
http://phylogenomics.berkeley.edu
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden