-
-
Notifications
You must be signed in to change notification settings - Fork 889
Now throws a better excpetion DrawImage source does not overlap target #877
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
Merged
JimBobSquarePants
merged 6 commits into
SixLabors:master
from
atruskie:fix-draw-image-non-overlapping
Apr 30, 2019
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dd0b2a7
No longer throws when DrawImage source does not overlap target
atruskie 4411ddd
Refines DrawImage non-overlap error logic
atruskie 541da0e
Non-overlapping DrawImage now throws
atruskie c5ab42b
DrawImage overlap test changed to support RELEASE
atruskie 21e1edc
Adress feedback for DrawImage exception
atruskie e586cc1
Merge branch 'master' into fix-draw-image-non-overlapping
JimBobSquarePants File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, we only use
Guardfor trivial argument validation at the beginning of the methods.I think this is what we should do:
ImageProcessingExceptionif the condition is not matchedImageProcessor<T>.Apply(...)we should detect (catch and rethrow)ImageProcessingException@dlemstra @JimBobSquarePants thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check is superfluous and the errors in
ParallelHelper.ValidateRectangleshould beArgumentOutOfRangeExceptionviaGuard.MustBeGreaterThan.We already capture the inner exception and throw an
ImageProcessingExceptionin release mode.@atruskie sorry to be messing you around here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment was actually addressing a concern from @atruskie:
However, the more I think about fixing this, the further it leads, so let's not waste time on it in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antonfirsov I've followed your advice here already, and it leads to a nicer test.
@JimBobSquarePants I'd like to leave both errors in because they represent different types of error. One is descriptive for a user mistake. The other, in IterRows, really is exceptional and represents that that code should never have been called with the given argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m trying to avoid as much as possible, per-processor error handling. A negative rectangle would cause an error in many places and multiple handlers would have to be added.
I do wonder whether we should be using Recangle.Intersect to avoid the possibility as we do in several places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't see this last message before I pushed.
I feel like I'm not doing a good job at understanding what you'd like. The options:
I'm happy to keep making changes until I get this right :-) , it just feels a little like walking in circles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect I think you're doing the correct thing for now with the API we have. I'm going to update and merge this. Thanks for your help! 😄