summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:33:19 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:33:19 +0200
commitde08a3bc0422a157ed60072710f1fa0a5508cf2a (patch)
treebf47fc671862fb467f2f63facd789198786e3126 /src/lib/ector
parentf603f5ed21977be80f5577ae667c42b42e3669fb (diff)
ector: add reference point to define (0, 0) and don't repeat the same value everywhere.
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.c13
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.eo1
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.c1
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c4
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c4
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.c4
-rw-r--r--src/lib/ector/ector_generic_surface.eo10
-rw-r--r--src/lib/ector/ector_renderer_generic_base.eo2
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_linear.c2
-rw-r--r--src/lib/ector/software/ector_renderer_software_gradient_radial.c2
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c8
-rw-r--r--src/lib/ector/software/ector_software_private.h2
-rw-r--r--src/lib/ector/software/ector_software_surface.c9
-rw-r--r--src/lib/ector/software/ector_software_surface.eo1
14 files changed, 49 insertions, 14 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_surface.c b/src/lib/ector/cairo/ector_cairo_surface.c
index ff30135714..8e7b1043f6 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.c
+++ b/src/lib/ector/cairo/ector_cairo_surface.c
@@ -67,6 +67,7 @@ _ector_cairo_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
67 67
68typedef struct _cairo_surface_t cairo_surface_t; 68typedef struct _cairo_surface_t cairo_surface_t;
69 69
70static void (*cairo_translate)(cairo_t *cr, double tx, double ty) = NULL;
70static void (*cairo_destroy)(cairo_t *cr) = NULL; 71static void (*cairo_destroy)(cairo_t *cr) = NULL;
71static cairo_surface_t *(*cairo_image_surface_create)(int format, 72static cairo_surface_t *(*cairo_image_surface_create)(int format,
72 int width, 73 int width,
@@ -107,6 +108,18 @@ _ector_cairo_surface_context_get(Eo *obj EINA_UNUSED,
107} 108}
108 109
109static void 110static void
111_ector_cairo_surface_ector_generic_surface_reference_point_set(Eo *obj EINA_UNUSED,
112 Ector_Cairo_Surface_Data *pd,
113 int x, int y)
114{
115 if (pd->cairo)
116 {
117 USE(obj, cairo_translate, );
118 cairo_translate(pd->cairo, x, y);
119 }
120}
121
122static void
110_ector_cairo_surface_eo_base_constructor(Eo *obj, 123_ector_cairo_surface_eo_base_constructor(Eo *obj,
111 Ector_Cairo_Surface_Data *pd) 124 Ector_Cairo_Surface_Data *pd)
112{ 125{
diff --git a/src/lib/ector/cairo/ector_cairo_surface.eo b/src/lib/ector/cairo/ector_cairo_surface.eo
index 10f6d9f30e..298c681d78 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.eo
+++ b/src/lib/ector/cairo/ector_cairo_surface.eo
@@ -23,6 +23,7 @@ class Ector.Cairo.Surface (Ector.Generic.Surface)
23 } 23 }
24 implements { 24 implements {
25 Ector.Generic.Surface.renderer_factory_new; 25 Ector.Generic.Surface.renderer_factory_new;
26 Ector.Generic.Surface.reference_point.set;
26 Eo.Base.destructor; 27 Eo.Base.destructor;
27 Eo.Base.constructor; 28 Eo.Base.constructor;
28 } 29 }
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.c b/src/lib/ector/cairo/ector_renderer_cairo_base.c
index 5e1c0606cc..190fb8a090 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.c
@@ -138,7 +138,6 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
138 Ector_Renderer_Cairo_Base_Data *pd, 138 Ector_Renderer_Cairo_Base_Data *pd,
139 Ector_Rop op, 139 Ector_Rop op,
140 Eina_Array *clips EINA_UNUSED, 140 Eina_Array *clips EINA_UNUSED,
141 int x, int y,
142 unsigned int mul_col) 141 unsigned int mul_col)
143{ 142{
144 double r, g, b, a; 143 double r, g, b, a;
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
index e00ed6d8c0..19f30558a3 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
@@ -68,7 +68,7 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *ob
68static Eina_Bool 68static Eina_Bool
69_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj, 69_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
70 Ector_Renderer_Cairo_Gradient_Linear_Data *pd, 70 Ector_Renderer_Cairo_Gradient_Linear_Data *pd,
71 Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col) 71 Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
72{ 72{
73 Ector_Renderer_Generic_Gradient_Linear_Data *gld; 73 Ector_Renderer_Generic_Gradient_Linear_Data *gld;
74 74
@@ -76,7 +76,7 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
76 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN); 76 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN);
77 if (!pd->pat || !gld) return EINA_FALSE; 77 if (!pd->pat || !gld) return EINA_FALSE;
78 78
79 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, x, y, mul_col)); 79 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col));
80 80
81 USE(obj, cairo_rectangle, EINA_FALSE); 81 USE(obj, cairo_rectangle, EINA_FALSE);
82 USE(obj, cairo_fill, EINA_FALSE); 82 USE(obj, cairo_fill, EINA_FALSE);
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
index a219375f93..521b06da9e 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
@@ -72,7 +72,7 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *ob
72 72
73// Clearly duplicated and should be in a common place... 73// Clearly duplicated and should be in a common place...
74static Eina_Bool 74static Eina_Bool
75_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col) 75_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
76{ 76{
77 Ector_Renderer_Generic_Gradient_Radial_Data *gld; 77 Ector_Renderer_Generic_Gradient_Radial_Data *gld;
78 78
@@ -80,7 +80,7 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj,
80 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN); 80 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
81 if (!pd->pat || !gld) return EINA_FALSE; 81 if (!pd->pat || !gld) return EINA_FALSE;
82 82
83 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, x, y, mul_col)); 83 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col));
84 84
85 USE(obj, cairo_arc, EINA_FALSE); 85 USE(obj, cairo_arc, EINA_FALSE);
86 USE(obj, cairo_fill, EINA_FALSE); 86 USE(obj, cairo_fill, EINA_FALSE);
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
index a3fd1070c2..497c59d52f 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
@@ -128,12 +128,12 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
128} 128}
129 129
130static Eina_Bool 130static Eina_Bool
131_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col) 131_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
132{ 132{
133 if (pd->path == NULL) return EINA_FALSE; 133 if (pd->path == NULL) return EINA_FALSE;
134 134
135 // FIXME: find a way to set multiple clips 135 // FIXME: find a way to set multiple clips
136 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, x, y, mul_col)); 136 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, mul_col));
137 137
138 USE(obj, cairo_new_path, EINA_FALSE); 138 USE(obj, cairo_new_path, EINA_FALSE);
139 USE(obj, cairo_append_path, EINA_FALSE); 139 USE(obj, cairo_append_path, EINA_FALSE);
diff --git a/src/lib/ector/ector_generic_surface.eo b/src/lib/ector/ector_generic_surface.eo
index 18ebd47c60..42a5f3e8a3 100644
--- a/src/lib/ector/ector_generic_surface.eo
+++ b/src/lib/ector/ector_generic_surface.eo
@@ -14,6 +14,15 @@ abstract Ector.Generic.Surface (Eo.Base)
14 int h; /*@ in */ 14 int h; /*@ in */
15 } 15 }
16 } 16 }
17 reference_point {
18 set {
19 /*@ This define where is (0,0) in pixels coordinate inside the surface */
20 }
21 values {
22 int x;
23 int y;
24 }
25 }
17 } 26 }
18 methods { 27 methods {
19 renderer_factory_new { 28 renderer_factory_new {
@@ -35,5 +44,6 @@ abstract Ector.Generic.Surface (Eo.Base)
35 } 44 }
36 implements { 45 implements {
37 @virtual .renderer_factory_new; 46 @virtual .renderer_factory_new;
47 @virtual .reference_point.set;
38 } 48 }
39} 49}
diff --git a/src/lib/ector/ector_renderer_generic_base.eo b/src/lib/ector/ector_renderer_generic_base.eo
index 5e5d6aa3b9..50e7e94cdc 100644
--- a/src/lib/ector/ector_renderer_generic_base.eo
+++ b/src/lib/ector/ector_renderer_generic_base.eo
@@ -96,8 +96,6 @@ abstract Ector.Renderer.Generic.Base (Eo.Base)
96 params { 96 params {
97 @in Ector_Rop op; 97 @in Ector_Rop op;
98 @in array<Eina_Rectangle *> *clips; /*@ array of Eina_Rectangle clip */ 98 @in array<Eina_Rectangle *> *clips; /*@ array of Eina_Rectangle clip */
99 @in int x;
100 @in int y;
101 @in uint mul_col; 99 @in uint mul_col;
102 } 100 }
103 } 101 }
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 8bbf23d73a..a6e32b008b 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_linear.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_linear.c
@@ -57,7 +57,7 @@ static Eina_Bool
57_ector_renderer_software_gradient_linear_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, 57_ector_renderer_software_gradient_linear_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
58 Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED, 58 Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
59 Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED, 59 Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED,
60 int x EINA_UNUSED, int y EINA_UNUSED, unsigned int mul_col EINA_UNUSED) 60 unsigned int mul_col EINA_UNUSED)
61{ 61{
62 return EINA_TRUE; 62 return EINA_TRUE;
63} 63}
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 4bcf2a1594..41d24cbf11 100644
--- a/src/lib/ector/software/ector_renderer_software_gradient_radial.c
+++ b/src/lib/ector/software/ector_renderer_software_gradient_radial.c
@@ -66,7 +66,7 @@ static Eina_Bool
66_ector_renderer_software_gradient_radial_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, 66_ector_renderer_software_gradient_radial_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
67 Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED, 67 Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
68 Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED, 68 Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED,
69 int x EINA_UNUSED, int y EINA_UNUSED, unsigned int mul_col EINA_UNUSED) 69 unsigned int mul_col EINA_UNUSED)
70{ 70{
71 return EINA_TRUE; 71 return EINA_TRUE;
72} 72}
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index cdecce9e87..8793c527cf 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -281,11 +281,13 @@ _ector_renderer_software_shape_ector_renderer_generic_base_prepare(Eo *obj, Ecto
281} 281}
282 282
283static Eina_Bool 283static Eina_Bool
284_ector_renderer_software_shape_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, Ector_Renderer_Software_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col) 284_ector_renderer_software_shape_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, Ector_Renderer_Software_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
285{ 285{
286 int x, y;
287
286 // adjust the offset 288 // adjust the offset
287 x = x + (int)pd->base->origin.x; 289 x = pd->surface->x + (int)pd->base->origin.x;
288 y = y + (int)pd->base->origin.y; 290 y = pd->surface->y + (int)pd->base->origin.y;
289 291
290 // fill the span_data structure 292 // fill the span_data structure
291 ector_software_rasterizer_clip_rect_set(pd->surface->software, clips); 293 ector_software_rasterizer_clip_rect_set(pd->surface->software, clips);
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index b43dcfea06..bf2adf6998 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -114,6 +114,8 @@ typedef struct _Software_Rasterizer
114struct _Ector_Software_Surface_Data 114struct _Ector_Software_Surface_Data
115{ 115{
116 Software_Rasterizer *software; 116 Software_Rasterizer *software;
117 int x;
118 int y;
117}; 119};
118 120
119 121
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index e32477ecc0..1999feae68 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -90,5 +90,14 @@ _ector_software_surface_eo_base_destructor(Eo *obj EINA_UNUSED,
90 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor()); 90 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor());
91} 91}
92 92
93static void
94_ector_software_surface_ector_generic_surface_reference_point_set(Eo *obj EINA_UNUSED,
95 Ector_Software_Surface_Data *pd,
96 int x, int y)
97{
98 pd->x = x;
99 pd->y = y;
100}
101
93#include "ector_software_surface.eo.c" 102#include "ector_software_surface.eo.c"
94#include "ector_renderer_software_base.eo.c" 103#include "ector_renderer_software_base.eo.c"
diff --git a/src/lib/ector/software/ector_software_surface.eo b/src/lib/ector/software/ector_software_surface.eo
index 58a6a771f6..3ed863c0c8 100644
--- a/src/lib/ector/software/ector_software_surface.eo
+++ b/src/lib/ector/software/ector_software_surface.eo
@@ -27,6 +27,7 @@ class Ector.Software.Surface (Ector.Generic.Surface)
27 27
28 implements { 28 implements {
29 Ector.Generic.Surface.renderer_factory_new; 29 Ector.Generic.Surface.renderer_factory_new;
30 Ector.Generic.Surface.reference_point.set;
30 Eo.Base.destructor; 31 Eo.Base.destructor;
31 Eo.Base.constructor; 32 Eo.Base.constructor;
32 } 33 }