summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_renderer_software_gradient_linear.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-10-20 15:55:32 -0700
committerCedric BAIL <cedric@osg.samsung.com>2015-11-09 10:42:35 -0800
commit9023f6d28c127373555339cd062f457f4ce7a9b6 (patch)
tree4692c15a0b1eb2c7cab5d09302e9b64ed850cad7 /src/lib/ector/software/ector_renderer_software_gradient_linear.c
parentef975a9fd221a89695d69cd45318efd329d6781b (diff)
ector: simplify code by avoiding unecessary intermediate function.
Diffstat (limited to 'src/lib/ector/software/ector_renderer_software_gradient_linear.c')
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_linear.c44
1 files changed, 18 insertions, 26 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 a7ce3ece12..f0ab0c58d9 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_linear.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
@@ -9,31 +9,6 @@
9#include "ector_private.h" 9#include "ector_private.h"
10#include "ector_software_private.h" 10#include "ector_software_private.h"
11 11
12
13static void
14_update_linear_data(Ector_Renderer_Software_Gradient_Data *gdata)
15{
16 update_color_table(gdata);
17 gdata->linear.x1 = gdata->gld->start.x;
18 gdata->linear.y1 = gdata->gld->start.y;
19
20 gdata->linear.x2 = gdata->gld->end.x;
21 gdata->linear.y2 = gdata->gld->end.y;
22
23 gdata->linear.dx = gdata->linear.x2 - gdata->linear.x1;
24 gdata->linear.dy = gdata->linear.y2 - gdata->linear.y1;
25 gdata->linear.l = gdata->linear.dx * gdata->linear.dx + gdata->linear.dy * gdata->linear.dy;
26 gdata->linear.off = 0;
27
28 if (gdata->linear.l != 0)
29 {
30 gdata->linear.dx /= gdata->linear.l;
31 gdata->linear.dy /= gdata->linear.l;
32 gdata->linear.off = -gdata->linear.dx * gdata->linear.x1 - gdata->linear.dy * gdata->linear.y1;
33 }
34}
35
36
37static Eina_Bool 12static Eina_Bool
38_ector_renderer_software_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj, 13_ector_renderer_software_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj,
39 Ector_Renderer_Software_Gradient_Data *pd) 14 Ector_Renderer_Software_Gradient_Data *pd)
@@ -47,8 +22,25 @@ _ector_renderer_software_gradient_linear_ector_renderer_generic_base_prepare(Eo
47 pd->surface = eo_data_xref(parent, ECTOR_SOFTWARE_SURFACE_CLASS, obj); 22 pd->surface = eo_data_xref(parent, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
48 } 23 }
49 24
50 _update_linear_data(pd); 25 update_color_table(pd);
26
27 pd->linear.x1 = pd->gld->start.x;
28 pd->linear.y1 = pd->gld->start.y;
29
30 pd->linear.x2 = pd->gld->end.x;
31 pd->linear.y2 = pd->gld->end.y;
51 32
33 pd->linear.dx = pd->linear.x2 - pd->linear.x1;
34 pd->linear.dy = pd->linear.y2 - pd->linear.y1;
35 pd->linear.l = pd->linear.dx * pd->linear.dx + pd->linear.dy * pd->linear.dy;
36 pd->linear.off = 0;
37
38 if (pd->linear.l != 0)
39 {
40 pd->linear.dx /= pd->linear.l;
41 pd->linear.dy /= pd->linear.l;
42 pd->linear.off = -pd->linear.dx * pd->linear.x1 - pd->linear.dy * pd->linear.y1;
43 }
52 44
53 return EINA_FALSE; 45 return EINA_FALSE;
54} 46}