summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_gradient.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-09-17 11:46:09 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-09-17 11:49:48 -0700
commit39fdfc3cac94746c9943cac04c99314d1b0b95a3 (patch)
treeefe8c497a6ee12cac5d318f59d8029c2b709daf3 /src/lib/ector/software/ector_software_gradient.c
parente380ddb742384546ad05a5f8f5472ecdce795538 (diff)
ector: move gradient color computation to a pool of thread.
This has been a long standing plan for improving performance in rendering vector object. If your test involve updating gradient, you will get another speedup of around 15%. Combined with previous shape, we get a 65% improvement with doing the CPU intensive computation in there own thread before the rendering kickoff. This was motly theorical until now, but well, it works great !
Diffstat (limited to 'src/lib/ector/software/ector_software_gradient.c')
-rw-r--r--src/lib/ector/software/ector_software_gradient.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c
index 627bd3e6df..2656a1da5f 100644
--- a/src/lib/ector/software/ector_software_gradient.c
+++ b/src/lib/ector/software/ector_software_gradient.c
@@ -339,17 +339,40 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
339 return alpha; 339 return alpha;
340} 340}
341 341
342 342static void
343void 343_update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED)
344update_color_table(Ector_Renderer_Software_Gradient_Data *gdata)
345{ 344{
346 if (gdata->color_table) return; 345 Ector_Renderer_Software_Gradient_Data *gdata = data;
347 346
348 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4); 347 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
349 gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, 348 gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count,
350 gdata->color_table, GRADIENT_STOPTABLE_SIZE); 349 gdata->color_table, GRADIENT_STOPTABLE_SIZE);
351} 350}
352 351
352static void
353_done_color_table(void *data)
354{
355 Ector_Renderer_Software_Gradient_Data *gdata = data;
356
357 gdata->done = EINA_TRUE;
358}
359
360void
361ector_software_gradient_color_update(Ector_Renderer_Software_Gradient_Data *gdata)
362{
363 if (!gdata->done)
364 {
365 ector_software_wait(_update_color_table, _done_color_table, gdata);
366 return ;
367 }
368
369 if (!gdata->color_table)
370 {
371 gdata->done = EINA_FALSE;
372 ector_software_schedule(_update_color_table, _done_color_table, gdata);
373 }
374}
375
353void 376void
354destroy_color_table(Ector_Renderer_Software_Gradient_Data *gdata) 377destroy_color_table(Ector_Renderer_Software_Gradient_Data *gdata)
355{ 378{