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

Created method for slicing ROI into tiles, for use inside AsyncEffectRenderer #983

Merged
merged 8 commits into from
Sep 21, 2024

Conversation

Lehonti
Copy link
Contributor

@Lehonti Lehonti commented Sep 21, 2024

This should get us a step closer towards handling parallelism inside the effects themselves, as discussed in #808

{ }
}

public static IEnumerable<RectangleI> VerticalSliceup (this RectangleI original)
Copy link
Member

Choose a reason for hiding this comment

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

The naming is a bit confusing to me, since it makes me think of slicing into vertical columns.
Perhaps something like ToRows() or GenerateRows() etc?

This could also just be a method on RectangleI similar to other methods like Inflate - not sure this really needs to be an extension

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is now named ToRows

if (tileWidth < 0) throw new ArgumentOutOfRangeException (nameof (tileWidth), "Cannot be negative");
if (tileHeight < 0) throw new ArgumentOutOfRangeException (nameof (tileHeight), "Cannot be negative");
if (renderBounds.Width < 0) throw new ArgumentException ("Width cannot be negative", nameof (renderBounds));
if (renderBounds.Height < 0) throw new ArgumentException ("Cannot be negative", nameof (renderBounds));
Copy link
Member

Choose a reason for hiding this comment

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

The message should say Height cannot be negative

TileWidth = tileWidth;
TileHeight = tileHeight;

// If the effect isn't tileable, there is a single tile for the entire render bounds.
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't really make sense here - maybe it should be lower down around the call to VerticalSliceup()?


try {

bounds = GetTileBounds (tileIndex);
bounds = target_tiles[tileIndex]; // Get tile bounds
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't really need to be in the try/catch block anymore

@Lehonti
Copy link
Contributor Author

Lehonti commented Sep 21, 2024

Thank you for the feedback @cameronwhite, I have addressed your points

@cameronwhite cameronwhite merged commit 2728dc4 into PintaProject:master Sep 21, 2024
5 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.

2 participants