Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rounding bias in UIView. #99

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix rounding bias in UIView. #99

wants to merge 2 commits into from

Conversation

michaelmelanson
Copy link

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 #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin resize mask not working properly
1 participant