loolwsd: combine tiles strictly in the same row only

Change-Id: I1d2ba647deac8da749e7cf7b56a1c9a19fe840f8
Reviewed-on: https://gerrit.libreoffice.org/31299
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-11-27 21:28:21 -05:00 committed by Ashod Nakashian
parent 2b9ea3d4a6
commit b8c9163ac8
3 changed files with 26 additions and 18 deletions

View file

@ -109,24 +109,27 @@ void TileQueueTests::testTileCombinedRendering()
const std::string resHor = "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840";
const TileQueue::Payload payloadHor(resHor.data(), resHor.data() + resHor.size());
const std::string resVer = "tilecombine part=0 width=256 height=256 tileposx=0,0 tileposy=0,3840 imgsize=0,0 tilewidth=3840 tileheight=3840";
const TileQueue::Payload payloadVer(resVer.data(), resVer.data() + resVer.size());
const std::string resFull = "tilecombine part=0 width=256 height=256 tileposx=0,3840,0 tileposy=0,0,3840 imgsize=0,0,0 tilewidth=3840 tileheight=3840";
const std::string resVer1 = "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1";
const TileQueue::Payload payloadVer1(resVer1.data(), resVer1.data() + resVer1.size());
const std::string resVer2 = "tile part=0 width=256 height=256 tileposx=0 tileposy=3840 tilewidth=3840 tileheight=3840 ver=-1";
const TileQueue::Payload payloadVer2(resVer2.data(), resVer2.data() + resVer2.size());
const std::string resFull = "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840";
const TileQueue::Payload payloadFull(resFull.data(), resFull.data() + resFull.size());
TileQueue queue;
// Horizontal.
// Horizontal - combine both.
queue.put(req1);
queue.put(req2);
CPPUNIT_ASSERT_EQUAL(payloadHor, queue.get());
// Vertical.
// Vertical - not combined.
queue.put(req1);
queue.put(req3);
CPPUNIT_ASSERT_EQUAL(payloadVer, queue.get());
CPPUNIT_ASSERT_EQUAL(payloadVer1, queue.get());
CPPUNIT_ASSERT_EQUAL(payloadVer2, queue.get());
// Vertical.
// Vertical - combine first row only.
queue.put(req1);
queue.put(req2);
queue.put(req3);

View file

@ -591,18 +591,24 @@ size_t DocumentBroker::removeSession(const std::string& id)
{
Util::assertIsLocked(_mutex);
auto it = _sessions.find(id);
if (it != _sessions.end())
try
{
_sessions.erase(it);
Admin::instance().rmDoc(_docKey, id);
// Let the child know the client has disconnected.
const std::string msg("child-" + id + " disconnect");
_childProcess->sendTextFrame(msg);
auto it = _sessions.find(id);
if (it != _sessions.end())
{
_sessions.erase(it);
// Let the child know the client has disconnected.
const std::string msg("child-" + id + " disconnect");
_childProcess->sendTextFrame(msg);
}
}
catch (const std::exception& ex)
{
LOG_ERR("Error while removing session [" << id << "]: " << ex.what());
}
// Lets remove this session from the admin console too
Admin::instance().rmDoc(_docKey, id);
return _sessions.size();
}

View file

@ -104,8 +104,7 @@ public:
return false;
}
return other.getTilePosY() + other.getTileHeight() >= getTilePosY() &&
other.getTilePosY() <= getTilePosY() + getTileHeight();
return other.getTilePosY() == getTilePosY();
}
/// Serialize this instance into a string.