mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Improve PeerShortInfoBox cover updating.
This commit is contained in:
parent
360a92c198
commit
05bdef041b
2 changed files with 15 additions and 8 deletions
|
@ -345,8 +345,15 @@ void PeerShortInfoBox::applyUserpic(PeerShortInfoUserpic &&value) {
|
|||
refreshBarImages();
|
||||
update();
|
||||
}
|
||||
if (!value.photo.isNull()
|
||||
&& _userpicImage.cacheKey() != value.photo.cacheKey()) {
|
||||
if (value.photo.isNull()) {
|
||||
const auto videoChanged = _videoInstance
|
||||
? (_videoInstance->shared() != value.videoDocument)
|
||||
: (value.videoDocument != nullptr);
|
||||
const auto frame = videoChanged ? currentVideoFrame() : QImage();
|
||||
if (!frame.isNull()) {
|
||||
_userpicImage = frame;
|
||||
}
|
||||
} else if (_userpicImage.cacheKey() != value.photo.cacheKey()) {
|
||||
_userpicImage = std::move(value.photo);
|
||||
update();
|
||||
}
|
||||
|
@ -354,10 +361,6 @@ void PeerShortInfoBox::applyUserpic(PeerShortInfoUserpic &&value) {
|
|||
_videoInstance = nullptr;
|
||||
} else if (!_videoInstance
|
||||
|| _videoInstance->shared() != value.videoDocument) {
|
||||
const auto frame = currentVideoFrame();
|
||||
if (!frame.isNull()) {
|
||||
_userpicImage = frame;
|
||||
}
|
||||
using namespace Media::Streaming;
|
||||
_videoInstance = std::make_unique<Instance>(
|
||||
std::move(value.videoDocument),
|
||||
|
|
|
@ -129,6 +129,8 @@ void ProcessFullPhoto(
|
|||
if (!current || state->current.photo.isNull()) {
|
||||
if (const auto blurred = view->thumbnailInline()) {
|
||||
GenerateImage(state, blurred, true);
|
||||
} else {
|
||||
state->current.photo = QImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +231,10 @@ void ValidatePhotoId(
|
|||
PhotoId oldUserpicPhotoId) {
|
||||
if (state->userSlice) {
|
||||
const auto count = state->userSlice->size();
|
||||
const auto hasOld = state->userSlice->indexOf(oldUserpicPhotoId);
|
||||
const auto hasNew = state->userSlice->indexOf(state->userpicPhotoId);
|
||||
const auto hasOld = state->userSlice->indexOf(
|
||||
oldUserpicPhotoId).has_value();
|
||||
const auto hasNew = state->userSlice->indexOf(
|
||||
state->userpicPhotoId).has_value();
|
||||
const auto shift = (hasNew ? 0 : 1);
|
||||
const auto fullCount = count + shift;
|
||||
state->current.count = fullCount;
|
||||
|
|
Loading…
Add table
Reference in a new issue