Date: Tuesday, July 9, 2019 @ 14:03:30 Author: farseerfc Revision: 487779
upgpkg: telegram-desktop 1.7.14-3 telegram-desktop 1.7.14-3 backport upstream fix for qt5.13 compatibility Added: telegram-desktop/trunk/issue6219.patch Modified: telegram-desktop/trunk/PKGBUILD Deleted: telegram-desktop/trunk/tdesktop-ffmpeg-fix-convertFromARGB32PM.patch telegram-desktop/trunk/tdesktop-rlottie-static-qt.patch telegram-desktop/trunk/tdesktop_qtlottie_qtdebug.patch -----------------------------------------------+ PKGBUILD | 19 +- issue6219.patch | 172 ++++++++++++++++++++++++ tdesktop-ffmpeg-fix-convertFromARGB32PM.patch | 72 ---------- tdesktop-rlottie-static-qt.patch | 13 - tdesktop_qtlottie_qtdebug.patch | 12 - 5 files changed, 183 insertions(+), 105 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2019-07-09 12:14:30 UTC (rev 487778) +++ PKGBUILD 2019-07-09 14:03:30 UTC (rev 487779) @@ -6,7 +6,7 @@ pkgname=telegram-desktop pkgver=1.7.14 -pkgrel=2 +pkgrel=3 pkgdesc='Official Telegram Desktop client' arch=('x86_64') url="https://desktop.telegram.org/" @@ -32,8 +32,7 @@ "demibold.patch" "Use-system-wide-font.patch" "tdesktop_lottie_animation_qtdebug.patch" - "tdesktop-ffmpeg-fix-convertFromARGB32PM.patch" - "tdesktop-rlottie-static-qt.patch" + "issue6219.patch" ) sha512sums=('SKIP' 'SKIP' @@ -51,8 +50,7 @@ '6d0bac5aa4c4992b5400a9a9318f7a4e92d5eab961917cf0b05cdd251ab66a77c52ec8fbef246e8019606a7624d7b5420b87f8153e071e9724c7d2f5c94e47c0' 'ce6be003220267bac5483caf8302b492e1581892bc36d35a61236ebf9f9d766b8bd2159557a1c36256aa85f461797a38bfaae57b12da7a72101b21c0b17ed653' 'a83b80668b2dc2cc77c857069fdb45b487793fda01ad8a63bab66c6a1c71e5d032050e4ec7efb5b4c3216badc5377c856ef1f4a59c2e02b24ee53b1d83124bf3' - '0dec897774142a09835d36e4064132e92e9404081eb4cba33d7e2643de475ff195448b527181fdb444a15764960dfc55eb59964b77a09642310c7b8e8c236e73' - '1f7cecfc8698ff9e0abce87226e993e73fdf35111d037c2847f7a1f30e65483ab332e45a1bdb86f6ac4c420c1c1429ac20454655d0e982477e37b7c48f0b1599') + 'f3ec62dfcace74e0b07396427fa6cdfa849c3feab251bdf629512984bbb2ad4b0389a2543ae6d299a5b3788609e4aeabb0dabc1fa51a3a099287c1b199626ec0') prepare() { cd "$srcdir/tdesktop" @@ -71,9 +69,14 @@ patch -R -Np1 -i "$srcdir/demibold.patch" patch -Np1 -i "$srcdir/Use-system-wide-font.patch" patch -Np1 -i "$srcdir/tdesktop_lottie_animation_qtdebug.patch" - patch -Np1 -i "$srcdir/tdesktop-ffmpeg-fix-convertFromARGB32PM.patch" - patch -Np1 -i "$srcdir/tdesktop-rlottie-static-qt.patch" + # backport from https://github.com/telegramdesktop/tdesktop/commit/0710dde4d5526454318b2748331e887c01ecfdce + # as discussed in https://github.com/telegramdesktop/tdesktop/issues/6219 + patch -Np1 -i "$srcdir/issue6219.patch" + + # disable static-qt for rlottie + sed "/RLOTTIE_WITH_STATIC_QT/d" -i "$srcdir/tdesktop/Telegram/gyp/lib_rlottie.gyp" + cd "$srcdir/tdesktop" cd "Telegram/ThirdParty/libtgvoip" patch -Np1 -i "$srcdir/libtgvoip.patch" @@ -102,7 +105,7 @@ NUM=$((`wc -l < out/Release/CMakeLists.txt` - 2)) sed -i "$NUM r ../CMakeLists.inj" out/Release/CMakeLists.txt cd "$srcdir/tdesktop/out/Release" - cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release + cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -UTDESKTOP_OFFICIAL_TARGET make } Added: issue6219.patch =================================================================== --- issue6219.patch (rev 0) +++ issue6219.patch 2019-07-09 14:03:30 UTC (rev 487779) @@ -0,0 +1,172 @@ +From 0710dde4d5526454318b2748331e887c01ecfdce Mon Sep 17 00:00:00 2001 +From: John Preston <johnprestonm...@gmail.com> +Date: Tue, 9 Jul 2019 13:43:57 +0200 +Subject: [PATCH] Use private Qt color API only in official build. + +Fixes #6219. +--- + .../SourceFiles/ffmpeg/ffmpeg_utility.cpp | 100 ++++++++++++------ + Telegram/gyp/lib_ffmpeg.gyp | 6 +- + 2 files changed, 71 insertions(+), 35 deletions(-) + +diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp +index 5d0e50926..3775f7503 100644 +--- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp ++++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp +@@ -11,7 +11,10 @@ For license and copyright information please follow this link: + #include "logs.h" + + #include <QImage> ++ ++#ifdef TDESKTOP_OFFICIAL_TARGET + #include <private/qdrawhelper_p.h> ++#endif // TDESKTOP_OFFICIAL_TARGET + + extern "C" { + #include <libavutil/opt.h> +@@ -44,6 +47,58 @@ void AlignedImageBufferCleanupHandler(void* data) { + && !(image.bytesPerLine() % kAlignImageBy); + } + ++void UnPremultiplyLine(uchar *dst, const uchar *src, int intsCount) { ++#ifdef TDESKTOP_OFFICIAL_TARGET ++ const auto layout = &qPixelLayouts[QImage::Format_ARGB32]; ++ const auto convert = layout->convertFromARGB32PM; ++#else // TDESKTOP_OFFICIAL_TARGET ++ const auto layout = nullptr; ++ const auto convert = []( ++ uint *dst, ++ const uint *src, ++ int count, ++ std::nullptr_t, ++ std::nullptr_t) { ++ for (auto i = 0; i != count; ++i) { ++ dst[i] = qUnpremultiply(src[i]); ++ } ++ }; ++#endif // TDESKTOP_OFFICIAL_TARGET ++ ++ convert( ++ reinterpret_cast<uint*>(dst), ++ reinterpret_cast<const uint*>(src), ++ intsCount, ++ layout, ++ nullptr); ++} ++ ++void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) { ++#ifdef TDESKTOP_OFFICIAL_TARGET ++ const auto layout = &qPixelLayouts[QImage::Format_ARGB32]; ++ const auto convert = layout->convertToARGB32PM; ++#else // TDESKTOP_OFFICIAL_TARGET ++ const auto layout = nullptr; ++ const auto convert = []( ++ uint *dst, ++ const uint *src, ++ int count, ++ std::nullptr_t, ++ std::nullptr_t) { ++ for (auto i = 0; i != count; ++i) { ++ dst[i] = qPremultiply(src[i]); ++ } ++ }; ++#endif // TDESKTOP_OFFICIAL_TARGET ++ ++ convert( ++ reinterpret_cast<uint*>(dst), ++ reinterpret_cast<const uint*>(src), ++ intsCount, ++ layout, ++ nullptr); ++} ++ + } // namespace + + IOPointer MakeIOPointer( +@@ -360,58 +415,35 @@ void UnPremultiply(QImage &to, const QImage &from) { + if (!GoodStorageForFrame(to, from.size())) { + to = CreateFrameStorage(from.size()); + } +- +- const auto layout = &qPixelLayouts[QImage::Format_ARGB32]; +- const auto convert = layout->convertFromARGB32PM; + const auto fromPerLine = from.bytesPerLine(); + const auto toPerLine = to.bytesPerLine(); + const auto width = from.width(); ++ const auto height = from.height(); ++ auto fromBytes = from.bits(); ++ auto toBytes = to.bits(); + if (fromPerLine != width * 4 || toPerLine != width * 4) { +- auto fromBytes = from.bits(); +- auto toBytes = to.bits(); +- for (auto i = 0; i != to.height(); ++i) { +- convert( +- reinterpret_cast<uint*>(toBytes), +- reinterpret_cast<const uint*>(fromBytes), +- width, +- layout, +- nullptr); ++ for (auto i = 0; i != height; ++i) { ++ UnPremultiplyLine(toBytes, fromBytes, width); + fromBytes += fromPerLine; + toBytes += toPerLine; + } + } else { +- convert( +- reinterpret_cast<uint*>(to.bits()), +- reinterpret_cast<const uint*>(from.bits()), +- from.width() * from.height(), +- layout, +- nullptr); ++ UnPremultiplyLine(toBytes, fromBytes, width * height); + } + } + + void PremultiplyInplace(QImage &image) { +- const auto layout = &qPixelLayouts[QImage::Format_ARGB32]; +- const auto convert = layout->convertToARGB32PM; + const auto perLine = image.bytesPerLine(); + const auto width = image.width(); ++ const auto height = image.height(); ++ auto bytes = image.bits(); + if (perLine != width * 4) { +- auto bytes = image.bits(); +- for (auto i = 0; i != image.height(); ++i) { +- convert( +- reinterpret_cast<uint*>(bytes), +- reinterpret_cast<const uint*>(bytes), +- width, +- layout, +- nullptr); ++ for (auto i = 0; i != height; ++i) { ++ PremultiplyLine(bytes, bytes, width); + bytes += perLine; + } + } else { +- convert( +- reinterpret_cast<uint*>(image.bits()), +- reinterpret_cast<const uint*>(image.bits()), +- image.width() * image.height(), +- layout, +- nullptr); ++ PremultiplyLine(bytes, bytes, width * height); + } + } + +diff --git a/Telegram/gyp/lib_ffmpeg.gyp b/Telegram/gyp/lib_ffmpeg.gyp +index 9971d76ae..b9ada5362 100644 +--- a/Telegram/gyp/lib_ffmpeg.gyp ++++ b/Telegram/gyp/lib_ffmpeg.gyp +@@ -46,7 +46,11 @@ + '<(src_loc)/ffmpeg/ffmpeg_utility.cpp', + '<(src_loc)/ffmpeg/ffmpeg_utility.h', + ], +- 'conditions': [[ 'build_macold', { ++ 'conditions': [[ '"<(official_build_target)" != ""', { ++ 'defines': [ ++ 'TDESKTOP_OFFICIAL_TARGET=<(official_build_target)', ++ ], ++ }], [ 'build_macold', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ], + }, Deleted: tdesktop-ffmpeg-fix-convertFromARGB32PM.patch =================================================================== --- tdesktop-ffmpeg-fix-convertFromARGB32PM.patch 2019-07-09 12:14:30 UTC (rev 487778) +++ tdesktop-ffmpeg-fix-convertFromARGB32PM.patch 2019-07-09 14:03:30 UTC (rev 487779) @@ -1,72 +0,0 @@ -diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp -index 5d0e50926..24b47e8c8 100644 ---- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp -+++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp -@@ -354,7 +354,41 @@ QImage CreateFrameStorage(QSize size) { - cleanupData); - } - -+QImage CreateFromData(const QImage & from, QImage::Format format){ -+ const auto size = from.size(); -+ const auto width = size.width(); -+ const auto height = size.height(); -+ const auto widthAlign = kAlignImageBy / kPixelBytesSize; -+ const auto neededWidth = width + ((width % widthAlign) -+ ? (widthAlign - (width % widthAlign)) -+ : 0); -+ const auto perLine = neededWidth * kPixelBytesSize; -+ const auto buffer = new uchar[perLine * height + kAlignImageBy]; -+ memcpy(buffer, from.bits(), perLine * height + kAlignImageBy); -+ const auto cleanupData = reinterpret_cast<const void *>(buffer); -+ const auto address = reinterpret_cast<uintptr_t>(buffer); -+ const auto alignedBuffer = buffer + ((address % kAlignImageBy) -+ ? (kAlignImageBy - (address % kAlignImageBy)) -+ : 0); -+ return QImage( -+ alignedBuffer, -+ width, -+ height, -+ perLine, -+ format, -+ AlignedImageBufferCleanupHandler, -+ const_cast<void*>(cleanupData)); -+} -+ - void UnPremultiply(QImage &to, const QImage &from) { -+ auto result = CreateFromData(from, QImage::Format_ARGB32_Premultiplied); -+ result = result.convertToFormat(QImage::Format_ARGB32); -+ to = CreateFromData(result, QImage::Format_ARGB32_Premultiplied); -+ return; -+ -+ //// below is original tdesktop code, we shortcut them by using Qt public API -+ //// see https://github.com/telegramdesktop/tdesktop/issues/6219 -+ /* - // This creates QImage::Format_ARGB32_Premultiplied, but we use it - // as an image in QImage::Format_ARGB32 format. - if (!GoodStorageForFrame(to, from.size())) { -@@ -387,9 +421,17 @@ void UnPremultiply(QImage &to, const QImage &from) { - layout, - nullptr); - } -+ */ - } - - void PremultiplyInplace(QImage &image) { -+ image = CreateFromData(image, QImage::Format_ARGB32); -+ image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); -+ return; -+ -+ //// below is original tdesktop code, we shortcut them by using Qt public API -+ //// see https://github.com/telegramdesktop/tdesktop/issues/6219 -+ /* - const auto layout = &qPixelLayouts[QImage::Format_ARGB32]; - const auto convert = layout->convertToARGB32PM; - const auto perLine = image.bytesPerLine(); -@@ -413,6 +455,7 @@ void PremultiplyInplace(QImage &image) { - layout, - nullptr); - } -+ */ - } - - } // namespace FFmpeg Deleted: tdesktop-rlottie-static-qt.patch =================================================================== --- tdesktop-rlottie-static-qt.patch 2019-07-09 12:14:30 UTC (rev 487778) +++ tdesktop-rlottie-static-qt.patch 2019-07-09 14:03:30 UTC (rev 487779) @@ -1,13 +0,0 @@ -diff --git a/Telegram/gyp/lib_rlottie.gyp b/Telegram/gyp/lib_rlottie.gyp -index efc208500..8f2a66f5a 100644 ---- a/Telegram/gyp/lib_rlottie.gyp -+++ b/Telegram/gyp/lib_rlottie.gyp -@@ -113,7 +113,7 @@ - ], - 'conditions': [[ 'not build_win', { - 'defines': [ -- 'RLOTTIE_WITH_STATIC_QT', -+# 'RLOTTIE_WITH_STATIC_QT', - ] - }], [ 'build_macold', { - 'xcode_settings': { Deleted: tdesktop_qtlottie_qtdebug.patch =================================================================== --- tdesktop_qtlottie_qtdebug.patch 2019-07-09 12:14:30 UTC (rev 487778) +++ tdesktop_qtlottie_qtdebug.patch 2019-07-09 14:03:30 UTC (rev 487779) @@ -1,12 +0,0 @@ -diff --git a/src/bodymovin/bmbase.h b/src/bodymovin/bmbase.h -index 97f5940..a4a3433 100644 ---- a/src/bodymovin/bmbase.h -+++ b/src/bodymovin/bmbase.h -@@ -29,6 +29,7 @@ - #pragma once - - #include <QList> -+#include <QtDebug> - #include <functional> - - namespace Lottie {