[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - wsd/DocumentBroker.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 11:19:30 UTC 2018


 wsd/DocumentBroker.cpp |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit ea5143d7a9e4b309f4d98f65e2e4845fff6109ad
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Sep 3 16:35:00 2018 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Sep 7 13:19:13 2018 +0200

    Handle unset client visible area case while calculating tiles-on-fly limit
    
    Change-Id: I25ea6f1efdc8115304d5449cfccdbb5c0c15fb1f
    (cherry picked from commit 14537846a8891adaa2a56ae05edbe288a9469f43)
    Reviewed-on: https://gerrit.libreoffice.org/59944
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 367445e84..38b4d682d 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1393,13 +1393,23 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
     // How many tiles we have on the visible area, set the upper limit accordingly
     Util::Rectangle normalizedVisArea = session->getNormalizedVisibleArea();
 
-    const int tilesFitOnWidth = std::ceil(normalizedVisArea._x2 / session->getTileWidthInTwips()) -
-                                std::ceil(normalizedVisArea._x1 / session->getTileWidthInTwips()) + 1;
-    const int tilesFitOnHeight = std::ceil(normalizedVisArea._y2 / session->getTileHeightInTwips()) -
-                                 std::ceil(normalizedVisArea._y1 / session->getTileHeightInTwips()) + 1;
-    const int tilesInVisArea = tilesFitOnWidth * tilesFitOnHeight;
+    float tilesOnFlyUpperLimit = 0;
+    if (normalizedVisArea.hasSurface() && session->getTileWidthInTwips() != 0 && session->getTileHeightInTwips() != 0)
+    {
+
+        const int tilesFitOnWidth = std::ceil(normalizedVisArea._x2 / session->getTileWidthInTwips()) -
+                                    std::ceil(normalizedVisArea._x1 / session->getTileWidthInTwips()) + 1;
+        const int tilesFitOnHeight = std::ceil(normalizedVisArea._y2 / session->getTileHeightInTwips()) -
+                                     std::ceil(normalizedVisArea._y1 / session->getTileHeightInTwips()) + 1;
+        const int tilesInVisArea = tilesFitOnWidth * tilesFitOnHeight;
+
+        tilesOnFlyUpperLimit = std::max(TILES_ON_FLY_MIN_UPPER_LIMIT, tilesInVisArea * 1.5f);
+    }
+    else
+    {
+        tilesOnFlyUpperLimit = 200; // Have a big number here to get all tiles requested by file openning
+    }
 
-    const float tilesOnFlyUpperLimit = std::max(TILES_ON_FLY_MIN_UPPER_LIMIT, tilesInVisArea * 1.5f);
 
     // Update client's tilesBeingRendered list
     session->removeOutdatedTileSubscriptions();


More information about the Libreoffice-commits mailing list