[Libreoffice-commits] online.git: kit/ChildSession.cpp
Henry Castro
hcastro at collabora.com
Wed Nov 30 00:26:49 UTC 2016
kit/ChildSession.cpp | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
New commits:
commit 4366d6aad4d369cc15a50b07c128cc8897a16d88
Author: Henry Castro <hcastro at collabora.com>
Date: Tue Nov 29 20:22:23 2016 -0400
kit: render font failure if and only if fails encode PNG
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 65868cf..b729b48 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -359,6 +359,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
{
std::string font, text, decodedFont, decodedChar;
+ bool bSuccess;
if (tokens.count() < 3 ||
!getTokenString(tokens[1], "font", font))
@@ -401,15 +402,22 @@ bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, Str
LOG_TRC("renderFont [" << font << "] rendered in " << (timestamp.elapsed()/1000.) << "ms");
- if (!ptrFont ||
- !png::encodeBufferToPNG(ptrFont, width, height, output, LOK_TILEMODE_RGBA))
+ if (!ptrFont)
{
- std::free(ptrFont);
- return sendTextFrame("error: cmd=renderfont kind=failure");
+ return sendTextFrame(output.data(), output.size());
+ }
+
+ if (png::encodeBufferToPNG(ptrFont, width, height, output, LOK_TILEMODE_RGBA))
+ {
+ bSuccess = sendTextFrame(output.data(), output.size());
+ }
+ else
+ {
+ bSuccess = sendTextFrame("error: cmd=renderfont kind=failure");
}
std::free(ptrFont);
- return sendTextFrame(output.data(), output.size());
+ return bSuccess;
}
bool ChildSession::getStatus(const char* /*buffer*/, int /*length*/)
More information about the Libreoffice-commits
mailing list