[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - 2 commits - common/Rectangle.hpp wsd/ClientSession.cpp wsd/ClientSession.hpp wsd/DocumentBroker.cpp wsd/TileCache.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 28 08:42:43 UTC 2018
common/Rectangle.hpp | 10 ++++++++++
wsd/ClientSession.cpp | 25 +++++++++++++++----------
wsd/ClientSession.hpp | 13 ++++++++++++-
wsd/DocumentBroker.cpp | 1 -
wsd/TileCache.cpp | 2 --
5 files changed, 37 insertions(+), 14 deletions(-)
New commits:
commit e7649f5b4535c60ced12da9ba1b9982b58cc3bdc
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Aug 21 17:15:02 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Aug 28 10:42:38 2018 +0200
Handle tiles hanging out the visible area
A problem comes up when only a part of the tile is visible
on the client side and invalidation affects the invisible
part of this tile. To get back the old / right behavior we
need to request this kind of tiles too.
(cherry picked from commit 25e1a01a3c3df8bf412db7819536ed0a36196320)
Handle negativ position value of clientvisiblearea
Change-Id: I1bf1217e038d034167e1a5412d81a311ebbd83ed
(cherry picked from commit d0fb39cd76cf9097f8f5398a1f7202d4df6390f4)
Reviewed-on: https://gerrit.libreoffice.org/59645
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/common/Rectangle.hpp b/common/Rectangle.hpp
index 1300aa71a..6089f863d 100644
--- a/common/Rectangle.hpp
+++ b/common/Rectangle.hpp
@@ -78,6 +78,16 @@ struct Rectangle
{
return _x1 < _x2 && _y1 < _y2;
}
+
+ bool intersects(const Rectangle& rOther)
+ {
+ Util::Rectangle intersection;
+ intersection._x1 = std::max(_x1, rOther._x1);
+ intersection._y1 = std::max(_y1, rOther._y1);
+ intersection._x2 = std::min(_x2, rOther._x2);
+ intersection._y2 = std::min(_y2, rOther._y2);
+ return intersection.isValid();
+ }
};
}
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index f5573c06c..35732eb94 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1141,6 +1141,13 @@ void ClientSession::handleTileInvalidation(const std::string& message,
return;
}
+ // Visible area can have negativ value as position, but we have tiles only in the positiv range
+ Util::Rectangle normalizedVisArea;
+ normalizedVisArea._x1 = std::max(_clientVisibleArea._x1, 0);
+ normalizedVisArea._y1 = std::max(_clientVisibleArea._y1, 0);
+ normalizedVisArea._x2 = _clientVisibleArea._x2;
+ normalizedVisArea._y2 = _clientVisibleArea._y2;
+
std::pair<int, Util::Rectangle> result = TileCache::parseInvalidateMsg(message);
int part = result.first;
Util::Rectangle& invalidateRect = result.second;
@@ -1151,18 +1158,16 @@ void ClientSession::handleTileInvalidation(const std::string& message,
std::vector<TileDesc> invalidTiles;
if(part == _clientSelectedPart || _isTextDocument)
{
- Util::Rectangle intersection;
- intersection._x1 = std::max(invalidateRect._x1, _clientVisibleArea._x1);
- intersection._y1 = std::max(invalidateRect._y1, _clientVisibleArea._y1);
- intersection._x2 = std::min(invalidateRect._x2, _clientVisibleArea._x2);
- intersection._y2 = std::min(invalidateRect._y2, _clientVisibleArea._y2);
- if(intersection.isValid()) // Client visible area and invalidated rectangle has intersection
+ // Iterate through visible tiles
+ for(int i = std::ceil(normalizedVisArea._y1 / _tileHeightTwips);
+ i <= std::ceil(normalizedVisArea._y2 / _tileHeightTwips); ++i)
{
- for(int i = std::ceil(intersection._y1 / _tileHeightTwips);
- i <= std::ceil(intersection._y2 / _tileHeightTwips); ++i)
+ for(int j = std::ceil(normalizedVisArea._x1 / _tileWidthTwips);
+ j <= std::ceil(normalizedVisArea._x2 / _tileWidthTwips); ++j)
{
- for(int j = std::ceil(intersection._x1 / _tileWidthTwips);
- j <= std::ceil(intersection._x2 / _tileWidthTwips); ++j)
+ // Find tiles affected by invalidation
+ Util::Rectangle tileRect (j * _tileWidthTwips, i * _tileHeightTwips, _tileWidthTwips, _tileHeightTwips);
+ if(invalidateRect.intersects(tileRect))
{
invalidTiles.emplace_back(TileDesc(part, _tileWidthPixel, _tileHeightPixel, j * _tileWidthTwips, i * _tileHeightTwips, _tileWidthTwips, _tileHeightTwips, -1, 0, -1, false));
commit 4de17fe29436bbf2cc70db4be91d06f5dc451e43
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jul 23 16:11:47 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Aug 28 10:42:25 2018 +0200
Trace sent tiles when they are actually sent
SenderQueue might drop some tiles, so we were waiting for
tileprocessed message for a tile which was not sent at all.
Change-Id: I7c502966f656e46df7c22002dee19aeabbf97774
(cherry picked from commit b014804ce2229030a8816eb3c35a08f9af9e4676)
Reviewed-on: https://gerrit.libreoffice.org/59644
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index 4c86e87a1..ff5975f1e 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -84,7 +84,18 @@ public:
docBroker->assertCorrectThread();
LOG_TRC(getName() << " enqueueing client message " << data->id());
- _senderQueue.enqueue(data);
+ size_t sizeBefore = _senderQueue.size();
+ size_t newSize = _senderQueue.enqueue(data);
+ if(sizeBefore != newSize)
+ {
+ // Track sent tile
+ const std::string command = data->firstToken();
+ if (command == "tile:")
+ {
+ const TileDesc tile = TileDesc::parse(data->firstLine());
+ traceTileBySend(tile);
+ }
+ }
}
/// Set the save-as socket which is used to send convert-to results.
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index eb0c1f522..874d1c587 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1438,7 +1438,6 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
cachedTile->read(output.data() + pos, size);
cachedTile->close();
- session->traceTileBySend(tile);
session->sendBinaryFrame(output.data(), output.size());
}
else
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index 2702ba2b0..8e0da8cfe 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -221,7 +221,6 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
auto firstSession = firstSubscriber.lock();
if (firstSession)
{
- firstSession->traceTileBySend(tile);
firstSession->enqueueSendMessage(payload);
}
@@ -243,7 +242,6 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
auto session = subscriber.lock();
if (session)
{
- session->traceTileBySend(tile);
session->enqueueSendMessage(payload);
}
}
More information about the Libreoffice-commits
mailing list