[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - common/MessageQueue.cpp kit/Kit.cpp wsd/TileDesc.hpp

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 21 07:58:52 UTC 2019


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

New commits:
commit 2d712fd873659ddf65a07286160746ef06a7799b
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jul 25 19:44:50 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 21 09:58:27 2019 +0200

    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
    (cherry picked from commit f2c6facb296e79a9747f866a94f0ae2269dddc45)
    (cherry picked from commit 8dae787af4593a7b60dc5aad1b9b5f261dfc7354)

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 02ed30337..35c37818c 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1099,6 +1099,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 fa945df14..17508e5f7 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -136,6 +136,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 = "") const


More information about the Libreoffice-commits mailing list