Date: Monday, July 8, 2019 @ 21:32:05
  Author: farseerfc
Revision: 487727

upgpkg: telegram-desktop 1.7.14-2

telegram-desktop 1.7.14-2 fix patching caused animated transparency issue

Modified:
  telegram-desktop/trunk/PKGBUILD
  telegram-desktop/trunk/tdesktop-ffmpeg-fix-convertFromARGB32PM.patch

-----------------------------------------------+
 PKGBUILD                                      |    4 +-
 tdesktop-ffmpeg-fix-convertFromARGB32PM.patch |   46 +++++++++++++++++++-----
 2 files changed, 40 insertions(+), 10 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2019-07-08 20:24:23 UTC (rev 487726)
+++ PKGBUILD    2019-07-08 21:32:05 UTC (rev 487727)
@@ -6,7 +6,7 @@
 
 pkgname=telegram-desktop
 pkgver=1.7.14
-pkgrel=1
+pkgrel=2
 pkgdesc='Official Telegram Desktop client'
 arch=('x86_64')
 url="https://desktop.telegram.org/";
@@ -51,7 +51,7 @@
             
'6d0bac5aa4c4992b5400a9a9318f7a4e92d5eab961917cf0b05cdd251ab66a77c52ec8fbef246e8019606a7624d7b5420b87f8153e071e9724c7d2f5c94e47c0'
             
'ce6be003220267bac5483caf8302b492e1581892bc36d35a61236ebf9f9d766b8bd2159557a1c36256aa85f461797a38bfaae57b12da7a72101b21c0b17ed653'
             
'a83b80668b2dc2cc77c857069fdb45b487793fda01ad8a63bab66c6a1c71e5d032050e4ec7efb5b4c3216badc5377c856ef1f4a59c2e02b24ee53b1d83124bf3'
-            
'f0912f2adc6181d3050d8e688c81da5333eeba3166354a72cd4b6abb492c2e6093ca76d577bb4d5ea78706aaa367d952f173d4fd083a1c088172cc5227df61b0'
+            
'0dec897774142a09835d36e4064132e92e9404081eb4cba33d7e2643de475ff195448b527181fdb444a15764960dfc55eb59964b77a09642310c7b8e8c236e73'
             
'1f7cecfc8698ff9e0abce87226e993e73fdf35111d037c2847f7a1f30e65483ab332e45a1bdb86f6ac4c420c1c1429ac20454655d0e982477e37b7c48f0b1599')
 
 prepare() {

Modified: tdesktop-ffmpeg-fix-convertFromARGB32PM.patch
===================================================================
--- tdesktop-ffmpeg-fix-convertFromARGB32PM.patch       2019-07-08 20:24:23 UTC 
(rev 487726)
+++ tdesktop-ffmpeg-fix-convertFromARGB32PM.patch       2019-07-08 21:32:05 UTC 
(rev 487727)
@@ -1,21 +1,50 @@
 diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp 
b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
-index 5d0e50926..7d89692f8 100644
+index 5d0e50926..24b47e8c8 100644
 --- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
 +++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
-@@ -355,6 +355,12 @@ QImage CreateFrameStorage(QSize size) {
+@@ -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) {
-+      to = from.convertToFormat(QImage::Format_ARGB32);
-+        return;
++      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 +393,16 @@ void UnPremultiply(QImage &to, const QImage &from) {
+@@ -387,9 +421,17 @@ void UnPremultiply(QImage &to, const QImage &from) {
                        layout,
                        nullptr);
        }
@@ -23,16 +52,17 @@
  }
  
  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 +426,7 @@ void PremultiplyInplace(QImage &image) {
+@@ -413,6 +455,7 @@ void PremultiplyInplace(QImage &image) {
                        layout,
                        nullptr);
        }

Reply via email to