mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-28 11:30:54 +00:00
Generate opaque good thumbnails for non-sticker Webm.
This commit is contained in:
parent
d18e28978a
commit
044c7f3ce9
@ -58,7 +58,11 @@ enum class FileType {
|
||||
QByteArray data,
|
||||
FileType type) {
|
||||
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) {
|
||||
return Lottie::ReadThumbnail(Lottie::ReadContent(data, path));
|
||||
} else if (type == FileType::Theme) {
|
||||
|
@ -859,12 +859,7 @@ Ui::PreparedFileInformation::Video PrepareForSending(const QString &fname, const
|
||||
auto readFrame = (readResult == internal::ReaderImplementation::ReadResult::Success);
|
||||
if (readFrame && reader->renderFrame(result.thumbnail, hasAlpha, QSize())) {
|
||||
if (hasAlpha && !result.isWebmSticker) {
|
||||
auto cacheForResize = QImage();
|
||||
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.thumbnail = Images::Opaque(std::move(result.thumbnail));
|
||||
}
|
||||
result.duration = static_cast<int>(durationMs / 1000);
|
||||
}
|
||||
|
@ -239,6 +239,9 @@ void Document::validateGoodThumbnail() {
|
||||
Qt::IgnoreAspectRatio,
|
||||
Qt::SmoothTransformation);
|
||||
}
|
||||
if (!sticker && information.alpha) {
|
||||
result = Images::Opaque(std::move(result));
|
||||
}
|
||||
return result;
|
||||
}();
|
||||
auto bytes = QByteArray();
|
||||
|
Loading…
Reference in New Issue
Block a user