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 10 Jun 2006, at 19:59, Mike Kluev wrote:

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.

The comments in the header file for HIViewRender make me shy away from this approach. Also, I'm not sure what this will be doing that makes it different from acquiring your own CGContext and just drawing into it. (What I mean here, is that we've been told that creating a CGContext for mouse tracking is unsupported, but I just bet that's what HIViewRender is doing).


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.

I admit it's unlikely to happen, although it happens a lot with Java applications which have a similar mechanism. Although this doesn't apply so much to mouse tracking, if you have some sort of animation going and the user resizes the window this can happen.


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).

Yes, it's very important to call this for big rectangular drawing areas.

Jerry

_______________________________________________
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: Mike Kluev <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.