[Libreoffice-commits] online.git: common/MessageQueue.cpp kit/Kit.cpp wsd/TileDesc.hpp

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 26 09:12:43 UTC 2019


 common/MessageQueue.cpp |    2 +-
 kit/Kit.cpp             |    4 ++++
 wsd/TileDesc.hpp        |   14 ++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit f2c6facb296e79a9747f866a94f0ae2269dddc45
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jul 25 19:44:50 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jul 26 10:12:00 2019 +0100

    Don't combine tiles a long way from each other.
    
    We currently combine only horizontally, but ctrl-right arrow in
    calc can throw us to the other side of the sheet, creating a very
    large area to re-render.
    
    Change-Id: I7125ab815e3de1296b3af32632626005eeee0ec9

diff --git a/common/MessageQueue.cpp b/common/MessageQueue.cpp
index 44781d118..ce639e3f1 100644
--- a/common/MessageQueue.cpp
+++ b/common/MessageQueue.cpp
@@ -510,7 +510,7 @@ TileQueue::Payload TileQueue::get_impl()
         LOG_TRC("Combining candidate: " << LOOLProtocol::getAbbreviatedMessage(msg));
 
         // Check if it's on the same row.
-        if (tiles[0].onSameRow(tile2))
+        if (tiles[0].canCombine(tile2))
         {
             tiles.emplace_back(tile2);
             getQueue().erase(getQueue().begin() + i);
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index bb79c2766..832eb6423 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1093,6 +1093,10 @@ public:
         const size_t tilesByY = renderArea.getHeight() / tileCombined.getTileHeight();
         const size_t pixmapWidth = tilesByX * tileCombined.getWidth();
         const size_t pixmapHeight = tilesByY * tileCombined.getHeight();
+
+        if (pixmapWidth > 4096 || pixmapHeight > 4096)
+            LOG_WRN("Unusual extremely large tile combine of size " << pixmapWidth << "x" << pixmapHeight);
+
         const size_t pixmapSize = 4 * pixmapWidth * pixmapHeight;
         std::vector<unsigned char> pixmap(pixmapSize, 0);
 
diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp
index d30b718da..637f2cbd8 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -137,6 +137,20 @@ public:
                other.getTilePosY() <= getTilePosY() + getTileHeight();
     }
 
+    bool canCombine(const TileDesc& other) const
+    {
+        if (!onSameRow(other))
+            return false;
+        int gridX = getTilePosX() / getTileWidth();
+        int gridXOther = other.getTilePosX() / other.getTileWidth();
+        int delta = gridX - gridXOther;
+        // a 4k screen - is sixteen 256 pixel wide tiles wide.
+        if (delta < -16 || delta > 16)
+            return false;
+        else
+            return true;
+    }
+
     /// Serialize this instance into a string.
     /// Optionally prepend a prefix.
     std::string serialize(const std::string& prefix = std::string(),


More information about the Libreoffice-commits mailing list