[Libreoffice-commits] core.git: desktop/source include/vcl vcl/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 9 19:23:16 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 53dd6aa5f3817d42bf676980f980051c3b7cdb03
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Jun 9 17:11:15 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Jun 9 21:21:45 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>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d509643ce4d1..99e90c5e9ad9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5275,6 +5275,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
@@ -5289,7 +5291,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");
@@ -5299,6 +5301,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 ecfaa3805bef..79d6dfa9c146 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1711,6 +1711,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