-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TexturePacker: first pass at modernization #23150
Conversation
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
we can now use RAII style alloc/dealloc for the image data with std::vector Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, only one small suggestion to get rid of a memcpy
. Feel free to ignore it if you had planned this for a later PR 🙂
frame.rgbaImage.pixels.resize(frameSize); | ||
memcpy(frame.rgbaImage.pixels.data(), extractedFrames[i]->m_pImage, frameSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frame.rgbaImage.pixels.resize(frameSize); | |
memcpy(frame.rgbaImage.pixels.data(), extractedFrames[i]->m_pImage, frameSize); | |
frame.rgbaImage.pixels.assign(extractedFrames[i]->m_pImage, | |
extractedFrames[i]->m_pImage + frameSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Yes I have another comkit for the next PR that changes m_pImage to be a vector also.
This is a first pass at modernizing TexturePacker. I have a large string of commits but wanted to break up the PR's to allow for easier reviewing.
This mostly changes allocation/deletions to use
std::vector
andstd::unique_ptr
. This also allows us to useDecoderManager
as a proper class and use RAII to allocate resources.The created
addons/skin.estuary/media/Textures.xbt
file has the same sha256sum before and after this PR.What is the effect on users?
None, purely code cleanup