NSClipView and ATSUI drawing
NSClipView and ATSUI drawing
- Subject: NSClipView and ATSUI drawing
- From: Brian Webster <email@hidden>
- Date: Tue, 18 Jun 2002 15:04:37 -0500
I have a view that draws its contents by using ATSUI's drawing
functions via a CGContext(). The view is within a scroll view,
and I've been having trouble doing optimized drawing in my view.
When the copiesOnScroll flag is set on the clip view, it only
asks for the document view to redraw the newly exposed portion
of itself when it scrolls. In my drawRect: routine, I make sure
to only draw the portion of the view that is asked for.
However, when I scroll my view, the text that is rendered in it
is redrawn over itself each time the view is scrolled, so it
gets darker and darker as you scroll down.
I thought that filling the rectangle with the background color
before drawing each time would fix the problem, since I would
then be drawing on a plain background rather than redrawing over
the previously drawn text. I tried this (using NSRectFill) with
larger and larger rectangles until I just ended up filling the
entire bounds of the document view, but this didn't make any
difference.
My only guess to this behavior is that there is a clipping
region set up that prevents my rectangle filling from affecting
anything but the newly exposed rectangle, but that ATSUI does
not respect this clipping region and draws its text regardless.
I even tried adding a call to CGContextClip() to clip drawing in
the CGContext to the exposed rectangle, but this had no effect.
Of course if I turn the copiesOnScroll flag off, everything
works fine, but the scrolling is noticeably slower since it's
doing more redrawing.
So, I was wondering if anyone could confirm that this is the
reason for this behavior or if there's something I might be
missing. Oh yeah, a workaround for it would be nice, too.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.