mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Generate opaque good thumbnails for non-sticker Webm.
This commit is contained in:
parent
d18e28978a
commit
044c7f3ce9
3 changed files with 9 additions and 7 deletions
|
@ -58,7 +58,11 @@ enum class FileType {
|
||||||
QByteArray data,
|
QByteArray data,
|
||||||
FileType type) {
|
FileType type) {
|
||||||
if (type == FileType::Video || type == FileType::VideoSticker) {
|
if (type == FileType::Video || type == FileType::VideoSticker) {
|
||||||
return ::Media::Clip::PrepareForSending(path, data).thumbnail;
|
auto result = ::Media::Clip::PrepareForSending(path, data);
|
||||||
|
if (result.isWebmSticker && type == FileType::Video) {
|
||||||
|
result.thumbnail = Images::Opaque(std::move(result.thumbnail));
|
||||||
|
}
|
||||||
|
return result.thumbnail;
|
||||||
} else if (type == FileType::AnimatedSticker) {
|
} else if (type == FileType::AnimatedSticker) {
|
||||||
return Lottie::ReadThumbnail(Lottie::ReadContent(data, path));
|
return Lottie::ReadThumbnail(Lottie::ReadContent(data, path));
|
||||||
} else if (type == FileType::Theme) {
|
} else if (type == FileType::Theme) {
|
||||||
|
|
|
@ -859,12 +859,7 @@ Ui::PreparedFileInformation::Video PrepareForSending(const QString &fname, const
|
||||||
auto readFrame = (readResult == internal::ReaderImplementation::ReadResult::Success);
|
auto readFrame = (readResult == internal::ReaderImplementation::ReadResult::Success);
|
||||||
if (readFrame && reader->renderFrame(result.thumbnail, hasAlpha, QSize())) {
|
if (readFrame && reader->renderFrame(result.thumbnail, hasAlpha, QSize())) {
|
||||||
if (hasAlpha && !result.isWebmSticker) {
|
if (hasAlpha && !result.isWebmSticker) {
|
||||||
auto cacheForResize = QImage();
|
result.thumbnail = Images::Opaque(std::move(result.thumbnail));
|
||||||
auto request = FrameRequest();
|
|
||||||
request.framew = request.outerw = result.thumbnail.width();
|
|
||||||
request.frameh = request.outerh = result.thumbnail.height();
|
|
||||||
request.factor = 1;
|
|
||||||
result.thumbnail = PrepareFrameImage(request, result.thumbnail, hasAlpha, cacheForResize);
|
|
||||||
}
|
}
|
||||||
result.duration = static_cast<int>(durationMs / 1000);
|
result.duration = static_cast<int>(durationMs / 1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,9 @@ void Document::validateGoodThumbnail() {
|
||||||
Qt::IgnoreAspectRatio,
|
Qt::IgnoreAspectRatio,
|
||||||
Qt::SmoothTransformation);
|
Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
if (!sticker && information.alpha) {
|
||||||
|
result = Images::Opaque(std::move(result));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}();
|
}();
|
||||||
auto bytes = QByteArray();
|
auto bytes = QByteArray();
|
||||||
|
|
Loading…
Add table
Reference in a new issue