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: fast blitting with Quartz




On Sep 28, 2007, at 11:35 AM, Greg Titus wrote:


On Sep 28, 2007, at 11:27 AM, Scott Thompson wrote:


On Sep 28, 2007, at 12:53 PM, Wade Tregaskis wrote:

I suppose should be no problem to letting the size of the view grow to infinity - as long as I'm not drawing any more of it. I guess I just have to get over the mental hurdle.

Note that there is a practical limit to the size of an NSView, beyond which all sorts of funkiness occurs (visible as drawing artefacts) as a consequence of CoreGraphics using floats, and thus having very much finite precision. It depends on your particular code as to when exactly you'll see problems, but I wouldn't let any view (inside a scrollview) get more than 10,000,000 pixels in any dimension.


(I know that sounds huge, but it's pretty easy to naively hit if you're not careful)

Are you sure about the magnitude of your dimension there? I was under the impression (potentially mistaken) that the problems started around 10,000 (ten thousand) instead of 10,000,000 (10 million).

Nope, it's somewhat less than 10 million but much much larger than 10 thousand. That's about the point where the "float" type no longer has enough precision to represent individual pixels.


An IEEE binary float has 1 bit of sign, 8 bits of exponent, and 23 bits of fractional value. Which means you should be able to exactly represent pixel values between +8,388,608 and -8,388,608. (2^23)

Oops! My mistake. I forgot that the first bit of the fractional value is assumed and is always 1. So you can actually accurately represent individual pixels up to 2^24: 16.7 million.


	- Greg
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >fast blitting with Quartz (From: Kenny Leung <email@hidden>)
 >Re: fast blitting with Quartz (From: Greg Titus <email@hidden>)
 >Re: fast blitting with Quartz (From: Kenny Leung <email@hidden>)
 >Re: fast blitting with Quartz (From: Wade Tregaskis <email@hidden>)
 >Re: fast blitting with Quartz (From: Scott Thompson <email@hidden>)
 >Re: fast blitting with Quartz (From: Greg Titus <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.