DISQUS

toxicsoftware.com: ‘Discrete’ NSLevelIndicatorCell too slow

  • corbin · 3 years ago
    You rock for logging this bug AND putting the link into your page. More people need to do this; it will help issues like this get fixed. thanks!
  • schwa · 3 years ago
    Thanks for the support. It shouldn't be too difficult to fix I'd imagine.

    Awesome treehouse(s) by the way.
  • Chris · 3 years ago
    License on your CCachingLevelIndicatorCell?
  • schwa · 3 years ago
    Anything I post in my public subversion repository is public domain unless stated overwise. Do with it what you will.

    I should make an exception for you though Chris… How about commercial - $1,000,000 per seat?
  • ken · 3 years ago
    I think I recognize this one..

    Try writing a subclass with this as its only implementation:

    - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
    [NSGraphicsContext saveGraphicsState];
    NSRectClip(cellFrame);
    [super drawWithFrame:cellFrame inView:controlView];
    [NSGraphicsContext restoreGraphicsState];
    }

    The issue is with CG transparency layers (see CGContextBeginTransparencyLayer). They're a nice, clean way to a bunch of drawing, then put a shadow or a focus ring on the whole thing. Problem is, when you composite a transparency layer, it'll do calculations over the whole clip. It happens that when a cell is drawn in a tableview, the only clip is to the whole table.

    That's, uh, bad.
  • schwa · 3 years ago
    Hey Ken,

    I took out my code and replaced it with your simple clipping fix.

    It certainly improved performance over the non-posed version but I think the caching version is still the fastest. Which is a shame, as your code is certainly cleaner and simpler.

    You can compare all three versions here: http://toxic-public.googlecode.com//trunk/Misc/...