kit/ChildSession.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
New commits: commit 4366d6aad4d369cc15a50b07c128cc8897a16d88 Author: Henry Castro <[email protected]> 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*/) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
