Skip to content

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