chore: cleanup, document, and test some RTL code (#5473)

This commit is contained in:
nerix
2024-07-27 13:19:26 +02:00
committed by GitHub
parent a2cbe6377d
commit ff7cc09f8b
8 changed files with 413 additions and 104 deletions
+19 -16
View File
@@ -53,24 +53,27 @@ Frames::Frames(QList<Frame> &&frames)
getApp()->getEmotes()->getGIFTimer().signal.connect([this] {
this->advance();
});
auto totalLength =
std::accumulate(this->items_.begin(), this->items_.end(), 0UL,
[](auto init, auto &&frame) {
return init + frame.duration;
});
if (totalLength == 0)
{
this->durationOffset_ = 0;
}
else
{
this->durationOffset_ = std::min<int>(
int(getApp()->getEmotes()->getGIFTimer().position() %
totalLength),
60000);
}
this->processOffset();
}
auto totalLength = std::accumulate(this->items_.begin(), this->items_.end(),
0UL, [](auto init, auto &&frame) {
return init + frame.duration;
});
if (totalLength == 0)
{
this->durationOffset_ = 0;
}
else
{
this->durationOffset_ = std::min<int>(
int(getApp()->getEmotes()->getGIFTimer().position() % totalLength),
60000);
}
this->processOffset();
DebugCount::increase("image bytes", this->memoryUsage());
DebugCount::increase("image bytes (ever loaded)", this->memoryUsage());
}