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 bug: Rotated UIImage lose origin scale and blured. #904

Merged
merged 8 commits into from
Sep 22, 2020
Merged

fix bug: Rotated UIImage lose origin scale and blured. #904

merged 8 commits into from
Sep 22, 2020

Conversation

unknown-undefined
Copy link
Contributor

Fix bug. When UIImage rotated, it lost origin scale.

Checklist

  • I checked the Contributing Guidelines before creating this request.
  • New extensions are written in Swift 5.0.
  • New extensions support iOS 10.0+ / tvOS 9.0+ / macOS 10.10+ / watchOS 2.0+, or use @available if not.
  • I have added tests for new extensions, and they passed.
  • All extensions have a clear comments explaining their functionality, all parameters and return type in English.
  • All extensions are declared as public.
  • I have added a changelog entry describing my changes.

@codecov
Copy link

codecov bot commented Sep 15, 2020

Codecov Report

Merging #904 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #904   +/-   ##
=======================================
  Coverage   95.39%   95.39%           
=======================================
  Files         100      100           
  Lines        3626     3626           
=======================================
  Hits         3459     3459           
  Misses        167      167           
Flag Coverage Δ
#ios 95.43% <ø> (ø)
#macos 97.09% <ø> (ø)
#tvos 57.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/SwifterSwift/UIKit/UIImageExtensions.swift 83.06% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00d8f3e...0039a22. Read the comment docs.

@SwifterSwiftBot
Copy link

SwifterSwiftBot commented Sep 15, 2020

1 Warning
⚠️ Consider adding tests for new extensions or updating existing tests for a modified SwifterSwift extension
1 Message
📖 Thank you for submitting a pull request to SwifterSwift. The team will review your submission as soon as possible.

Generated by 🚫 Danger

Copy link
Contributor

@guykogus guykogus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a CHANGELOG entry and perhaps update the tests

guykogus and others added 2 commits September 17, 2020 10:54
* fix UIImage rotated(by:) lose origin scale
* add change log
@unknown-undefined
Copy link
Contributor Author

CHANGELOG entry is added, all tests is OK and passed.

Copy link
Member

@LucianoPAlmeida LucianoPAlmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks :)

Copy link
Contributor

@guykogus guykogus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally strongly dislike the /*opaque*/ comments, but 🤷‍♂️

@LucianoPAlmeida
Copy link
Member

I personally strongly dislike the /*opaque*/ comments, but 🤷‍♂️

Ahh feel free to request changes, I personally find useful for literals and use a lot at work with C++ because functions don't have labels there, so we use this pattern to make it easier to read at call site what the parameter means e.g. p->function(param, /*argument=*/nullptr) ...
But feel free to revert ... it's not that important

@Yanpanpan it is good to go can you just revert this so we can merge? :)

Copy link
Contributor

@guykogus guykogus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok fine, let's get rid of it...

@@ -139,7 +139,7 @@ public extension UIImage {
width: destRect.width.rounded(),
height: destRect.height.rounded())

UIGraphicsBeginImageContext(roundedDestRect.size)
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, /*opaque=*/false, scale)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, /*opaque=*/false, scale)
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, false, scale)

@@ -169,7 +169,7 @@ public extension UIImage {
width: destRect.width.rounded(),
height: destRect.height.rounded())

UIGraphicsBeginImageContext(roundedDestRect.size)
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, /*opaque=*/false, scale)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, /*opaque=*/false, scale)
UIGraphicsBeginImageContextWithOptions(roundedDestRect.size, false, scale)

@unknown-undefined
Copy link
Contributor Author

I personally strongly dislike the /*opaque*/ comments, but 🤷‍♂️

Ahh feel free to request changes, I personally find useful for literals and use a lot at work with C++ because functions don't have labels there, so we use this pattern to make it easier to read at call site what the parameter means e.g. p->function(param, /*argument=*/nullptr) ...
But feel free to revert ... it's not that important

@Yanpanpan it is good to go can you just revert this so we can merge? :)

I personally think removing /*opaque*/ looks more SwifterSwift. Thanks everyone. Revert is done.

Copy link
Member

@LucianoPAlmeida LucianoPAlmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@guykogus guykogus merged commit 7838df7 into SwifterSwift:master Sep 22, 2020
@SD10
Copy link
Member

SD10 commented Sep 22, 2020

Thank you for contributing to SwifterSwift! I've invited you to join the SwifterSwift GitHub organization - no pressure to accept! If you'd like more information on what that means, check out our contributing guidelines. Feel free to reach out if you have any questions! 😃

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.

5 participants