Skip to content
Snippets Groups Projects
Commit 6a4b84d2 authored by Oleg Lyovin's avatar Oleg Lyovin
Browse files

bootanimation: do not create texture for parts with count=1


When bootanimation contains part that is played only once,
there is no need to create a separate texture for its frames.

Such an approach allows to reduce memory consumption for
typical use case of such an animations, when a part
consists of a lot of frames played only once.

Actually, it was already implemented earlier, but part of it
was lost in 'd711ac48'.
Moreover, the remained part leads to memory leak in
current implementation on BootAnimation.cpp:1712.

Test: play bootanimation with part.count=1 and a lot of
frames, and check memory consumption.

Change-Id: If3a0fa890f6f9e7abc0db2fe96b5635a1663fb8a
Signed-off-by: default avatarOleg Lyovin <ovlevin@sberdevices.ru>
parent ce749aa5
No related branches found
No related tags found
No related merge requests found
......@@ -1525,6 +1525,7 @@ bool BootAnimation::playAnimation(const Animation& animation) {
for (size_t i=0 ; i<pcount ; i++) {
const Animation::Part& part(animation.parts[i]);
const size_t fcount = part.frames.size();
glBindTexture(GL_TEXTURE_2D, 0);
// Handle animation package
if (part.animation != nullptr) {
......@@ -1601,8 +1602,10 @@ bool BootAnimation::playAnimation(const Animation& animation) {
if (r > 0) {
glBindTexture(GL_TEXTURE_2D, frame.tid);
} else {
glGenTextures(1, &frame.tid);
glBindTexture(GL_TEXTURE_2D, frame.tid);
if (part.count != 1) {
glGenTextures(1, &frame.tid);
glBindTexture(GL_TEXTURE_2D, frame.tid);
}
int w, h;
// Set decoding option to alpha unpremultiplied so that the R, G, B channels
// of transparent pixels are preserved.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment