BigZaphod / Chameleon

Chameleon is a port of Apple's UIKit for iOS (and some minimal related frameworks) to Mac OS X.
http://chameleonproject.org/
BSD 3-Clause "New" or "Revised" License
3.44k stars 569 forks source link

Fix rounding bias in UIView. #99

Open michaelmelanson opened 10 years ago

michaelmelanson commented 10 years ago

This patch set fixes a 'drifting' issue in the autoresizing logic. This behaviour is caused by the rounding bias introduced by the use of floorf function in -[UIView _superviewSizeDidChangeFrom:(CGSize)oldSize to:(CGSize)newSize].

It fixes it by keeping an internal CGRect for the UIView's frame using unrounded floats. When updating the internal CGLayer for the view, it rounds it using CGRectIntegral to prevent sub-pixel blurring when the autoresizing puts a view at non-integer coordinates.

It then removes the unnecessary calls to floorf in the autoresizing calculations.

Fixes BigZaphod/Chameleon#82.