Skip to content
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

Merged
merged 10 commits into from
Apr 22, 2023
Merged

Conversation

lrusak
Copy link
Contributor

@lrusak lrusak commented Apr 15, 2023

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 and std::unique_ptr. This also allows us to use DecoderManager 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

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>
@lrusak lrusak added Type: Improvement non-breaking change which improves existing functionality Component: Build v21 Omega labels Apr 15, 2023
@lrusak lrusak added this to the Omega 21.0 Alpha 2 milestone Apr 15, 2023
Copy link
Member

@neo1973 neo1973 left a 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 🙂

Comment on lines +53 to +54
frame.rgbaImage.pixels.resize(frameSize);
memcpy(frame.rgbaImage.pixels.data(), extractedFrames[i]->m_pImage, frameSize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

Copy link
Contributor Author

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.

@lrusak lrusak merged commit 63cb92e into xbmc:master Apr 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Build Type: Improvement non-breaking change which improves existing functionality v21 Omega
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants