evas/cserve2: Fix lag with invalid font glyphs

This commit is contained in:
Jean-Philippe Andre 2013-08-23 18:01:22 +09:00
parent 9d2400af8b
commit 8b39c443fe
2 changed files with 17 additions and 10 deletions

View File

@ -335,7 +335,7 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response,
if (!glyphsize) if (!glyphsize)
{ {
FT_Done_Glyph(glyph); FT_Done_Glyph(glyph);
return EINA_FALSE; goto on_error;
} }
buffer_id = cserve2_shared_mempool_buffer_new(response->mempool, glyphsize); 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) if (!data)
{ {
FT_Done_Glyph(glyph); FT_Done_Glyph(glyph);
return EINA_FALSE; goto on_error;
} }
memcpy(data, bglyph->bitmap.buffer, glyphsize); 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); FT_Done_Glyph(glyph);
return EINA_TRUE; 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 static void

View File

@ -24,15 +24,15 @@ cserve2_client_error_send(Client *client, unsigned int rid, int error_code)
int size; int size;
Msg_Error msg; Msg_Error msg;
// clear the struct with possible paddings, since it is not aligned. // clear the struct with possible paddings, since it is not aligned.
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.base.rid = rid; msg.base.rid = rid;
msg.base.type = CSERVE2_ERROR; msg.base.type = CSERVE2_ERROR;
msg.error = error_code; msg.error = error_code;
size = sizeof(msg); size = sizeof(msg);
cserve2_client_send(client, &size, sizeof(size)); cserve2_client_send(client, &size, sizeof(size));
cserve2_client_send(client, &msg, sizeof(msg)); cserve2_client_send(client, &msg, sizeof(msg));
} }
void void