summaryrefslogtreecommitdiff
path: root/src/lib/ector/cairo
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/cairo
parentf603f5ed21977be80f5577ae667c42b42e3669fb (diff)
ector: add reference point to define (0, 0) and don't repeat the same value everywhere.
Diffstat (limited to 'src/lib/ector/cairo')
-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
6 files changed, 20 insertions, 7 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);