mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 23:27:23 +00:00
fixed animation shutdown and some radial progresses
This commit is contained in:
parent
9d28303459
commit
4a4fb00ec0
@ -500,14 +500,14 @@ public:
|
||||
if (_frameMs + _currentFrameDelay < frameMs) {
|
||||
_currentFrameDelay = int32(frameMs - _frameMs);
|
||||
}
|
||||
_frameMs = frameMs;
|
||||
if (duration == AV_NOPTS_VALUE) {
|
||||
_nextFrameDelay = 0;
|
||||
} else {
|
||||
_nextFrameDelay = (duration * 1000LL * _fmtContext->streams[_streamId]->time_base.num) / _fmtContext->streams[_streamId]->time_base.den;
|
||||
}
|
||||
_frameMs = frameMs;
|
||||
|
||||
av_frame_unref(_frame);
|
||||
av_frame_unref(_frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -821,6 +821,7 @@ private:
|
||||
ClipReadManager::ClipReadManager(QThread *thread) : _processingInThread(0), _needReProcess(false) {
|
||||
moveToThread(thread);
|
||||
connect(thread, SIGNAL(started()), this, SLOT(process()));
|
||||
connect(thread, SIGNAL(finished()), this, SLOT(finish()));
|
||||
connect(this, SIGNAL(processDelayed()), this, SLOT(process()), Qt::QueuedConnection);
|
||||
|
||||
_timer.setSingleShot(true);
|
||||
@ -922,7 +923,7 @@ void ClipReadManager::process() {
|
||||
return;
|
||||
}
|
||||
|
||||
_timer.stop();
|
||||
_timer.stop();
|
||||
_processingInThread = thread();
|
||||
|
||||
uint64 ms = getms(), minms = ms + 86400 * 1000ULL;
|
||||
@ -977,19 +978,26 @@ void ClipReadManager::process() {
|
||||
_processingInThread = 0;
|
||||
}
|
||||
|
||||
ClipReadManager::~ClipReadManager() {
|
||||
{
|
||||
QMutexLocker lock(&_readerPointersMutex);
|
||||
for (ReaderPointers::iterator i = _readerPointers.begin(), e = _readerPointers.end(); i != e; ++i) {
|
||||
if (i.value()) {
|
||||
i.key()->_private = 0;
|
||||
}
|
||||
}
|
||||
_readerPointers.clear();
|
||||
|
||||
for (Readers::iterator i = _readers.begin(), e = _readers.end(); i != e; ++i) {
|
||||
delete i.key();
|
||||
}
|
||||
_readers.clear();
|
||||
}
|
||||
void ClipReadManager::finish() {
|
||||
_timer.stop();
|
||||
clear();
|
||||
}
|
||||
|
||||
void ClipReadManager::clear() {
|
||||
QMutexLocker lock(&_readerPointersMutex);
|
||||
for (ReaderPointers::iterator i = _readerPointers.begin(), e = _readerPointers.end(); i != e; ++i) {
|
||||
if (i.value()) {
|
||||
i.key()->_private = 0;
|
||||
}
|
||||
}
|
||||
_readerPointers.clear();
|
||||
|
||||
for (Readers::iterator i = _readers.begin(), e = _readers.end(); i != e; ++i) {
|
||||
delete i.key();
|
||||
}
|
||||
_readers.clear();
|
||||
}
|
||||
|
||||
ClipReadManager::~ClipReadManager() {
|
||||
clear();
|
||||
}
|
||||
|
@ -556,9 +556,12 @@ signals:
|
||||
public slots:
|
||||
|
||||
void process();
|
||||
void finish();
|
||||
|
||||
private:
|
||||
|
||||
void clear();
|
||||
|
||||
QAtomicInt _loadLevel;
|
||||
typedef QMap<ClipReader*, ClipReaderPrivate*> ReaderPointers;
|
||||
ReaderPointers _readerPointers;
|
||||
|
@ -4074,7 +4074,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r
|
||||
}
|
||||
|
||||
if (radial || (!loaded && !_data->loading())) {
|
||||
float64 radialOpacity = (radial && loaded) ? _animation->radial.opacity() : 1;
|
||||
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
p.setPen(Qt::NoPen);
|
||||
if (selected) {
|
||||
@ -4476,7 +4476,7 @@ void HistoryGif::draw(Painter &p, const HistoryItem *parent, const QRect &r, boo
|
||||
}
|
||||
|
||||
if (radial || (!_gif && !loaded && !_data->loading()) || (_gif == BadClipReader)) {
|
||||
float64 radialOpacity = radial ? _animation->radial.opacity() : 1;
|
||||
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
p.setPen(Qt::NoPen);
|
||||
if (selected) {
|
||||
|
@ -855,7 +855,7 @@ void LayoutOverviewDocument::paint(Painter &p, const QRect &clip, uint32 selecti
|
||||
if (radial || (!loaded && !_data->loading())) {
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
if (clip.intersects(inner)) {
|
||||
float64 radialOpacity = (radial && loaded) ? _radial->opacity() : 1;
|
||||
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _radial->opacity() : 1;
|
||||
p.setPen(Qt::NoPen);
|
||||
if (selected) {
|
||||
p.setBrush(st::msgDateImgBgSelected);
|
||||
|
Loading…
Reference in New Issue
Block a user