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 #695: byCroppingToSquare() always return square image #696

Merged
merged 3 commits into from
May 3, 2023

Conversation

zzmasoud
Copy link
Contributor

@zzmasoud zzmasoud commented May 3, 2023

Fixed #695 by rounding down the offset calculated in:

func byCroppingToSquare() -> PlatformImage? {

The issue is all about fractional digits error (0.5), and we don't have 0.5 pixel, so it's whether 0 or 1. I decided to go with rounding down.
Now, it's guaranteed that the output image is always square.

… 'CGFloat'

The thing is that we don't have 0.5 pixel. and when the offset is calculated, it divides 1/2 which makes a 0.5 error; it' should be whether 0 or 1. So I decided to go with rounding down rule.
@kean
Copy link
Owner

kean commented May 3, 2023

I appreciate it, thanks!

@kean kean merged commit fbad184 into kean:main May 3, 2023
9 checks passed
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.

ios 11 crash
2 participants