[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 3 14:49:50 UTC 2018
wsd/DocumentBroker.cpp | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
New commits:
commit 14537846a8891adaa2a56ae05edbe288a9469f43
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Sep 3 16:35:00 2018 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Sep 3 16:35:00 2018 +0200
Handle unset client visible area case while calculating tiles-on-fly limit
Change-Id: I25ea6f1efdc8115304d5449cfccdbb5c0c15fb1f
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 59ce6d0b8..8de6a9779 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1370,13 +1370,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