kit/ChildSession.cpp |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 800bc6befe96596471941ce9be35ce0ea6a76a2f
Author: Henry Castro <hcas...@collabora.com>
Date:   Tue Nov 29 20:22:23 2016 -0400

    kit: render font failure if and only if fails encode PNG
    
    Change-Id: Ia082b28ed70c33b6febd0b3acd62508b7b7c5549
    Reviewed-on: https://gerrit.libreoffice.org/31455
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 4e65d3a..dc825cd 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -362,6 +362,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))
@@ -404,15 +405,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
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to