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

Fixed linear_gradient and radial_gradient I and F modes #5274

Merged
merged 1 commit into from Mar 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Feb 19, 2021

Resolves #5272

Image.linear_gradient("I"), Image.linear_gradient("F"), Image.radial_gradient("I") and Image.radial_gradient("F") all currently segfault. This fixes them.

@radarhere radarhere added the Bug Any unexpected behavior, until confirmed feature. label Feb 19, 2021
@radarhere radarhere changed the title Fixed linear_gradient I mode Fixed linear_gradient and radial_gradient I mode Feb 22, 2021
@radarhere radarhere changed the title Fixed linear_gradient and radial_gradient I mode Fixed linear_gradient and radial_gradient I and F modes Feb 22, 2021
int x;
for (y = 0; y < 256; y++) {
for (x = 0; x < 256; x++) {
if (im->type == IMAGING_TYPE_FLOAT32) {
Copy link
Member

Choose a reason for hiding this comment

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

Does refactoring this check outside the 256 * 256 loop make any sort of performance difference?

Copy link
Member

Choose a reason for hiding this comment

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

Branch prediction should be bang on for this one. And I'd even expect that the compiler would hoist this.

@wiredfool wiredfool merged commit 9a683db into python-pillow:master Mar 28, 2021
@radarhere radarhere deleted the gradient branch March 28, 2021 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault when creating gradient images with mode "F"
3 participants