summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:37:55 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:37:55 +0200
commit510a3e42e84859d6e883c19c08c9e8ed06ac0d78 (patch)
tree0c6ea729797b2b605c0e03b06faa73b23ba0dc7e /src
parent2d9bccbfdc3c35ea85bb1424cac165f46f12e1c7 (diff)
ector: implements bounds_get for gradients in Cairo backend.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ector/cairo/ector_cairo_private.h16
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.c15
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c19
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo1
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c18
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo1
6 files changed, 55 insertions, 15 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_private.h b/src/lib/ector/cairo/ector_cairo_private.h
index 07446a82c2..486f9addd8 100644
--- a/src/lib/ector/cairo/ector_cairo_private.h
+++ b/src/lib/ector/cairo/ector_cairo_private.h
@@ -3,7 +3,15 @@
3 3
4typedef void cairo_pattern_t; 4typedef void cairo_pattern_t;
5 5
6typedef struct {
7 double xx; double yx;
8 double xy; double yy;
9 double x0; double y0;
10} cairo_matrix_t;
11
6typedef struct _Ector_Cairo_Surface_Data Ector_Cairo_Surface_Data; 12typedef struct _Ector_Cairo_Surface_Data Ector_Cairo_Surface_Data;
13typedef struct _Ector_Renderer_Cairo_Base_Data Ector_Renderer_Cairo_Base_Data;
14
7struct _Ector_Cairo_Surface_Data 15struct _Ector_Cairo_Surface_Data
8{ 16{
9 cairo_t *cairo; 17 cairo_t *cairo;
@@ -14,6 +22,14 @@ struct _Ector_Cairo_Surface_Data
14 Eina_Bool internal : 1; 22 Eina_Bool internal : 1;
15}; 23};
16 24
25struct _Ector_Renderer_Cairo_Base_Data
26{
27 Ector_Cairo_Surface_Data *parent;
28 Ector_Renderer_Generic_Base_Data *generic;
29
30 cairo_matrix_t *m;
31};
32
17#define CHECK_CAIRO(Parent) (!(Parent && Parent->cairo)) 33#define CHECK_CAIRO(Parent) (!(Parent && Parent->cairo))
18 34
19#define USE(Obj, Sym, Error) \ 35#define USE(Obj, Sym, Error) \
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.c b/src/lib/ector/cairo/ector_renderer_cairo_base.c
index 5a51aae651..795b57cce5 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.c
@@ -12,12 +12,6 @@
12#include "ector_private.h" 12#include "ector_private.h"
13#include "ector_cairo_private.h" 13#include "ector_cairo_private.h"
14 14
15typedef struct {
16 double xx; double yx;
17 double xy; double yy;
18 double x0; double y0;
19} cairo_matrix_t;
20
21typedef enum { 15typedef enum {
22 CAIRO_OPERATOR_CLEAR, 16 CAIRO_OPERATOR_CLEAR,
23 17
@@ -71,15 +65,6 @@ static void (*cairo_rectangle)(cairo_t *cr, double x, double y, double width, do
71static void (*cairo_clip)(cairo_t *cr) = NULL; 65static void (*cairo_clip)(cairo_t *cr) = NULL;
72static void (*cairo_device_to_user)(cairo_t *cr, double *x, double *y) = NULL; 66static void (*cairo_device_to_user)(cairo_t *cr, double *x, double *y) = NULL;
73 67
74typedef struct _Ector_Renderer_Cairo_Base_Data Ector_Renderer_Cairo_Base_Data;
75struct _Ector_Renderer_Cairo_Base_Data
76{
77 Ector_Cairo_Surface_Data *parent;
78 Ector_Renderer_Generic_Base_Data *generic;
79
80 cairo_matrix_t *m;
81};
82
83static cairo_matrix_t identity; 68static cairo_matrix_t identity;
84 69
85// Cairo need unpremul color, so force unpremul here 70// Cairo need unpremul color, so force unpremul here
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 ce4097bb7f..e44734c15b 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
@@ -117,6 +117,25 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_cairo_base_fill(Eo *obj,
117 return EINA_TRUE; 117 return EINA_TRUE;
118} 118}
119 119
120static Eina_Bool
121_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_bounds_get(Eo *obj,
122 Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED,
123 Eina_Rectangle *r)
124{
125 Ector_Renderer_Generic_Gradient_Linear_Data *gld;
126 Ector_Renderer_Cairo_Base_Data *bd;
127
128 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
129 bd = eo_data_scope_get(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS);
130 EINA_RECTANGLE_SET(r,
131 bd->generic->origin.x + gld->start.x,
132 bd->generic->origin.y + gld->start.y,
133 gld->end.x - gld->start.x,
134 gld->end.y - gld->start.x);
135
136 return EINA_TRUE;
137}
138
120void 139void
121_ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj, 140_ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
122 Ector_Renderer_Cairo_Gradient_Linear_Data *pd) 141 Ector_Renderer_Cairo_Gradient_Linear_Data *pd)
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
index 3d4ed9a5d1..64c60561c5 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
@@ -5,6 +5,7 @@ class Ector.Renderer.Cairo.Gradient_Linear (Ector.Renderer.Cairo.Base, Ector.Ren
5 implements { 5 implements {
6 Ector.Renderer.Generic.Base.prepare; 6 Ector.Renderer.Generic.Base.prepare;
7 Ector.Renderer.Generic.Base.draw; 7 Ector.Renderer.Generic.Base.draw;
8 Ector.Renderer.Generic.Base.bounds_get;
8 Ector.Renderer.Cairo.Base.fill; 9 Ector.Renderer.Cairo.Base.fill;
9 Eo.Base.destructor; 10 Eo.Base.destructor;
10 Efl.Gfx.Gradient.Base.stop.set; 11 Efl.Gfx.Gradient.Base.stop.set;
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 4e07754f40..1f4ac8e6cf 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
@@ -122,6 +122,24 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_cairo_base_fill(Eo *obj, Ec
122 return EINA_TRUE; 122 return EINA_TRUE;
123} 123}
124 124
125static Eina_Bool
126_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_bounds_get(Eo *obj EINA_UNUSED,
127 Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED,
128 Eina_Rectangle *r)
129{
130 Ector_Renderer_Generic_Gradient_Radial_Data *gld;
131 Ector_Renderer_Cairo_Base_Data *bd;
132
133 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
134 bd = eo_data_scope_get(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS);
135 EINA_RECTANGLE_SET(r,
136 bd->generic->origin.x + gld->radial.x - gld->radius,
137 bd->generic->origin.y + gld->radial.y - gld->radius,
138 gld->radius * 2, gld->radius * 2);
139
140 return EINA_TRUE;
141}
142
125void 143void
126_ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj, 144_ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
127 Ector_Renderer_Cairo_Gradient_Radial_Data *pd) 145 Ector_Renderer_Cairo_Gradient_Radial_Data *pd)
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
index fb79bec7d5..c05ad9ea05 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
@@ -5,6 +5,7 @@ class Ector.Renderer.Cairo.Gradient_Radial (Ector.Renderer.Cairo.Base, Ector.Ren
5 implements { 5 implements {
6 Ector.Renderer.Generic.Base.prepare; 6 Ector.Renderer.Generic.Base.prepare;
7 Ector.Renderer.Generic.Base.draw; 7 Ector.Renderer.Generic.Base.draw;
8 Ector.Renderer.Generic.Base.bounds_get;
8 Ector.Renderer.Cairo.Base.fill; 9 Ector.Renderer.Cairo.Base.fill;
9 Eo.Base.destructor; 10 Eo.Base.destructor;
10 Efl.Gfx.Gradient.Base.stop.set; 11 Efl.Gfx.Gradient.Base.stop.set;