chore: cleanup, document, and test some RTL code (#5473)
This commit is contained in:
+19
-16
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user