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

Grouped coordinates in point structs #576

Merged
merged 4 commits into from
Oct 17, 2023
Merged

Grouped coordinates in point structs #576

merged 4 commits into from
Oct 17, 2023

Conversation

Lehonti
Copy link
Contributor

@Lehonti Lehonti commented Oct 15, 2023

In LivePreviewManager and AsyncEffectRenderer

@cameronwhite
Copy link
Member

It seems like these points are describing a rectangle, so maybe just go all the way to using a RectangleI instead?

@Lehonti
Copy link
Contributor Author

Lehonti commented Oct 16, 2023

Sure, good idea.

There is probably an off-by-one error in the original code (see line 321 of AsyncEffectRenderer, where bounds is assigned), so I changed that a little.

updated_x2 = Math.Max (bounds.X bounds.Width, updated_x2);
updated_y2 = Math.Max (bounds.Y bounds.Height, updated_y2);
updated_area = RectangleI.FromLTRB (
left: Math.Min (bounds.X, updated_area.X),
Copy link
Member

Choose a reason for hiding this comment

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

I think this is now just equivalent to RectangleI.Union()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I didn't know this method already existed. I've updated the code accordingly

updated_y1 = bounds.Y;
updated_x2 = bounds.X bounds.Width;
updated_y2 = bounds.Y bounds.Height;
updated_area = new (
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be updated_area = bounds ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for noticing this, I've now shortened the code according to your suggestion

@cameronwhite cameronwhite merged commit df3f868 into PintaProject:master Oct 17, 2023
5 checks passed
@Lehonti Lehonti deleted the improvement1 branch October 17, 2023 23:19
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.

2 participants