pygame icon indicating copy to clipboard operation
pygame copied to clipboard

Investigate speeding up `pygame.transform.scale_by`

Open Starbuck5 opened this issue 3 years ago • 2 comments
trafficstars

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)

Starbuck5 avatar Jul 16 '22 17:07 Starbuck5

I'd like to assign @itzpr3d4t0r to this.

Starbuck5 avatar Jul 16 '22 17:07 Starbuck5

I'll have the honor!

itzpr3d4t0r avatar Jul 16 '22 18:07 itzpr3d4t0r