[Libreoffice-commits] online.git: kit/ChildSession.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 7 09:23:43 UTC 2020
kit/ChildSession.cpp | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
New commits:
commit ad0256259bd8634cbd06b3ff5e881961f384023e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jan 6 17:52:57 2020 -0500
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Jan 7 10:23:22 2020 +0100
wsd: handle rectangle=undefined gracefully
Change-Id: Ib9058956143aae8151c5e76fddff5dea313ff5e7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86323
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index afb052be9..58b420eaf 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1509,25 +1509,30 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const st
int bufferWidth = 800, bufferHeight = 600;
double dpiScale = 1.0;
std::string paintRectangle;
- if (tokens.size() > 2 && getTokenString(tokens[2], "rectangle", paintRectangle))
+ if (tokens.size() > 2 && getTokenString(tokens[2], "rectangle", paintRectangle)
+ && paintRectangle != "undefined")
{
- const std::vector<std::string> rectParts = LOOLProtocol::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
- startX = std::atoi(rectParts[0].c_str());
- startY = std::atoi(rectParts[1].c_str());
- bufferWidth = std::atoi(rectParts[2].c_str());
- bufferHeight = std::atoi(rectParts[3].c_str());
-
- std::string dpiScaleString;
- if (tokens.size() > 3 && getTokenString(tokens[3], "dpiscale", dpiScaleString))
+ const std::vector<std::string> rectParts
+ = LOOLProtocol::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
+ if (rectParts.size() == 4)
{
- dpiScale = std::stod(dpiScaleString);
- if (dpiScale < 0.001)
- dpiScale = 1.0;
+ startX = std::atoi(rectParts[0].c_str());
+ startY = std::atoi(rectParts[1].c_str());
+ bufferWidth = std::atoi(rectParts[2].c_str());
+ bufferHeight = std::atoi(rectParts[3].c_str());
}
}
else
LOG_WRN("windowpaint command doesn't specify a rectangle= attribute.");
+ std::string dpiScaleString;
+ if (tokens.size() > 3 && getTokenString(tokens[3], "dpiscale", dpiScaleString))
+ {
+ dpiScale = std::stod(dpiScaleString);
+ if (dpiScale < 0.001)
+ dpiScale = 1.0;
+ }
+
size_t pixmapDataSize = 4 * bufferWidth * bufferHeight;
std::vector<unsigned char> pixmap(pixmapDataSize);
int width = bufferWidth, height = bufferHeight;
More information about the Libreoffice-commits
mailing list