Warning, /graphics/krita/3rdparty/ext_qt/0001-Android-setBackingStore-of-a-window-if-the-platformW.patch is written in an unsupported language. File is not indexed.

0001 From 17b92f74b54af5a09f2ee98f0a53231b87ec8fd7 Mon Sep 17 00:00:00 2001
0002 From: Sharaf Zaman <shzam@sdf.org>
0003 Date: Mon, 14 Mar 2022 14:51:28 +0000
0004 Subject: [PATCH] Android: setBackingStore of a window if the platformWindow
0005  changed
0006 
0007 Sometimes when Qt destroys the platform window without destroying the
0008 backing store. The QPA doesn't "reattach" the backing store to the
0009 platform window, which results in window not being drawn at all.
0010 ---
0011  .../android/qandroidplatformbackingstore.cpp        | 13 +++++++++----
0012  .../android/qandroidplatformbackingstore.h          |  3 +++
0013  2 files changed, 12 insertions(+), 4 deletions(-)
0014 
0015 diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp
0016 index 75f9b41342..e51338991b 100644
0017 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp
0018 +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp
0019 @@ -49,8 +49,10 @@ QT_BEGIN_NAMESPACE
0020  QAndroidPlatformBackingStore::QAndroidPlatformBackingStore(QWindow *window)
0021      : QPlatformBackingStore(window)
0022  {
0023 -    if (window->handle())
0024 +    if (window->handle()) {
0025 +        m_platformWindow = static_cast<QAndroidPlatformWindow *>(window->handle());
0026          setBackingStore(window);
0027 +    }
0028  }
0029  
0030  QPaintDevice *QAndroidPlatformBackingStore::paintDevice()
0031 @@ -61,12 +63,15 @@ QPaintDevice *QAndroidPlatformBackingStore::paintDevice()
0032  
0033  void QAndroidPlatformBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
0034  {
0035 +    Q_ASSERT(window);
0036      Q_UNUSED(offset);
0037  
0038 -    if (!m_backingStoreSet)
0039 -        setBackingStore(window);
0040 +    QAndroidPlatformWindow *platformWindow = static_cast<QAndroidPlatformWindow *>(window->handle());
0041  
0042 -    (static_cast<QAndroidPlatformWindow *>(window->handle()))->repaint(region);
0043 +    if (!m_backingStoreSet || (m_platformWindow != platformWindow)) {
0044 +        setBackingStore(window);
0045 +    }
0046 +    platformWindow->repaint(region);
0047  }
0048  
0049  void QAndroidPlatformBackingStore::resize(const QSize &size, const QRegion &staticContents)
0050 diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.h b/src/plugins/platforms/android/qandroidplatformbackingstore.h
0051 index ec1761c789..8b6ec6e0e4 100644
0052 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.h
0053 +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.h
0054 @@ -44,6 +44,8 @@
0055  #include <qpa/qplatformbackingstore.h>
0056  #include <qpa/qwindowsysteminterface.h>
0057  
0058 +class QAndroidPlatformWindow;
0059 +
0060  QT_BEGIN_NAMESPACE
0061  
0062  class QAndroidPlatformBackingStore : public QPlatformBackingStore
0063 @@ -58,6 +60,7 @@ public:
0064  protected:
0065      QImage m_image;
0066      bool m_backingStoreSet = false;
0067 +    QAndroidPlatformWindow *m_platformWindow {nullptr};
0068  };
0069  
0070  QT_END_NAMESPACE
0071 -- 
0072 2.35.1
0073