Support ImageFilter.BuiltinFilter for I;16* images by radarhere · Pull Request #8438 · python-pillow/Pillow
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a function instead?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason?
This was copying
| #define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F)) |
and
| #define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F)) |
If there's a reason to prefer functions, then maybe they should all be changed.
I'd suggest a common function for all three, except that this uses a float and those other two use double.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions are generally safer than macros, which need extra care around parentheses and don't get extra checking. But if this is a copy/paste of existing ones then we should be fine.