flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
9.19k stars 899 forks source link

perf: Optimize `TexturePackerSprite` when sprites do not need to be rotated #3236

Closed gnarhard closed 2 months ago

gnarhard commented 2 months ago

Description

TexturePackerSprite creates unnecessary Transform2D and Transform2DDecorator objects when region rotation is set to false. This bloats the TexturePackerSprite object size and causes severe performance issues when using thousands of TexturePackerSprites. This PR wraps the creation of these objects in a region rotation check.

Checklist

Breaking Change?

Related Issues

gnarhard commented 2 months ago

Let's gooooo