Mailing Lists: Apple Mailing Lists

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

Re: Drawing feedback for mouse operations



On Sat, 10 Jun 2006 08:49:49, Jerry <email@hidden> wrote:

> On 10 Jun 2006, at 07:59, Mike Kluev wrote:
> 
>> On Thu, 8 Jun 2006 17:40:21, Rick Mann <email@hidden> wrote:
>> 
>>> The alternative is to store the last mouse position, set some state,
>>> ask for the view to be redrawn, and do everything in the redraw. I
>>> don't like this for any number of reasons.
>> 
>> What reasons?
>> Looks like a good approach.
> 
> Some problems with this are that it just isn't fast enough. For
> painting with the mouse we get significant lag going via the
> HIViewSetNeedsDisplay route compared to drawing directly to a
> CGContext. 

HIViewRender could help with speed, specifically with the below
two optimizations.

> More problematic is that either you have to repaint the
> whole view, which is really bad if all you're doing is modifying a
> very small part of it, or you have to save state saying which bits to
> update.

Or use HIViewSetNeedsDisplayInShape.

> If a draw event comes in for some other reason between you
> setting the state and receiving your 'own' draw event, you end up
> with a bad display.

Honestly, I don't see how; example? Besides, with explicit
HIViewRender call this is hardly a possibility.

> The main trouble with all this is that the HIView
> system is set up to support compositing of translucent views and if
> you have a large opaque view you have to jump through hoops a bit to
> get good performance.

kHIViewFeatureIsOpaque should help here (works only on rectangular
views).

> Obviously, with all the fancy Aqua controls,
> the transparent view thing is the most common case, but the size of
> things like CAD drawing areas makes it important to be more efficient
> when drawing.
> 
> We use a hybrid approach: For drawing of any selections, e.g.
> selected shape outlines, handles and so on we use an overlay and draw
> directly into it with a manually-created CGContext.

Typical approach.

> Updates to the  
> main drawing area are done via HIViewSetNeedsDisplay, but for fast
> painting, we draw directly into the view with a CGContext created in
> the mouse down handler. This works fine, but Eric has said that it's
> possible that this will break in the future, although I suspect it
> won't. We release updates often enough that we'll just fix it when
> the time comes, if ever.

Mike

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

This email sent to email@hidden

References: 
 >Re: Drawing feedback for mouse operations (From: Jerry <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.