Skip to content

[flame_texturepacker] make Region immutable #3644

@gnarhard

Description

@gnarhard

What could be improved

The Region class should be immutable and all redundant fields in TexturePackerSprite should be removed. WIP: perf/immutable_region_data

https://github.com/gnarhard/flame/tree/perf/immutable_region_data

This _parse method is also not the friendliest to read. I think there could be some improvement there too.

Why should this be improved

I've already confirmed that this will reduce TexturePackerSprite memory consumption by ~50%. These fields that are in the TexturePackerSprite class that I've removed are redundant and already stored in the region data. My branch removes all of that code that shouldn't be mutated anyways, and makes Region immutable. However, I'm hung up on the tests and need help here.

_parse method could be improved to be easier to read and maintain.

Risks

This will be a breaking change. Currently, I don't have access to the texture pack files in the testing environment. Each field needs to be set every time, but since I don't have access to the texture pack save files, I can't check and see which algorithm is being used to update the atlas files accordingly.

More information

No response

Other

  • Are you interested in working on a PR for this?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions