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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 10 07:47:42 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 c8522043b239aa0e463e6793b7c9b019d79b2d9d
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 09:47:07 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)
    
    Change-Id: I3fa719b0515064773fe4584fedbc8aff98e6e213
    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>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1466c04ffcf1..f730ab0a4c09 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5276,6 +5276,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
@@ -5290,7 +5292,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");
 
@@ -5300,6 +5302,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 9f3f30ab7977..108f46def8aa 100644
--- a/include/vcl/lok.hxx
+++ b/include/vcl/lok.hxx
@@ -20,6 +20,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);
 }
 
 #endif // INCLUDE_VCL_LOK_HXX
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 2494bfcaf92e..10ca0e206325 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1720,6 +1720,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