32blit / 32blit-sdk

32blit SDK
https://32blit.com
MIT License
197 stars 69 forks source link

Add Surface::get_pixel and remove special case from blit code #828

Closed Daft-Freak closed 1 year ago

Daft-Freak commented 1 year ago

After repeating my "blit that is actually a fill" optimisation for the third time, I worked out a way to avoid it entirely and improve TileMap perf a bit. Also adds a useful get_pixel method to Surface (returns the pixel converted to a Pen).

I haven't benchmarked the change to stretch_blit, but I'd expect a similar effect there.

(Making the blit code smaller is also a good thing for the firmware)

Gadgetoid commented 1 year ago

Wow, I can't even wrap my brain around what the edge case was doing and why, but it was... janky 😬

Thanks!