summaryrefslogtreecommitdiff
path: root/src/lib/ector/software
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-12-19 20:27:11 +0900
committerHermet Park <hermetpark@gmail.com>2019-12-19 20:30:31 +0900
commit11a1fc9f2b6c6da4bc0000acfdb7840248bb6c78 (patch)
tree5730cddbb9f449ff1f03e98bfdaf55c55d2b5dd3 /src/lib/ector/software
parente2887ec2aaddb3176be180fc0bfc050508559773 (diff)
ector software: catch up losing tasks among the threads.
This is a subsequent change after 8465904c19ea3de2c94c25259ca6a75d0241b4f1. The major change is almost same but just for gradient stuff.
Diffstat (limited to 'src/lib/ector/software')
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_linear.c20
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_radial.c17
-rw-r--r--src/lib/ector/software/ector_software_gradient.c22
-rw-r--r--src/lib/ector/software/ector_software_gradient.h4
-rw-r--r--src/lib/ector/software/ector_software_private.h2
5 files changed, 35 insertions, 30 deletions
diff --git a/src/lib/ector/software/ector_renderer_software_gradient_linear.c b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
index 999feedc42..0e5bc93921 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_linear.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
@@ -8,19 +8,19 @@
8 8
9#include "ector_private.h" 9#include "ector_private.h"
10#include "ector_software_private.h" 10#include "ector_software_private.h"
11#include "ector_software_gradient.h"
11 12
12static Eina_Bool 13static Eina_Bool
13_ector_renderer_software_gradient_linear_ector_renderer_prepare(Eo *obj, 14_ector_renderer_software_gradient_linear_ector_renderer_prepare(Eo *obj,
14 Ector_Renderer_Software_Gradient_Data *pd) 15 Ector_Renderer_Software_Gradient_Data *pd)
15{ 16{
17 pd->ctable_status = CTABLE_NOT_READY;
18
16 if (!pd->surface) 19 if (!pd->surface)
17 { 20 {
18 Ector_Renderer_Data *base; 21 Ector_Renderer_Data *base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
19
20 base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
21 pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj); 22 pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
22 } 23 }
23
24 ector_software_gradient_color_update(pd); 24 ector_software_gradient_color_update(pd);
25 25
26 pd->linear.x1 = pd->gld->start.x; 26 pd->linear.x1 = pd->gld->start.x;
@@ -55,23 +55,24 @@ _ector_renderer_software_gradient_linear_ector_renderer_draw(Eo *obj EINA_UNUSED
55 55
56static Eina_Bool 56static Eina_Bool
57_ector_renderer_software_gradient_linear_ector_renderer_software_op_fill(Eo *obj EINA_UNUSED, 57_ector_renderer_software_gradient_linear_ector_renderer_software_op_fill(Eo *obj EINA_UNUSED,
58 Ector_Renderer_Software_Gradient_Data *pd) 58 Ector_Renderer_Software_Gradient_Data *pd)
59{ 59{
60 ector_software_rasterizer_linear_gradient_set(pd->surface->rasterizer, pd); 60 ector_software_rasterizer_linear_gradient_set(pd->surface->rasterizer, pd);
61 ector_software_gradient_color_update(pd); 61 ector_software_gradient_color_update(pd);
62
62 return EINA_TRUE; 63 return EINA_TRUE;
63} 64}
64 65
65static Eo * 66static Eo *
66_ector_renderer_software_gradient_linear_efl_object_constructor(Eo *obj, 67_ector_renderer_software_gradient_linear_efl_object_constructor(Eo *obj,
67 Ector_Renderer_Software_Gradient_Data *pd) 68 Ector_Renderer_Software_Gradient_Data *pd)
68{ 69{
69 obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS)); 70 obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS));
70 if (!obj) return NULL; 71 if (!obj) return NULL;
71 72
72 pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj); 73 pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj);
73 pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN, obj); 74 pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN, obj);
74 pd->done = EINA_TRUE; 75 pd->ctable_status = CTABLE_NOT_READY;
75 76
76 return obj; 77 return obj;
77} 78}
@@ -94,11 +95,10 @@ _ector_renderer_software_gradient_linear_efl_object_destructor(Eo *obj,
94} 95}
95 96
96void 97void
97_ector_renderer_software_gradient_linear_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) 98_ector_renderer_software_gradient_linear_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
99 const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
98{ 100{
99 efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS), colors, length); 101 efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS), colors, length);
100
101 destroy_color_table(pd);
102} 102}
103 103
104static unsigned int 104static unsigned int
diff --git a/src/lib/ector/software/ector_renderer_software_gradient_radial.c b/src/lib/ector/software/ector_renderer_software_gradient_radial.c
index 989bcaadbe..6f6c87700c 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_radial.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_radial.c
@@ -8,15 +8,16 @@
8 8
9#include "ector_private.h" 9#include "ector_private.h"
10#include "ector_software_private.h" 10#include "ector_software_private.h"
11#include "ector_software_gradient.h"
11 12
12static Eina_Bool 13static Eina_Bool
13_ector_renderer_software_gradient_radial_ector_renderer_prepare(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd) 14_ector_renderer_software_gradient_radial_ector_renderer_prepare(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd)
14{ 15{
16 pd->ctable_status = CTABLE_NOT_READY;
17
15 if (!pd->surface) 18 if (!pd->surface)
16 { 19 {
17 Ector_Renderer_Data *base; 20 Ector_Renderer_Data *base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
18
19 base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
20 pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj); 21 pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
21 } 22 }
22 23
@@ -70,17 +71,18 @@ _ector_renderer_software_gradient_radial_ector_renderer_software_op_fill(Eo *obj
70{ 71{
71 ector_software_rasterizer_radial_gradient_set(pd->surface->rasterizer, pd); 72 ector_software_rasterizer_radial_gradient_set(pd->surface->rasterizer, pd);
72 ector_software_gradient_color_update(pd); 73 ector_software_gradient_color_update(pd);
74
73 return EINA_TRUE; 75 return EINA_TRUE;
74} 76}
75 77
76Eo * 78Eo *
77_ector_renderer_software_gradient_radial_efl_object_constructor(Eo *obj, 79_ector_renderer_software_gradient_radial_efl_object_constructor(Eo *obj,
78 Ector_Renderer_Software_Gradient_Data *pd) 80 Ector_Renderer_Software_Gradient_Data *pd)
79{ 81{
80 obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS)); 82 obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS));
81 pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj); 83 pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj);
82 pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_RADIAL_MIXIN, obj); 84 pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_RADIAL_MIXIN, obj);
83 pd->done = EINA_TRUE; 85 pd->ctable_status = CTABLE_NOT_READY;
84 86
85 return obj; 87 return obj;
86} 88}
@@ -103,11 +105,10 @@ _ector_renderer_software_gradient_radial_efl_object_destructor(Eo *obj,
103} 105}
104 106
105void 107void
106_ector_renderer_software_gradient_radial_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) 108_ector_renderer_software_gradient_radial_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
109 const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
107{ 110{
108 efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS), colors, length); 111 efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS), colors, length);
109
110 destroy_color_table(pd);
111} 112}
112 113
113static unsigned int 114static unsigned int
diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c
index 1681d80724..be20635e29 100644
--- a/src/lib/ector/software/ector_software_gradient.c
+++ b/src/lib/ector/software/ector_software_gradient.c
@@ -11,7 +11,6 @@ void _linear_helper_sse3(uint32_t *buffer, int length, Ector_Renderer_Software_G
11 11
12typedef void (*Ector_Radial_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, 12typedef void (*Ector_Radial_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
13 float det, float delta_det, float delta_delta_det, float b, float delta_b); 13 float det, float delta_det, float delta_delta_det, float b, float delta_b);
14
15typedef void (*Ector_Linear_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, 14typedef void (*Ector_Linear_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
16 int t_fixed, int inc_fixed); 15 int t_fixed, int inc_fixed);
17 16
@@ -22,8 +21,6 @@ static void
22_update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED) 21_update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED)
23{ 22{
24 Ector_Renderer_Software_Gradient_Data *gdata = data; 23 Ector_Renderer_Software_Gradient_Data *gdata = data;
25
26 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
27 gdata->alpha = efl_draw_generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, 24 gdata->alpha = efl_draw_generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count,
28 gdata->color_table, GRADIENT_STOPTABLE_SIZE); 25 gdata->color_table, GRADIENT_STOPTABLE_SIZE);
29} 26}
@@ -32,24 +29,27 @@ static void
32_done_color_table(void *data) 29_done_color_table(void *data)
33{ 30{
34 Ector_Renderer_Software_Gradient_Data *gdata = data; 31 Ector_Renderer_Software_Gradient_Data *gdata = data;
35 32 gdata->ctable_status = CTABLE_READY_DONE;
36 gdata->done = EINA_TRUE;
37} 33}
38 34
39void 35void
40ector_software_gradient_color_update(Ector_Renderer_Software_Gradient_Data *gdata) 36ector_software_gradient_color_update(Ector_Renderer_Software_Gradient_Data *gdata)
41{ 37{
42 if (!gdata->done) 38 if (gdata->ctable_status == CTABLE_READY_DONE) return;
43 { 39
44 ector_software_wait(_update_color_table, _done_color_table, gdata); 40 //OPTIMIZE: This color can be updated only when gradient properties are changed.
45 return ;
46 }
47 41
42 //Alloc only one time.
48 if (!gdata->color_table) 43 if (!gdata->color_table)
44 gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
45
46 if (gdata->ctable_status == CTABLE_NOT_READY)
49 { 47 {
50 gdata->done = EINA_FALSE; 48 gdata->ctable_status = CTABLE_PROCESSING;
51 ector_software_schedule(_update_color_table, _done_color_table, gdata); 49 ector_software_schedule(_update_color_table, _done_color_table, gdata);
52 } 50 }
51 else if (gdata->ctable_status == CTABLE_PROCESSING)
52 ector_software_wait(_update_color_table, _done_color_table, gdata);
53} 53}
54 54
55void 55void
diff --git a/src/lib/ector/software/ector_software_gradient.h b/src/lib/ector/software/ector_software_gradient.h
index 2cbf2f99d7..38731de97d 100644
--- a/src/lib/ector/software/ector_software_gradient.h
+++ b/src/lib/ector/software/ector_software_gradient.h
@@ -18,6 +18,10 @@
18#define FIXPT_BITS 8 18#define FIXPT_BITS 8
19#define FIXPT_SIZE (1<<FIXPT_BITS) 19#define FIXPT_SIZE (1<<FIXPT_BITS)
20 20
21#define CTABLE_NOT_READY 0
22#define CTABLE_PROCESSING 1
23#define CTABLE_READY_DONE 2
24
21static inline int 25static inline int
22_gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos) 26_gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos)
23{ 27{
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index 24fe240f58..a769cc8a87 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -48,7 +48,7 @@ typedef struct _Ector_Renderer_Software_Gradient_Data
48 uint32_t* color_table; 48 uint32_t* color_table;
49 49
50 Eina_Bool alpha; 50 Eina_Bool alpha;
51 Eina_Bool done; 51 int ctable_status; //Ready for color table?
52} Ector_Renderer_Software_Gradient_Data; 52} Ector_Renderer_Software_Gradient_Data;
53 53
54typedef struct _Shape_Rle_Data 54typedef struct _Shape_Rle_Data