pygame
pygame copied to clipboard
Investigate speeding up `pygame.transform.scale_by`
When I wrote scale_by and smoothscale_by, I made them call the corresponding scale and smoothscale by creating a python arguments tuple in the c code, and then calling the other function in C code.
It would likely be faster to not have to convert from Python args to C variables back to Python args back to C variables, rather parsing into C once and staying at that level.
Relevant code: https://github.com/pygame/pygame/blob/main/src_c/transform.c#L524-L625, https://github.com/pygame/pygame/blob/main/src_c/transform.c#L1471-L1585
Basically the idea is to make a C function common backend (takes two surfaces and a size probably?) that both scale_by and scale can send C arguments too, which should speed up scale_by. (Same with smoothscale)
I'd like to assign @itzpr3d4t0r to this.
I'll have the honor!