|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
#include <rlottie_capi.h> |
|
|
|
|
#include <zlib.h> |
|
|
|
|
#include <cstring> |
|
|
|
|
#include <cstdio> |
|
|
|
|
|
|
|
|
|
static QByteArray unpackGzip(const QByteArray &data) { |
|
|
|
|
if (data.isEmpty()) return {}; |
|
|
|
|
@ -35,15 +36,21 @@ static QByteArray unpackGzip(const QByteArray &data) {
|
|
|
|
|
|
|
|
|
|
LottieIcon::LottieIcon(const QByteArray &tgsData) { |
|
|
|
|
QByteArray json = unpackGzip(tgsData); |
|
|
|
|
fprintf(stderr, "[DIAG LottieIcon] this=%p tgsSize=%d jsonSize=%d jsonEmpty=%d\n", |
|
|
|
|
(void*)this, (int)tgsData.size(), (int)json.size(), (int)json.isEmpty()); |
|
|
|
|
if (json.isEmpty()) return; |
|
|
|
|
|
|
|
|
|
m_jsonData = json; |
|
|
|
|
m_anim = lottie_animation_from_data(m_jsonData.constData(), "", ""); |
|
|
|
|
fprintf(stderr, "[DIAG LottieIcon] this=%p m_anim=%p jsonHead=%.60s\n", |
|
|
|
|
(void*)this, (void*)m_anim, m_jsonData.constData()); |
|
|
|
|
if (!m_anim) return; |
|
|
|
|
|
|
|
|
|
lottie_animation_get_size(m_anim, &m_w, &m_h); |
|
|
|
|
m_totalFrames = (int)lottie_animation_get_totalframe(m_anim); |
|
|
|
|
m_frameRate = lottie_animation_get_framerate(m_anim); |
|
|
|
|
fprintf(stderr, "[DIAG LottieIcon] this=%p frames=%d size=%zux%zu\n", |
|
|
|
|
(void*)this, m_totalFrames, m_w, m_h); |
|
|
|
|
if (m_totalFrames <= 0) m_totalFrames = 1; |
|
|
|
|
m_valid = true; |
|
|
|
|
} |
|
|
|
|
|