evas/cserve2: Fix lag with invalid font glyphs
authorJean-Philippe Andre <jp.andre@samsung.com>
Fri, 23 Aug 2013 09:01:22 +0000 (18:01 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 28 Oct 2013 06:47:14 +0000 (15:47 +0900)
src/bin/evas/evas_cserve2_fonts.c
src/bin/evas/evas_cserve2_main.c

index ed0698c..b9da989 100644 (file)
@@ -335,7 +335,7 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response,
    if (!glyphsize)
      {
         FT_Done_Glyph(glyph);
-        return EINA_FALSE;
+        goto on_error;
      }
 
    buffer_id = cserve2_shared_mempool_buffer_new(response->mempool, glyphsize);
@@ -343,7 +343,7 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response,
    if (!data)
      {
         FT_Done_Glyph(glyph);
-        return EINA_FALSE;
+        goto on_error;
      }
    memcpy(data, bglyph->bitmap.buffer, glyphsize);
 
@@ -363,6 +363,13 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response,
    FT_Done_Glyph(glyph);
 
    return EINA_TRUE;
+
+on_error:
+   // Create invalid entry for this index.
+   memset(&response->glyphs[response->nglyphs], 0, sizeof(Slave_Msg_Glyph));
+   response->glyphs[response->nglyphs].index = idx;
+   response->nglyphs++;
+   return EINA_FALSE;
 }
 
 static void
index 1509a9c..fa70fec 100644 (file)
@@ -24,15 +24,15 @@ cserve2_client_error_send(Client *client, unsigned int rid, int error_code)
    int size;
    Msg_Error msg;
 
-    // clear the struct with possible paddings, since it is not aligned.
-    memset(&msg, 0, sizeof(msg));
-    msg.base.rid = rid;
-    msg.base.type = CSERVE2_ERROR;
-    msg.error = error_code;
-
-    size = sizeof(msg);
-    cserve2_client_send(client, &size, sizeof(size));
-    cserve2_client_send(client, &msg, sizeof(msg));
+   // clear the struct with possible paddings, since it is not aligned.
+   memset(&msg, 0, sizeof(msg));
+   msg.base.rid = rid;
+   msg.base.type = CSERVE2_ERROR;
+   msg.error = error_code;
+
+   size = sizeof(msg);
+   cserve2_client_send(client, &size, sizeof(size));
+   cserve2_client_send(client, &msg, sizeof(msg));
 }
 
 void