[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - desktop/source include/vcl vcl/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 10 16:06:12 UTC 2021


 desktop/source/lib/init.cxx |    7 ++++++-
 include/vcl/lok.hxx         |    4 ++++
 vcl/source/app/svapp.cxx    |    8 ++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 90a3969c9ebec2553a469bd0443465e56b494bce
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Jun 9 17:11:15 2021 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jun 10 18:05:37 2021 +0200

    scale VCL's scale cache according to the number of Online views
    
    If a document is opened in several Online views, each of them using
    a different zoom, then the scale cache is used for the scaling,
    and each view is sent updated tiles, so if there are too many
    views, the cache is not large enough.
    (Collabora T28503)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116928
    Tested-by: Luboš Luňák <l.lunak at collabora.com>
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 53dd6aa5f3817d42bf676980f980051c3b7cdb03)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116898
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit c8522043b239aa0e463e6793b7c9b019d79b2d9d)
    
    Change-Id: I3fa719b0515064773fe4584fedbc8aff98e6e213
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116901
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9d4c8d5336cd..8428dc2343d4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5298,6 +5298,8 @@ static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis,
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
     const int nId = SfxLokHelper::createView(pDocument->mnDocumentId);
 
+    vcl::lok::numberOfViewsChanged(SfxLokHelper::getViewsCount(pDocument->mnDocumentId));
+
 #ifdef IOS
     (void) pThis;
 #else
@@ -5312,7 +5314,7 @@ static int doc_createView(LibreOfficeKitDocument* pThis)
     return doc_createViewWithOptions(pThis, nullptr); // No options.
 }
 
-static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId)
+static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pThis, int nId)
 {
     comphelper::ProfileZone aZone("doc_destroyView");
 
@@ -5322,6 +5324,9 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis
     LOKClipboardFactory::releaseClipboardForView(nId);
 
     SfxLokHelper::destroyView(nId);
+
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    vcl::lok::numberOfViewsChanged(SfxLokHelper::getViewsCount(pDocument->mnDocumentId));
 }
 
 static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId)
diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx
index 7fc5479a25cd..dcf582991806 100644
--- a/include/vcl/lok.hxx
+++ b/include/vcl/lok.hxx
@@ -22,6 +22,10 @@ bool VCL_DLLPUBLIC isUnipoll();
 void VCL_DLLPUBLIC registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback,
                                          LibreOfficeKitWakeCallback pWakeCallback, void* pData);
 void VCL_DLLPUBLIC unregisterPollCallbacks();
+
+// Called to tell VCL that the number of document views has changed, so that VCL
+// can adjust e.g. sizes of bitmap caches to scale well with larger number of users.
+void VCL_DLLPUBLIC numberOfViewsChanged(int count);
 }
 }
 
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 5831987937f7..3eb67e3f309a 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1687,6 +1687,14 @@ bool isUnipoll()
     return pSVData && pSVData->mpPollCallback != nullptr;
 }
 
+void numberOfViewsChanged(int count)
+{
+    ImplSVData * pSVData = ImplGetSVData();
+    auto& rCache = pSVData->maGDIData.maScaleCache;
+    // Normally the cache size is set to 10, scale according to the number of users.
+    rCache.setMaxSize(count * 10);
+}
+
 } } // namespace lok, namespace vcl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list