summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--legacy/evas/src/lib/Evas.h54
-rw-r--r--legacy/evas/src/lib/canvas/Makefile.am5
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_gradient.c1179
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_gradient2.c233
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_gradient2_linear.c474
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_gradient2_radial.c471
-rw-r--r--legacy/evas/src/lib/engines/common/Makefile.am11
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c1
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient.h46
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient2_linear.c728
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient2_main.c587
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient2_radial.c456
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_angular.c1896
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_linear.c1506
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_main.c929
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_private.h13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_radial.c1143
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_rectangular.c1460
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_sinusoidal.c834
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c172
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.h4
-rw-r--r--legacy/evas/src/lib/include/evas_cairo_common.h10
-rw-r--r--legacy/evas/src/lib/include/evas_common.h170
-rw-r--r--legacy/evas/src/lib/include/evas_private.h46
-rw-r--r--legacy/evas/src/lib/main.c3
-rw-r--r--legacy/evas/src/modules/engines/buffer/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/cairo_x11/evas_engine.c152
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_engine.c136
-rw-r--r--legacy/evas/src/modules/engines/directfb/evas_engine.c25
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_common.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_glew/evas_engine.c280
-rw-r--r--legacy/evas/src/modules/engines/gl_sdl/evas_engine.c398
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.c401
-rw-r--r--legacy/evas/src/modules/engines/quartz/evas_engine.c245
-rw-r--r--legacy/evas/src/modules/engines/quartz/evas_engine.h98
-rw-r--r--legacy/evas/src/modules/engines/quartz/evas_quartz_private.h19
-rw-r--r--legacy/evas/src/modules/engines/software_16/evas_engine.c301
-rw-r--r--legacy/evas/src/modules/engines/software_16_ddraw/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_16_sdl/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_16_wince/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_16_x11/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_8/evas_engine.c359
-rw-r--r--legacy/evas/src/modules/engines/software_8_x11/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_generic/evas_engine.c349
-rw-r--r--legacy/evas/src/modules/engines/software_qtopia/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/software_sdl/evas_engine.c26
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_engine.c1
-rw-r--r--legacy/evas/src/modules/engines/xrender_x11/Makefile.am2
-rw-r--r--legacy/evas/src/modules/engines/xrender_x11/evas_engine.c355
-rw-r--r--legacy/evas/src/modules/engines/xrender_x11/evas_engine.h45
-rw-r--r--legacy/evas/src/modules/engines/xrender_x11/evas_engine_xcb_gradient.c208
-rw-r--r--legacy/evas/src/modules/engines/xrender_x11/evas_engine_xlib_gradient.c209
55 files changed, 3 insertions, 16060 deletions
diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h
index 5821fe4534..d45d3f6a42 100644
--- a/legacy/evas/src/lib/Evas.h
+++ b/legacy/evas/src/lib/Evas.h
@@ -342,7 +342,7 @@ struct _Evas_Native_Surface
342#define EVAS_COLOR_SPACE_ARGB 0 /**< ARGB color space */ 342#define EVAS_COLOR_SPACE_ARGB 0 /**< ARGB color space */
343#define EVAS_COLOR_SPACE_AHSV 1 /**< AHSV color space */ 343#define EVAS_COLOR_SPACE_AHSV 1 /**< AHSV color space */
344 344
345#define EVAS_TEXTURE_REFLECT 0 /**< Gradient and image fill tiling mode - tiling reflects */ 345#define EVAS_TEXTURE_REFLECT 0 /**< image fill tiling mode - tiling reflects */
346#define EVAS_TEXTURE_REPEAT 1 /**< tiling repeats */ 346#define EVAS_TEXTURE_REPEAT 1 /**< tiling repeats */
347#define EVAS_TEXTURE_RESTRICT 2 /**< tiling clamps - range offset ignored */ 347#define EVAS_TEXTURE_RESTRICT 2 /**< tiling clamps - range offset ignored */
348#define EVAS_TEXTURE_RESTRICT_REFLECT 3 /**< tiling clamps and any range offset reflects */ 348#define EVAS_TEXTURE_RESTRICT_REFLECT 3 /**< tiling clamps and any range offset reflects */
@@ -1441,58 +1441,6 @@ typedef void (*Evas_Object_Event_Cb) (void *data, Evas *e, Evas_Object *obj
1441 EAPI void evas_object_polygon_points_clear (Evas_Object *obj) EINA_ARG_NONNULL(1); 1441 EAPI void evas_object_polygon_points_clear (Evas_Object *obj) EINA_ARG_NONNULL(1);
1442 1442
1443/** 1443/**
1444 * @defgroup Evas_Object_Gradient_Group Gradient Object Functions
1445 *
1446 * Functions that work on evas gradient objects.
1447 *
1448 * @ingroup Evas_Object_Specific
1449 */
1450 EINA_DEPRECATED EAPI Evas_Object *evas_object_gradient_add (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
1451 EINA_DEPRECATED EAPI void evas_object_gradient_color_stop_add (Evas_Object *obj, int r, int g, int b, int a, int delta) EINA_ARG_NONNULL(1);
1452 EINA_DEPRECATED EAPI void evas_object_gradient_alpha_stop_add (Evas_Object *obj, int a, int delta) EINA_ARG_NONNULL(1);
1453 EINA_DEPRECATED EAPI void evas_object_gradient_color_data_set (Evas_Object *obj, void *color_data, int len, Eina_Bool has_alpha) EINA_ARG_NONNULL(1, 2);
1454 EINA_DEPRECATED EAPI void evas_object_gradient_alpha_data_set (Evas_Object *obj, void *alpha_data, int len) EINA_ARG_NONNULL(1, 2);
1455 EINA_DEPRECATED EAPI void evas_object_gradient_clear (Evas_Object *obj) EINA_ARG_NONNULL(1);
1456 EINA_DEPRECATED EAPI void evas_object_gradient_type_set (Evas_Object *obj, const char *type, const char *instance_params) EINA_ARG_NONNULL(1, 2);
1457 EINA_DEPRECATED EAPI void evas_object_gradient_type_get (const Evas_Object *obj, char **type, char **instance_params) EINA_ARG_NONNULL(1, 2);
1458 EINA_DEPRECATED EAPI void evas_object_gradient_fill_set (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1);
1459 EINA_DEPRECATED EAPI void evas_object_gradient_fill_get (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) EINA_ARG_NONNULL(1);
1460 EINA_DEPRECATED EAPI void evas_object_gradient_fill_angle_set (Evas_Object *obj, Evas_Angle angle) EINA_ARG_NONNULL(1);
1461 EINA_DEPRECATED EAPI Evas_Angle evas_object_gradient_fill_angle_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1462 EINA_DEPRECATED EAPI void evas_object_gradient_fill_spread_set(Evas_Object *obj, int tile_mode) EINA_ARG_NONNULL(1);
1463 EINA_DEPRECATED EAPI int evas_object_gradient_fill_spread_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1464 EINA_DEPRECATED EAPI void evas_object_gradient_angle_set (Evas_Object *obj, Evas_Angle angle) EINA_ARG_NONNULL(1);
1465 EINA_DEPRECATED EAPI Evas_Angle evas_object_gradient_angle_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1466 EINA_DEPRECATED EAPI void evas_object_gradient_direction_set (Evas_Object *obj, int direction) EINA_ARG_NONNULL(1);
1467 EINA_DEPRECATED EAPI int evas_object_gradient_direction_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1468 EINA_DEPRECATED EAPI void evas_object_gradient_offset_set (Evas_Object *obj, float offset) EINA_ARG_NONNULL(1);
1469 EINA_DEPRECATED EAPI float evas_object_gradient_offset_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1470
1471/**
1472 * @defgroup Evas_Object_Gradient2_Group Gradient2 Object Functions
1473 *
1474 * Functions that work on evas gradient2 objects.
1475 *
1476 * @ingroup Evas_Object_Specific
1477 */
1478 EINA_DEPRECATED EAPI void evas_object_gradient2_color_np_stop_insert (Evas_Object *obj, int r, int g, int b, int a, float pos) EINA_ARG_NONNULL(1);
1479 EINA_DEPRECATED EAPI void evas_object_gradient2_fill_spread_set (Evas_Object *obj, int tile_mode) EINA_ARG_NONNULL(1);
1480 EINA_DEPRECATED EAPI int evas_object_gradient2_fill_spread_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1481 EINA_DEPRECATED EAPI void evas_object_gradient2_fill_transform_set (Evas_Object *obj, Evas_Transform *t) EINA_ARG_NONNULL(1);
1482 EINA_DEPRECATED EAPI void evas_object_gradient2_fill_transform_get (const Evas_Object *obj, Evas_Transform *t) EINA_ARG_NONNULL(1);
1483
1484/* linear gradient2 objects */
1485 EINA_DEPRECATED EAPI Evas_Object *evas_object_gradient2_linear_add (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
1486 EINA_DEPRECATED EAPI void evas_object_gradient2_linear_fill_set (Evas_Object *obj, float x0, float y0, float x1, float y1) EINA_ARG_NONNULL(1);
1487 EINA_DEPRECATED EAPI void evas_object_gradient2_linear_fill_get (const Evas_Object *obj, float *x0, float *y0, float *x1, float *y1) EINA_ARG_NONNULL(1);
1488
1489/* radial gradient2 objects */
1490 EINA_DEPRECATED EAPI Evas_Object *evas_object_gradient2_radial_add (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
1491 EINA_DEPRECATED EAPI void evas_object_gradient2_radial_fill_set (Evas_Object *obj, float cx, float cy, float rx, float ry) EINA_ARG_NONNULL(1);
1492 EINA_DEPRECATED EAPI void evas_object_gradient2_radial_fill_get (const Evas_Object *obj, float *cx, float *cy, float *rx, float *ry) EINA_ARG_NONNULL(1);
1493
1494
1495/**
1496 * @defgroup Evas_Smart_Group Smart Functions 1444 * @defgroup Evas_Smart_Group Smart Functions
1497 * 1445 *
1498 * Functions that deal with Evas_Smart's, creating definition 1446 * Functions that deal with Evas_Smart's, creating definition
diff --git a/legacy/evas/src/lib/canvas/Makefile.am b/legacy/evas/src/lib/canvas/Makefile.am
index 1bb051db27..d5959fa67f 100644
--- a/legacy/evas/src/lib/canvas/Makefile.am
+++ b/legacy/evas/src/lib/canvas/Makefile.am
@@ -27,8 +27,6 @@ evas_key_grab.c \
27evas_layer.c \ 27evas_layer.c \
28evas_main.c \ 28evas_main.c \
29evas_name.c \ 29evas_name.c \
30evas_object_gradient.c \
31evas_object_gradient2.c \
32evas_object_image.c \ 30evas_object_image.c \
33evas_object_main.c \ 31evas_object_main.c \
34evas_object_inform.c \ 32evas_object_inform.c \
@@ -54,6 +52,3 @@ evas_map.c
54 52
55libevas_canvas_la_LIBADD = @EVIL_LIBS@ 53libevas_canvas_la_LIBADD = @EVIL_LIBS@
56 54
57EXTRA_DIST = \
58evas_object_gradient2_linear.c \
59evas_object_gradient2_radial.c
diff --git a/legacy/evas/src/lib/canvas/evas_object_gradient.c b/legacy/evas/src/lib/canvas/evas_object_gradient.c
deleted file mode 100644
index d48e620248..0000000000
--- a/legacy/evas/src/lib/canvas/evas_object_gradient.c
+++ /dev/null
@@ -1,1179 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include "../engines/common/evas_convert_color.h"
4
5/* private magic number for gradient objects */
6static const char o_type[] = "gradient";
7
8/* private struct for gradient object internal data */
9typedef struct _Evas_Object_Gradient Evas_Object_Gradient;
10
11struct _Evas_Object_Gradient
12{
13 DATA32 magic;
14
15 struct {
16 struct {
17 Evas_Angle angle;
18 float offset;
19 int direction;
20 } map;
21 struct {
22 Evas_Coord x, y, w, h;
23 Evas_Angle angle;
24 int spread;
25 } fill;
26 struct {
27 char *name;
28 char *params;
29 } type;
30 unsigned char gradient_opaque : 1;
31 } cur, prev;
32
33 void *engine_data;
34
35 unsigned char changed : 1;
36 unsigned char gradient_changed : 1;
37 unsigned char type_changed : 1;
38};
39
40/* private methods for gradient objects */
41static void evas_object_gradient_init(Evas_Object *obj);
42static void *evas_object_gradient_new(void);
43static void evas_object_gradient_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
44static void evas_object_gradient_free(Evas_Object *obj);
45static void evas_object_gradient_render_pre(Evas_Object *obj);
46static void evas_object_gradient_render_post(Evas_Object *obj);
47
48static unsigned int evas_object_gradient_id_get(Evas_Object *obj);
49static unsigned int evas_object_gradient_visual_id_get(Evas_Object *obj);
50static void *evas_object_gradient_engine_data_get(Evas_Object *obj);
51
52static int evas_object_gradient_is_opaque(Evas_Object *obj);
53static int evas_object_gradient_was_opaque(Evas_Object *obj);
54
55static const Evas_Object_Func object_func =
56{
57 /* methods (compulsory) */
58 evas_object_gradient_free,
59 evas_object_gradient_render,
60 evas_object_gradient_render_pre,
61 evas_object_gradient_render_post,
62 evas_object_gradient_id_get,
63 evas_object_gradient_visual_id_get,
64 evas_object_gradient_engine_data_get,
65 /* these are optional. NULL = nothing */
66 NULL,
67 NULL,
68 NULL,
69 NULL,
70 evas_object_gradient_is_opaque,
71 evas_object_gradient_was_opaque,
72 NULL,
73 NULL,
74 NULL,
75 NULL,
76 NULL,
77 NULL,
78 NULL
79};
80
81/* the actual api call to add a gradient */
82
83/**
84 * @addtogroup Evas_Object_Gradient_Group
85 * @{
86 */
87
88/**
89 * Adds a gradient object to the given evas.
90 * @param e The given evas.
91 * @return A new evas gradient object if successful. Otherwise, @c NULL.
92 * @ingroup Evas_Object_Gradient_Group
93 */
94EAPI Evas_Object *
95evas_object_gradient_add(Evas *e)
96{
97 Evas_Object *obj;
98
99 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
100 return NULL;
101 MAGIC_CHECK_END();
102 obj = evas_object_new(e);
103 evas_object_gradient_init(obj);
104 evas_object_inject(obj, e);
105 if (obj->object_data)
106 {
107 Evas_Object_Gradient *o = (Evas_Object_Gradient *)(obj->object_data);
108
109 o->engine_data = e->engine.func->gradient_new(e->engine.data.output);
110 }
111 evas_object_change(obj);
112 return obj;
113}
114
115/**
116 * Adds a color stop to the given evas gradient object.
117 *
118 * The @p delta parameter determines the proportion of the gradient
119 * object that is to be set to the color. For instance, if red is
120 * added with @p delta set to 2, and green is added with @p
121 * delta set to 1, two-thirds will be red or reddish and one-third
122 * will be green or greenish.
123 *
124 * Colors are added from the top downwards.
125 *
126 * @param obj The given evas gradient object.
127 * @param r Red component of the given color.
128 * @param g Green component of the given color.
129 * @param b Blue component of the given color.
130 * @param a Alpha component of the given color.
131 * @param delta Proportion of the gradient object that is this color.
132 */
133EAPI void
134evas_object_gradient_color_stop_add(Evas_Object *obj, int r, int g, int b, int a, int delta)
135{
136 Evas_Object_Gradient *o;
137
138 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
139 return;
140 MAGIC_CHECK_END();
141 o = (Evas_Object_Gradient *)(obj->object_data);
142 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
143 return;
144 MAGIC_CHECK_END();
145 if (o->engine_data)
146 {
147#ifdef EVAS_FRAME_QUEUING
148 evas_common_pipe_op_grad_flush(o->engine_data);
149#endif
150
151 obj->layer->evas->engine.func->gradient_color_stop_add(obj->layer->evas->engine.data.output,
152 o->engine_data,
153 r, g, b, a, delta);
154 }
155 o->gradient_changed = 1;
156 o->changed = 1;
157 evas_object_change(obj);
158}
159
160/**
161 * Adds an alpha stop to the given evas gradient object.
162 *
163 * The @p delta parameter determines the proportion of the gradient
164 * object that is to be set to the alpha value.
165 *
166 * Alphas are added from the top downwards.
167 *
168 * @param obj The given evas gradient object.
169 * @param a Alpha value.
170 * @param delta Proportion of the gradient object that is this alpha.
171 */
172EAPI void
173evas_object_gradient_alpha_stop_add(Evas_Object *obj, int a, int delta)
174{
175 Evas_Object_Gradient *o;
176
177 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
178 return;
179 MAGIC_CHECK_END();
180 o = (Evas_Object_Gradient *)(obj->object_data);
181 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
182 return;
183 MAGIC_CHECK_END();
184 if (o->engine_data)
185 {
186#ifdef EVAS_FRAME_QUEUING
187 evas_common_pipe_op_grad_flush(o->engine_data);
188#endif
189 obj->layer->evas->engine.func->gradient_alpha_stop_add(obj->layer->evas->engine.data.output,
190 o->engine_data, a, delta);
191 }
192 o->gradient_changed = 1;
193 o->changed = 1;
194 evas_object_change(obj);
195}
196
197/**
198 * Deletes all stops set for the given evas gradient object or any set data.
199 * @param obj The given evas gradient object.
200 */
201EAPI void
202evas_object_gradient_clear(Evas_Object *obj)
203{
204 Evas_Object_Gradient *o;
205
206 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
207 return;
208 MAGIC_CHECK_END();
209 o = (Evas_Object_Gradient *)(obj->object_data);
210 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
211 return;
212 MAGIC_CHECK_END();
213 if (o->engine_data)
214 {
215#ifdef EVAS_FRAME_QUEUING
216 evas_common_pipe_op_grad_flush(o->engine_data);
217#endif
218 obj->layer->evas->engine.func->gradient_clear(obj->layer->evas->engine.data.output,
219 o->engine_data);
220 }
221 o->gradient_changed = 1;
222 o->changed = 1;
223 o->cur.gradient_opaque = 0;
224 evas_object_change(obj);
225}
226
227/**
228 * Sets color data for the given evas gradient object.
229 *
230 * If data is so set, any existing gradient stops will be deleted,
231 * The data is not copied, so if it was allocated, do not free it while it's set.
232 *
233 * @param obj The given evas gradient object.
234 * @param data The color data to be set. Should be in argb32 pixel format.
235 * @param len The length of the data pointer - multiple of the pixel size.
236 * @param has_alpha A flag indicating if the data has alpha or not.
237 */
238EAPI void
239evas_object_gradient_color_data_set(Evas_Object *obj, void *data, int len, Eina_Bool has_alpha)
240{
241 Evas_Object_Gradient *o;
242
243 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
244 return;
245 MAGIC_CHECK_END();
246 o = (Evas_Object_Gradient *)(obj->object_data);
247 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
248 return;
249 MAGIC_CHECK_END();
250 if (o->engine_data)
251 {
252#ifdef EVAS_FRAME_QUEUING
253 evas_common_pipe_op_grad_flush(o->engine_data);
254#endif
255 obj->layer->evas->engine.func->gradient_color_data_set(obj->layer->evas->engine.data.output,
256 o->engine_data,
257 data, len, has_alpha);
258 }
259 o->gradient_changed = 1;
260 o->changed = 1;
261 evas_object_change(obj);
262}
263
264/**
265 * Sets alpha data for the given evas gradient object.
266 *
267 * If alpha data is so set, any existing gradient stops will be cleared,
268 * The data is not copied, so if it was allocated, do not free it while it's set.
269 *
270 * @param obj The given evas gradient object.
271 * @param data The alpha data to be set, in a8 format.
272 * @param len The length of the data pointer - multiple of the pixel size.
273 */
274EAPI void
275evas_object_gradient_alpha_data_set(Evas_Object *obj, void *data, int len)
276{
277 Evas_Object_Gradient *o;
278
279 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
280 return;
281 MAGIC_CHECK_END();
282 o = (Evas_Object_Gradient *)(obj->object_data);
283 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
284 return;
285 MAGIC_CHECK_END();
286 if (o->engine_data)
287 {
288#ifdef EVAS_FRAME_QUEUING
289 evas_common_pipe_op_grad_flush(o->engine_data);
290#endif
291 obj->layer->evas->engine.func->gradient_alpha_data_set(obj->layer->evas->engine.data.output,
292 o->engine_data,
293 data, len);
294 }
295 o->gradient_changed = 1;
296 o->changed = 1;
297 evas_object_change(obj);
298}
299
300/**
301 * Sets the rectangle on the gradient object that the gradient will be
302 * drawn to.
303 *
304 * Note that the gradient may be tiled around this one rectangle,
305 * according to its spread value - restrict, repeat, or reflect. To have
306 * only one 'cycle' of the gradient drawn, the spread value must be set
307 * to restrict, or @p x and @p y must be 0 and @p w and @p h need to be
308 * the width and height of the gradient object respectively.
309 *
310 * The default values for the fill parameters is @p x = 0, @p y = 0,
311 * @p w = 32 and @p h = 32.
312 *
313 * @param obj The given evas gradient object.
314 * @param x The X coordinate for the top left corner of the rect.
315 * @param y The Y coordinate for the top left corner of the rect.
316 * @param w The width of the rect.
317 * @param h The height of the rect.
318 */
319EAPI void
320evas_object_gradient_fill_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
321{
322 Evas_Object_Gradient *o;
323
324 if (w < 0) w = -w;
325 if (h < 0) h = -h;
326 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
327 return;
328 MAGIC_CHECK_END();
329 o = (Evas_Object_Gradient *)(obj->object_data);
330 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
331 return;
332 MAGIC_CHECK_END();
333 if ((o->cur.fill.x == x) &&
334 (o->cur.fill.y == y) &&
335 (o->cur.fill.w == w) &&
336 (o->cur.fill.h == h)) return;
337 o->cur.fill.x = x;
338 o->cur.fill.y = y;
339 o->cur.fill.w = w;
340 o->cur.fill.h = h;
341 o->gradient_changed = 1;
342 o->changed = 1;
343 evas_object_change(obj);
344}
345
346/**
347 * Retrieves the dimensions of the rectangle on the gradient object that
348 * the gradient will use as its fill rect.
349 *
350 * See @ref evas_object_gradient_fill_set for more details.
351 *
352 * @param obj The given evas gradient object.
353 * @param x Pointer to an Evas_Coord to store the X coordinate in.
354 * @param y Pointer to an Evas_Coord to store the Y coordinate in.
355 * @param w Pointer to an Evas_Coord to store the width in.
356 * @param h Pointer to an Evas_Coord to store the height in.
357 */
358EAPI void
359evas_object_gradient_fill_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
360{
361 Evas_Object_Gradient *o;
362
363 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
364 if (x) *x = 0;
365 if (y) *y = 0;
366 if (w) *w = 0;
367 if (h) *h = 0;
368 return;
369 MAGIC_CHECK_END();
370 o = (Evas_Object_Gradient *)(obj->object_data);
371 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
372 if (x) *x = 0;
373 if (y) *y = 0;
374 if (w) *w = 0;
375 if (h) *h = 0;
376 return;
377 MAGIC_CHECK_END();
378 if (x) *x = o->cur.fill.x;
379 if (y) *y = o->cur.fill.y;
380 if (w) *w = o->cur.fill.w;
381 if (h) *h = o->cur.fill.h;
382 return;
383}
384
385/**
386 * Sets the angle at which the given evas gradient object's fill sits clockwise
387 * from vertical.
388 * @param obj The given evas gradient object.
389 * @param angle Angle in degrees. Can be negative.
390 */
391EAPI void
392evas_object_gradient_fill_angle_set(Evas_Object *obj, Evas_Angle angle)
393{
394 Evas_Object_Gradient *o;
395
396 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
397 return;
398 MAGIC_CHECK_END();
399 o = (Evas_Object_Gradient *)(obj->object_data);
400 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
401 return;
402 MAGIC_CHECK_END();
403 if (angle == o->cur.fill.angle) return;
404 o->cur.fill.angle = angle;
405 o->changed = 1;
406 evas_object_change(obj);
407}
408
409/**
410 * Retrieves the angle at which the given evas gradient object's fill sits
411 * clockwise from the vertical.
412 * @param obj The given evas gradient object.
413 * @return The current angle if successful. @c 0.0 otherwise.
414 */
415EAPI Evas_Angle
416evas_object_gradient_fill_angle_get(const Evas_Object *obj)
417{
418 Evas_Object_Gradient *o;
419
420 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
421 return 0;
422 MAGIC_CHECK_END();
423 o = (Evas_Object_Gradient *)(obj->object_data);
424 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
425 return 0;
426 MAGIC_CHECK_END();
427 return o->cur.fill.angle;
428}
429
430/**
431 * Sets the tiling mode for the given evas gradient object's fill.
432 * @param obj The given evas gradient object.
433 * @param spread One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT,
434 * EVAS_TEXTURE_RESTRICT, EVAS_TEXTURE_RESTRICT_REFLECT, EVAS_TEXTURE_RESTRICT_REPEAT,
435 * or EVAS_TEXTURE_PAD.
436 */
437EAPI void
438evas_object_gradient_fill_spread_set(Evas_Object *obj, int spread)
439{
440 Evas_Object_Gradient *o;
441
442 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
443 return;
444 MAGIC_CHECK_END();
445 o = (Evas_Object_Gradient *)(obj->object_data);
446 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
447 return;
448 MAGIC_CHECK_END();
449 if (spread == o->cur.fill.spread) return;
450 o->cur.fill.spread = spread;
451 o->changed = 1;
452 evas_object_change(obj);
453}
454
455/**
456 * Retrieves the spread (tiling mode) for the given gradient object's fill.
457 * @param obj The given evas gradient object.
458 * @return The current spread mode of the gradient object.
459 */
460EAPI int
461evas_object_gradient_fill_spread_get(const Evas_Object *obj)
462{
463 Evas_Object_Gradient *o;
464
465 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
466 return EVAS_TEXTURE_REFLECT;
467 MAGIC_CHECK_END();
468 o = (Evas_Object_Gradient *)(obj->object_data);
469 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
470 return EVAS_TEXTURE_REFLECT;
471 MAGIC_CHECK_END();
472 return o->cur.fill.spread;
473}
474
475/**
476 * Sets the angle at which the given evas gradient sits,
477 * relative to whatever intrinsic orientation of the grad type.
478 * Used mostly by 'linear' kinds of gradients.
479 * @param obj The given evas gradient object.
480 * @param angle Angle in degrees. Can be negative.
481 */
482EAPI void
483evas_object_gradient_angle_set(Evas_Object *obj, Evas_Angle angle)
484{
485 Evas_Object_Gradient *o;
486
487 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
488 return;
489 MAGIC_CHECK_END();
490 o = (Evas_Object_Gradient *)(obj->object_data);
491 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
492 return;
493 MAGIC_CHECK_END();
494 if (angle == o->cur.map.angle) return;
495 o->cur.map.angle = angle;
496 o->gradient_changed = 1;
497 o->changed = 1;
498 evas_object_change(obj);
499}
500
501/**
502 * Retrieves the angle at which the given evas gradient object sits
503 * rel to its intrinsic orientation.
504 * @param obj The given evas gradient object.
505 * @return The current angle if successful. @c 0.0 otherwise.
506 */
507EAPI Evas_Angle
508evas_object_gradient_angle_get(const Evas_Object *obj)
509{
510 Evas_Object_Gradient *o;
511
512 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
513 return 0;
514 MAGIC_CHECK_END();
515 o = (Evas_Object_Gradient *)(obj->object_data);
516 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
517 return 0;
518 MAGIC_CHECK_END();
519 return o->cur.map.angle;
520}
521
522/**
523 * Sets the offset of the given evas gradient object's spectrum.
524 * @param obj The given evas gradient object.
525 * @param offset Values can be negative.
526 */
527EAPI void
528evas_object_gradient_offset_set(Evas_Object *obj, float offset)
529{
530 Evas_Object_Gradient *o;
531
532 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
533 return;
534 MAGIC_CHECK_END();
535 o = (Evas_Object_Gradient *)(obj->object_data);
536 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
537 return;
538 MAGIC_CHECK_END();
539 if (offset == o->cur.map.offset) return;
540 o->cur.map.offset = offset;
541 o->changed = 1;
542 evas_object_change(obj);
543}
544
545/**
546 * Retrieves the spectrum's offset
547 * @param obj The given evas gradient object.
548 * @return The current gradient offset if successful. @c 0.0 otherwise.
549 */
550EAPI float
551evas_object_gradient_offset_get(const Evas_Object *obj)
552{
553 Evas_Object_Gradient *o;
554
555 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
556 return 0.0;
557 MAGIC_CHECK_END();
558 o = (Evas_Object_Gradient *)(obj->object_data);
559 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
560 return 0.0;
561 MAGIC_CHECK_END();
562 return o->cur.map.offset;
563}
564
565/**
566 * Sets the direction of the given evas gradient object's spectrum.
567 * @param obj The given evas gradient object.
568 * @param direction Values are either 1 (the default) or -1.
569 */
570EAPI void
571evas_object_gradient_direction_set(Evas_Object *obj, int direction)
572{
573 Evas_Object_Gradient *o;
574
575 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
576 return;
577 MAGIC_CHECK_END();
578 o = (Evas_Object_Gradient *)(obj->object_data);
579 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
580 return;
581 MAGIC_CHECK_END();
582 if (direction == o->cur.map.direction) return;
583 o->cur.map.direction = direction;
584 o->changed = 1;
585 o->gradient_changed = 1;
586 evas_object_change(obj);
587}
588
589/**
590 * Retrieves the evas gradient object's spectrum direction
591 * @param obj The given evas gradient object.
592 * @return The current gradient direction if successful. @c 1 otherwise.
593 */
594EAPI int
595evas_object_gradient_direction_get(const Evas_Object *obj)
596{
597 Evas_Object_Gradient *o;
598
599 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
600 return 0;
601 MAGIC_CHECK_END();
602 o = (Evas_Object_Gradient *)(obj->object_data);
603 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
604 return 0;
605 MAGIC_CHECK_END();
606 return o->cur.map.direction;
607}
608
609/**
610 * Sets the geometric type displayed by the given gradient object.
611 * @param obj The given gradient object.
612 * @param name Name of the geometric type that the gradient is to be drawn as.
613 * @param params List of allowable params that the given gradient type allows.
614 * Can be NULL.
615 */
616EAPI void
617evas_object_gradient_type_set(Evas_Object *obj, const char *name, const char *params)
618{
619 Evas_Object_Gradient *o;
620
621 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
622 return;
623 MAGIC_CHECK_END();
624 o = (Evas_Object_Gradient *)(obj->object_data);
625 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
626 return;
627 MAGIC_CHECK_END();
628 if (!name || !*name)
629 {
630 name = "linear";
631 params = NULL;
632 }
633 if (params && !*params)
634 params = NULL;
635 if ((o->cur.type.name) && (!strcmp(o->cur.type.name, name)))
636 {
637 if ((!o->cur.type.params) && (!params))
638 return;
639 if ((o->cur.type.params) && (params) && (!strcmp(o->cur.type.params, params)))
640 return;
641 if (o->cur.type.params)
642 {
643 if (o->prev.type.params == o->cur.type.params)
644 o->prev.type.params = strdup(o->cur.type.params);
645 free(o->cur.type.params);
646 o->cur.type.params = NULL;
647 }
648 if (params)
649 o->cur.type.params = strdup(params);
650 o->changed = 1;
651 o->gradient_changed = 1;
652 o->type_changed = 1;
653 evas_object_change(obj);
654 return;
655 }
656
657 if (o->cur.type.name)
658 {
659 if (o->prev.type.name == o->cur.type.name)
660 o->prev.type.name = strdup(o->cur.type.name);
661 free(o->cur.type.name);
662 o->cur.type.name = NULL;
663 }
664 o->cur.type.name = strdup(name);
665
666 if (o->cur.type.params)
667 {
668 if (o->prev.type.params == o->cur.type.params)
669 o->prev.type.params = strdup(o->cur.type.params);
670 free(o->cur.type.params);
671 o->cur.type.params = NULL;
672 }
673 if (params)
674 o->cur.type.params = strdup(params);
675 o->changed = 1;
676 o->gradient_changed = 1;
677 o->type_changed = 1;
678 evas_object_change(obj);
679}
680
681/**
682 * Retrieves the type name and params of the given gradient object.
683 * @param obj The given gradient object.
684 * @param name Pointer to a character pointer to store the pointer to the type
685 * name in.
686 * @param params Pointer to a character pointer to store the pointer to the type
687 * params string in.
688 */
689EAPI void
690evas_object_gradient_type_get(const Evas_Object *obj, char **name, char **params)
691{
692 Evas_Object_Gradient *o;
693
694 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
695 if (name) *name = NULL;
696 if (params) *params = NULL;
697 return;
698 MAGIC_CHECK_END();
699 o = (Evas_Object_Gradient *)(obj->object_data);
700 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
701 if (name) *name = NULL;
702 if (params) *params = NULL;
703 return;
704 MAGIC_CHECK_END();
705 if (name) *name = o->cur.type.name;
706 if (params) *params = o->cur.type.params;
707}
708
709
710
711/**
712 * @}
713 */
714
715/*
716 these two functions don't really belong here as they can apply to other
717 objs as well, but for now..
718*/
719
720/**
721 * Convert a given color from HSV to RGB format.
722 *
723 * @param h The Hue component of the color.
724 * @param s The Saturation component of the color.
725 * @param v The Value component of the color.
726 * @param r The Red component of the color.
727 * @param g The Green component of the color.
728 * @param b The Blue component of the color.
729 *
730 * This function converts a given color in HSV color format to RGB
731 * color format.
732 *
733 * @ingroup Evas_Utils
734 **/
735EAPI void
736evas_color_hsv_to_rgb(float h, float s, float v, int *r, int *g, int *b)
737{
738 evas_common_convert_color_hsv_to_rgb(h, s, v, r, g, b);
739}
740
741/**
742 * Convert a given color from RGB to HSV format.
743 *
744 * @param r The Red component of the color.
745 * @param g The Green component of the color.
746 * @param b The Blue component of the color.
747 * @param h The Hue component of the color.
748 * @param s The Saturation component of the color.
749 * @param v The Value component of the color.
750 *
751 * This function converts a given color in RGB color format to HSV
752 * color format.
753 *
754 * @ingroup Evas_Utils
755 **/
756EAPI void
757evas_color_rgb_to_hsv(int r, int g, int b, float *h, float *s, float *v)
758{
759 evas_common_convert_color_rgb_to_hsv(r, g, b, h, s, v);
760}
761
762/**
763 * Pre-multiplies a rgb triplet by an alpha factor.
764 *
765 * @param a The alpha factor.
766 * @param r The Red component of the color.
767 * @param g The Green component of the color.
768 * @param b The Blue component of the color.
769 *
770 * This function pre-multiplies a given rbg triplet by an alpha
771 * factor. Alpha factor is used to define transparency.
772 *
773 * @ingroup Evas_Utils
774 **/
775EAPI void
776evas_color_argb_premul(int a, int *r, int *g, int *b)
777{
778 evas_common_convert_color_argb_premul(a, r, g, b);
779}
780
781/**
782 * Undo pre-multiplication of a rgb triplet by an alpha factor.
783 *
784 * @param a The alpha factor.
785 * @param r The Red component of the color.
786 * @param g The Green component of the color.
787 * @param b The Blue component of the color.
788 *
789 * This function undoes pre-multiplication a given rbg triplet by an
790 * alpha factor. Alpha factor is used to define transparency.
791 *
792 * @see evas_color_argb_premul().
793 *
794 * @ingroup Evas_Utils
795 **/
796EAPI void
797evas_color_argb_unpremul(int a, int *r, int *g, int *b)
798{
799 evas_common_convert_color_argb_unpremul(a, r, g, b);
800}
801
802/**
803 * Pre-multiplies data by an alpha factor.
804 *
805 * @param data The data value.
806 * @param len The lenght value.
807 *
808 * This function pre-multiplies a given data by an alpha
809 * factor. Alpha factor is used to define transparency.
810 *
811 * @ingroup Evas_Utils
812 **/
813EAPI void
814evas_data_argb_premul(unsigned int *data, unsigned int len)
815{
816 if (!data || (len < 1)) return;
817 evas_common_convert_argb_premul(data, len);
818}
819
820/**
821 * Undo pre-multiplication data by an alpha factor.
822 *
823 * @param data The data value.
824 * @param len The lenght value.
825 *
826 * This function undoes pre-multiplication of a given data by an alpha
827 * factor. Alpha factor is used to define transparency.
828 *
829 * @ingroup Evas_Utils
830 **/
831EAPI void
832evas_data_argb_unpremul(unsigned int *data, unsigned int len)
833{
834 if (!data || (len < 1)) return;
835 evas_common_convert_argb_unpremul(data, len);
836}
837
838
839
840/* all nice and private */
841static void
842evas_object_gradient_init(Evas_Object *obj)
843{
844 /* alloc grad ob, setup methods and default values */
845 obj->object_data = evas_object_gradient_new();
846 /* set up default settings for this kind of object */
847 obj->cur.color.r = 255;
848 obj->cur.color.g = 255;
849 obj->cur.color.b = 255;
850 obj->cur.color.a = 255;
851 obj->cur.geometry.x = 0;
852 obj->cur.geometry.y = 0;
853 obj->cur.geometry.w = 0;
854 obj->cur.geometry.h = 0;
855 obj->cur.layer = 0;
856 obj->cur.anti_alias = 1;
857 obj->cur.interpolation_color_space = EVAS_COLOR_SPACE_ARGB;
858 obj->cur.render_op = EVAS_RENDER_BLEND;
859 /* set up object-specific settings */
860 obj->prev = obj->cur;
861 /* set up methods (compulsory) */
862 obj->func = &object_func;
863 obj->type = o_type;
864}
865
866static void *
867evas_object_gradient_new(void)
868{
869 Evas_Object_Gradient *o;
870
871 /* alloc obj private data */
872 o = calloc(1, sizeof(Evas_Object_Gradient));
873 if (!o) return NULL;
874 o->magic = MAGIC_OBJ_GRADIENT;
875 o->cur.map.angle = 0;
876 o->cur.map.offset = 0.0;
877 o->cur.map.direction = 1;
878 o->cur.fill.x = 0;
879 o->cur.fill.y = 0;
880 o->cur.fill.w = 1;
881 o->cur.fill.h = 1;
882 o->cur.fill.angle = 0;
883 o->cur.fill.spread = EVAS_TEXTURE_REFLECT;
884 o->cur.type.name = strdup("linear");
885 o->cur.type.params = NULL;
886 o->cur.gradient_opaque = 0;
887 o->prev = o->cur;
888 o->changed = 1;
889 o->gradient_changed = 1;
890 o->type_changed = 1;
891 return o;
892}
893
894static void
895evas_object_gradient_free(Evas_Object *obj)
896{
897 Evas_Object_Gradient *o;
898
899 /* frees private object data. very simple here */
900 o = (Evas_Object_Gradient *)(obj->object_data);
901 MAGIC_CHECK(o, Evas_Object_Gradient, MAGIC_OBJ_GRADIENT);
902 return;
903 MAGIC_CHECK_END();
904 /* free obj */
905 if (o->prev.type.name && (o->prev.type.name != o->cur.type.name))
906 free(o->prev.type.name);
907 if (o->prev.type.params && (o->prev.type.params != o->cur.type.params))
908 free(o->prev.type.params);
909 if (o->cur.type.name)
910 free(o->cur.type.name);
911 if (o->cur.type.params)
912 free(o->cur.type.params);
913 if (o->engine_data)
914 obj->layer->evas->engine.func->gradient_free(obj->layer->evas->engine.data.output,
915 o->engine_data);
916 free(o);
917 obj->object_data = NULL;
918}
919
920
921static void
922evas_object_grad_get_fill_coords(Evas_Object *obj, Evas_Coord fx, Evas_Coord fy, Evas_Coord fw, Evas_Coord fh, Evas_Coord *fx_ret, Evas_Coord *fy_ret, Evas_Coord *fw_ret,
923Evas_Coord *fh_ret)
924{
925 Evas_Coord x, y, w, h;
926
927 x = ((fx * obj->layer->evas->output.w) /
928 (Evas_Coord)obj->layer->evas->viewport.w);
929 w = ((fw * obj->layer->evas->output.w) /
930 (Evas_Coord)obj->layer->evas->viewport.w);
931 y = ((fy * obj->layer->evas->output.h) /
932 (Evas_Coord)obj->layer->evas->viewport.h);
933 h = ((fh * obj->layer->evas->output.h) /
934 (Evas_Coord)obj->layer->evas->viewport.h);
935
936 if (w < 1) w = 1;
937 if (h < 1) h = 1;
938
939 *fx_ret = x; *fw_ret = w;
940 *fy_ret = y; *fh_ret = h;
941}
942
943
944
945static void
946evas_object_gradient_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
947{
948 Evas_Object_Gradient *o;
949
950 /* render object to surface with context, and offxet by x,y */
951 o = (Evas_Object_Gradient *)(obj->object_data);
952 obj->layer->evas->engine.func->context_multiplier_unset(output, context);
953 obj->layer->evas->engine.func->context_anti_alias_set(output, context, obj->cur.anti_alias);
954 obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op);
955 if (o->engine_data)
956 {
957 obj->layer->evas->engine.func->gradient_draw(output, context, surface,
958 o->engine_data,
959 obj->cur.geometry.x + x,
960 obj->cur.geometry.y + y,
961 obj->cur.geometry.w,
962 obj->cur.geometry.h);
963//// obj->cur.cache.geometry.x + x,
964//// obj->cur.cache.geometry.y + y,
965//// obj->cur.cache.geometry.w,
966//// obj->cur.cache.geometry.h);
967 }
968}
969
970static void
971evas_object_gradient_render_pre(Evas_Object *obj)
972{
973 Evas_Object_Gradient *o;
974 int is_v, was_v;
975
976 /* dont pre-render the obj twice! */
977 if (obj->pre_render_done) return;
978 obj->pre_render_done = 1;
979 /* pre-render phase. this does anything an object needs to do just before */
980 /* rendering. this could mean loading the image data, retrieving it from */
981 /* elsewhere, decoding video etc. */
982 /* then when this is done the object needs to figure if it changed and */
983 /* if so what and where and add the appropriate redraw rectangles */
984 o = (Evas_Object_Gradient *)(obj->object_data);
985 /* if someone is clipping this obj - go calculate the clipper */
986 if (obj->cur.clipper)
987 {
988 if (obj->cur.cache.clip.dirty)
989 evas_object_clip_recalc(obj->cur.clipper);
990 obj->cur.clipper->func->render_pre(obj->cur.clipper);
991 }
992 /* if it changed color */
993 if ((obj->cur.color.r != obj->prev.color.r) ||
994 (obj->cur.color.g != obj->prev.color.g) ||
995 (obj->cur.color.b != obj->prev.color.b) ||
996 (obj->cur.color.a != obj->prev.color.a))
997 { o->gradient_changed = 1; o->changed = 1; }
998 if ((!o->gradient_changed) && ((obj->cur.cache.clip.r != obj->prev.cache.clip.r) ||
999 (obj->cur.cache.clip.g != obj->prev.cache.clip.g) ||
1000 (obj->cur.cache.clip.b != obj->prev.cache.clip.b) ||
1001 (obj->cur.cache.clip.a != obj->prev.cache.clip.a)))
1002 { o->gradient_changed = 1; o->changed = 1; }
1003 if (!o->gradient_changed && (obj->cur.interpolation_color_space != obj->prev.interpolation_color_space))
1004 { o->gradient_changed = 1; o->changed = 1; }
1005 if (!o->changed && (obj->cur.render_op != obj->prev.render_op))
1006 o->changed = 1;
1007 if (!o->changed && (obj->cur.anti_alias != obj->prev.anti_alias))
1008 o->changed = 1;
1009 if (o->changed && o->engine_data)
1010 {
1011 Evas_Coord fx, fy, fw, fh;
1012
1013 evas_object_grad_get_fill_coords(obj, o->cur.fill.x, o->cur.fill.y,
1014 o->cur.fill.w, o->cur.fill.h,
1015 &fx, &fy, &fw, &fh);
1016 obj->layer->evas->engine.func->gradient_fill_set(obj->layer->evas->engine.data.output, o->engine_data,
1017 fx, fy, fw, fh);
1018 obj->layer->evas->engine.func->gradient_fill_angle_set(obj->layer->evas->engine.data.output, o->engine_data,
1019 o->cur.fill.angle);
1020 obj->layer->evas->engine.func->gradient_fill_spread_set(obj->layer->evas->engine.data.output, o->engine_data,
1021 o->cur.fill.spread);
1022 obj->layer->evas->engine.func->gradient_angle_set(obj->layer->evas->engine.data.output, o->engine_data,
1023 o->cur.map.angle);
1024 obj->layer->evas->engine.func->gradient_direction_set(obj->layer->evas->engine.data.output, o->engine_data,
1025 o->cur.map.direction);
1026 obj->layer->evas->engine.func->gradient_offset_set(obj->layer->evas->engine.data.output, o->engine_data,
1027 o->cur.map.offset);
1028 if (o->type_changed)
1029 obj->layer->evas->engine.func->gradient_type_set(obj->layer->evas->engine.data.output, o->engine_data,
1030 o->cur.type.name, o->cur.type.params);
1031
1032 obj->layer->evas->engine.func->context_anti_alias_set(obj->layer->evas->engine.data.output,
1033 obj->layer->evas->engine.data.context,
1034 obj->cur.anti_alias);
1035 obj->layer->evas->engine.func->context_render_op_set(obj->layer->evas->engine.data.output,
1036 obj->layer->evas->engine.data.context, obj->cur.render_op);
1037 obj->layer->evas->engine.func->context_multiplier_set(obj->layer->evas->engine.data.output,
1038 obj->layer->evas->engine.data.context,
1039 obj->cur.cache.clip.r, obj->cur.cache.clip.g,
1040 obj->cur.cache.clip.b, obj->cur.cache.clip.a);
1041 obj->layer->evas->engine.func->context_color_interpolation_set(obj->layer->evas->engine.data.output,
1042 obj->layer->evas->engine.data.context,
1043 obj->cur.interpolation_color_space);
1044 if (o->gradient_changed)
1045 obj->layer->evas->engine.func->gradient_render_pre(obj->layer->evas->engine.data.output,
1046 obj->layer->evas->engine.data.context,
1047 o->engine_data);
1048 o->cur.gradient_opaque = obj->layer->evas->engine.func->gradient_is_opaque(obj->layer->evas->engine.data.output,
1049 obj->layer->evas->engine.data.context,
1050 o->engine_data,
1051 obj->cur.cache.clip.x, obj->cur.cache.clip.y,
1052 obj->cur.cache.clip.w, obj->cur.cache.clip.h);
1053
1054 if (obj->cur.cache.clip.a != 255)
1055 o->cur.gradient_opaque = 0;
1056 }
1057 /* now figure what changed and add draw rects */
1058 /* if it just became visible or invisible */
1059 is_v = evas_object_is_visible(obj);
1060 was_v = evas_object_was_visible(obj);
1061 if (is_v != was_v)
1062 {
1063 evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes, obj, is_v, was_v);
1064 goto done;
1065 }
1066 if (obj->cur.map != obj->prev.map)
1067 {
1068 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
1069 goto done;
1070 }
1071 /* its not visible - we accounted for it appearing or not so just abort */
1072 if (!is_v) goto done;
1073 /* clipper changed this is in addition to anything else for obj */
1074 evas_object_render_pre_clipper_change(&obj->layer->evas->clip_changes, obj);
1075 /* gradient changed */
1076 if (o->changed || obj->restack)
1077 {
1078 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
1079 goto done;
1080 }
1081 /* if it changed geometry */
1082 if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
1083 (obj->cur.geometry.y != obj->prev.geometry.y) ||
1084 (obj->cur.geometry.w != obj->prev.geometry.w) ||
1085 (obj->cur.geometry.h != obj->prev.geometry.h))
1086 {
1087 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
1088 goto done;
1089 }
1090 /* it obviously didn't change - add a NO obscure - this "unupdates" this */
1091 /* area so if there were updates for it they get wiped. don't do it if we */
1092 /* arent fully opaque and we are visible */
1093
1094 if (evas_object_is_visible(obj) &&
1095 evas_object_is_opaque(obj))
1096 obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output,
1097 obj->cur.cache.clip.x,
1098 obj->cur.cache.clip.y,
1099 obj->cur.cache.clip.w,
1100 obj->cur.cache.clip.h);
1101
1102 done:
1103 evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, obj, is_v, was_v);
1104}
1105
1106static void
1107evas_object_gradient_render_post(Evas_Object *obj)
1108{
1109 Evas_Object_Gradient *o;
1110
1111 /* this moves the current data to the previous state parts of the object */
1112 /* in whatever way is safest for the object. also if we don't need object */
1113 /* data anymore we can free it if the object deems this is a good idea */
1114 o = (Evas_Object_Gradient *)(obj->object_data);
1115 /* remove those pesky changes */
1116 evas_object_clip_changes_clean(obj);
1117 /* move cur to prev safely for object data */
1118 obj->prev = obj->cur;
1119 if (o->prev.type.name && (o->prev.type.name != o->cur.type.name))
1120 free(o->prev.type.name);
1121 if (o->prev.type.params && (o->prev.type.params != o->cur.type.params))
1122 free(o->prev.type.params);
1123 o->prev = o->cur;
1124 o->changed = 0;
1125 o->gradient_changed = 0;
1126 o->type_changed = 0;
1127}
1128
1129static unsigned int evas_object_gradient_id_get(Evas_Object *obj)
1130{
1131 Evas_Object_Gradient *o;
1132
1133 o = (Evas_Object_Gradient *)(obj->object_data);
1134 if (!o) return 0;
1135 return MAGIC_OBJ_GRADIENT;
1136}
1137
1138static unsigned int evas_object_gradient_visual_id_get(Evas_Object *obj)
1139{
1140 Evas_Object_Gradient *o;
1141
1142 o = (Evas_Object_Gradient *)(obj->object_data);
1143 if (!o) return 0;
1144 return MAGIC_OBJ_GRADIENT;
1145}
1146
1147static void *evas_object_gradient_engine_data_get(Evas_Object *obj)
1148{
1149 Evas_Object_Gradient *o;
1150
1151 o = (Evas_Object_Gradient *)(obj->object_data);
1152 if (!o) return NULL;
1153 return o->engine_data;
1154}
1155
1156static int
1157evas_object_gradient_is_opaque(Evas_Object *obj)
1158{
1159 Evas_Object_Gradient *o;
1160
1161 /* this returns 1 if the internal object data implies that the object is */
1162 /* currently fully opaque over the entire region it occupies */
1163 o = (Evas_Object_Gradient *)(obj->object_data);
1164 if (!o->engine_data) return 0;
1165 if ((obj->cur.map) && (obj->cur.usemap)) return 0;
1166 return o->cur.gradient_opaque;
1167}
1168
1169static int
1170evas_object_gradient_was_opaque(Evas_Object *obj)
1171{
1172 Evas_Object_Gradient *o;
1173
1174 /* this returns 1 if the internal object data implies that the object was */
1175 /* currently fully opaque over the entire region it occupies */
1176 o = (Evas_Object_Gradient *)(obj->object_data);
1177 if (!o->engine_data) return 0;
1178 return o->prev.gradient_opaque;
1179}
diff --git a/legacy/evas/src/lib/canvas/evas_object_gradient2.c b/legacy/evas/src/lib/canvas/evas_object_gradient2.c
deleted file mode 100644
index 6511aa5409..0000000000
--- a/legacy/evas/src/lib/canvas/evas_object_gradient2.c
+++ /dev/null
@@ -1,233 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4typedef struct _Evas_Object_Gradient2 Evas_Object_Gradient2;
5
6struct _Evas_Object_Gradient2
7{
8 DATA32 magic;
9
10 struct {
11 struct {
12 Evas_Common_Transform transform;
13 int spread;
14 } fill;
15 unsigned char gradient_opaque : 1;
16 } cur, prev;
17
18 unsigned char gradient_changed : 1;
19};
20
21
22/**
23 * @addtogroup Evas_Object_Gradient2_Group
24 * @{
25 */
26
27/**
28 * Inserts a color stop to the given evas gradient object.
29 *
30 * The @p pos parameter determines where along the unit interval
31 * [0,1] the color is to be inserted. The r,g,b,a data are assumed
32 * input as being NON-PREMULTIPLIED.
33 *
34 * @param obj The given evas gradient object.
35 * @param r Red component of the given color.
36 * @param g Green component of the given color.
37 * @param b Blue component of the given color.
38 * @param a Alpha component of the given color.
39 * @param pos The pos in [0,1] of this stop.
40 */
41EAPI void
42evas_object_gradient2_color_np_stop_insert(Evas_Object *obj, int r, int g, int b, int a, float pos)
43{
44 Evas_Object_Gradient2 *og;
45 void *engine_data;
46
47 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
48 return;
49 MAGIC_CHECK_END();
50 og = (Evas_Object_Gradient2 *)(obj->object_data);
51 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
52 return;
53 MAGIC_CHECK_END();
54 engine_data = obj->func->engine_data_get(obj);
55 if (engine_data)
56 {
57#ifdef EVAS_FRAME_QUEUING
58 evas_common_pipe_op_grad2_flush(engine_data);
59#endif
60
61 obj->layer->evas->engine.func->gradient2_color_np_stop_insert(obj->layer->evas->engine.data.output,
62 engine_data,
63 r, g, b, a, pos);
64 }
65 og->gradient_changed = 1;
66 evas_object_change(obj);
67}
68
69/**
70 * Deletes all stops set for the given evas gradient object or any set data.
71 * @param obj The given evas gradient object.
72 */
73EAPI void
74evas_object_gradient2_clear(Evas_Object *obj)
75{
76 Evas_Object_Gradient2 *og;
77 void *engine_data;
78
79 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
80 return;
81 MAGIC_CHECK_END();
82 og = (Evas_Object_Gradient2 *)(obj->object_data);
83 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
84 return;
85 MAGIC_CHECK_END();
86 engine_data = obj->func->engine_data_get(obj);
87 if (engine_data)
88 {
89#ifdef EVAS_FRAME_QUEUING
90 evas_common_pipe_op_grad2_flush(engine_data);
91#endif
92 obj->layer->evas->engine.func->gradient2_clear(obj->layer->evas->engine.data.output,
93 engine_data);
94 }
95 og->gradient_changed = 1;
96 og->cur.gradient_opaque = 0;
97 evas_object_change(obj);
98}
99
100
101/**
102 * Sets the tiling mode for the given evas gradient object's fill.
103 * @param obj The given evas gradient object.
104 * @param spread One of EVAS_TEXTURE_REFLECT, EVAS_TEXTURE_REPEAT,
105 * EVAS_TEXTURE_RESTRICT, or EVAS_TEXTURE_PAD.
106 */
107EAPI void
108evas_object_gradient2_fill_spread_set(Evas_Object *obj, int spread)
109{
110 Evas_Object_Gradient2 *og;
111
112 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
113 return;
114 MAGIC_CHECK_END();
115 og = (Evas_Object_Gradient2 *)(obj->object_data);
116 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
117 return;
118 MAGIC_CHECK_END();
119 if (spread == og->cur.fill.spread) return;
120 og->cur.fill.spread = spread;
121 og->gradient_changed = 1;
122 evas_object_change(obj);
123}
124
125/**
126 * Retrieves the spread (tiling mode) for the given gradient object's fill.
127 * @param obj The given evas gradient object.
128 * @return The current spread mode of the gradient object.
129 */
130EAPI int
131evas_object_gradient2_fill_spread_get(const Evas_Object *obj)
132{
133 Evas_Object_Gradient2 *og;
134
135 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
136 return EVAS_TEXTURE_REPEAT;
137 MAGIC_CHECK_END();
138 og = (Evas_Object_Gradient2 *)(obj->object_data);
139 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
140 return EVAS_TEXTURE_REPEAT;
141 MAGIC_CHECK_END();
142 return og->cur.fill.spread;
143}
144
145/* FIXME: To be documented*/
146EAPI void
147evas_object_gradient2_fill_transform_set (Evas_Object *obj, Evas_Transform *t)
148{
149 Evas_Object_Gradient2 *og;
150
151 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
152 return;
153 MAGIC_CHECK_END();
154 og = (Evas_Object_Gradient2 *)(obj->object_data);
155 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
156 return;
157 MAGIC_CHECK_END();
158 if (!t)
159 {
160 og->cur.fill.transform.mxx = 1;
161 og->cur.fill.transform.mxy = 0;
162 og->cur.fill.transform.mxz = 0;
163 og->cur.fill.transform.myx = 0;
164 og->cur.fill.transform.myy = 1;
165 og->cur.fill.transform.myz = 0;
166 og->cur.fill.transform.mzx = 0;
167 og->cur.fill.transform.mzy = 0;
168 og->cur.fill.transform.mzz = 1;
169
170 og->gradient_changed = 1;
171 evas_object_change(obj);
172 return;
173 }
174 if ( (og->cur.fill.transform.mxx == t->mxx) ||
175 (og->cur.fill.transform.mxy == t->mxy) ||
176 (og->cur.fill.transform.mxy == t->mxy) ||
177 (og->cur.fill.transform.mxy == t->mxy) ||
178 (og->cur.fill.transform.mxy == t->mxy) ||
179 (og->cur.fill.transform.mxy == t->mxy) ||
180 (og->cur.fill.transform.mxy == t->mxy) ||
181 (og->cur.fill.transform.mxy == t->mxy) ||
182 (og->cur.fill.transform.mxy == t->mxy) )
183 return;
184
185 og->cur.fill.transform.mxx = t->mxx;
186 og->cur.fill.transform.mxy = t->mxy;
187 og->cur.fill.transform.mxz = t->mxz;
188 og->cur.fill.transform.myx = t->myx;
189 og->cur.fill.transform.myy = t->myy;
190 og->cur.fill.transform.myz = t->myz;
191 og->cur.fill.transform.mzx = t->mzx;
192 og->cur.fill.transform.mzy = t->mzy;
193 og->cur.fill.transform.mzz = t->mzz;
194
195 og->gradient_changed = 1;
196 evas_object_change(obj);
197}
198
199/* FIXME: To be documented*/
200EAPI void
201evas_object_gradient2_fill_transform_get (const Evas_Object *obj, Evas_Transform *t)
202{
203 Evas_Object_Gradient2 *og;
204
205 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
206 return;
207 MAGIC_CHECK_END();
208 og = (Evas_Object_Gradient2 *)(obj->object_data);
209 MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
210 return;
211 MAGIC_CHECK_END();
212 if (t)
213 {
214 t->mxx = og->cur.fill.transform.mxx;
215 t->mxy = og->cur.fill.transform.mxy;
216 t->mxz = og->cur.fill.transform.mxz;
217 t->myx = og->cur.fill.transform.myx;
218 t->myy = og->cur.fill.transform.myy;
219 t->myz = og->cur.fill.transform.myz;
220 t->mzx = og->cur.fill.transform.mzx;
221 t->mzy = og->cur.fill.transform.mzy;
222 t->mzz = og->cur.fill.transform.mzz;
223 }
224}
225
226
227
228/**
229 * @}
230 */
231
232#include "evas_object_gradient2_linear.c"
233#include "evas_object_gradient2_radial.c"
diff --git a/legacy/evas/src/lib/canvas/evas_object_gradient2_linear.c b/legacy/evas/src/lib/canvas/evas_object_gradient2_linear.c
deleted file mode 100644
index 435846329b..0000000000
--- a/legacy/evas/src/lib/canvas/evas_object_gradient2_linear.c
+++ /dev/null
@@ -1,474 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4/* private magic number for linear gradient objects */
5static const char lg_type[] = "linear_gradient";
6
7/* private struct for gradient object internal data */
8typedef struct _Evas_Object_Gradient2_Linear Evas_Object_Gradient2_Linear;
9
10struct _Evas_Object_Gradient2_Linear
11{
12 Evas_Object_Gradient2 base;
13
14 DATA32 magic;
15
16 struct {
17 struct {
18 float x0, y0, x1, y1;
19 } fill;
20 } cur, prev;
21
22 void *engine_data;
23
24 unsigned char gradient_changed : 1;
25 unsigned char changed : 1;
26};
27
28/* private methods for linear gradient objects */
29static void evas_object_gradient2_linear_init(Evas_Object *obj);
30static void *evas_object_gradient2_linear_new(void);
31
32static void evas_object_gradient2_linear_free(Evas_Object *obj);
33static void evas_object_gradient2_linear_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
34static void evas_object_gradient2_linear_render_pre(Evas_Object *obj);
35static void evas_object_gradient2_linear_render_post(Evas_Object *obj);
36
37static unsigned int evas_object_gradient2_linear_id_get(Evas_Object *obj);
38static unsigned int evas_object_gradient2_linear_visual_id_get(Evas_Object *obj);
39static void *evas_object_gradient2_linear_engine_data_get(Evas_Object *obj);
40
41static int evas_object_gradient2_linear_is_opaque(Evas_Object *obj);
42static int evas_object_gradient2_linear_was_opaque(Evas_Object *obj);
43
44static const Evas_Object_Func object_func =
45{
46 /* methods (compulsory) */
47 evas_object_gradient2_linear_free,
48 evas_object_gradient2_linear_render,
49 evas_object_gradient2_linear_render_pre,
50 evas_object_gradient2_linear_render_post,
51 evas_object_gradient2_linear_id_get,
52 evas_object_gradient2_linear_visual_id_get,
53 evas_object_gradient2_linear_engine_data_get,
54 /* these are optional. NULL = nothing */
55 NULL,
56 NULL,
57 NULL,
58 NULL,
59 evas_object_gradient2_linear_is_opaque,
60 evas_object_gradient2_linear_was_opaque,
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 NULL,
66 NULL,
67 NULL
68};
69
70/* the actual api call to add a gradient */
71
72/**
73 * @addtogroup Evas_Object_Gradient2_Group
74 * @{
75 * @ingroup Evas_Object_Specific
76 */
77
78/**
79 * Adds a gradient object to the given evas.
80 * @param e The given evas.
81 * @return A new evas gradient object if successful. Otherwise, @c NULL.
82 */
83EAPI Evas_Object *
84evas_object_gradient2_linear_add(Evas *e)
85{
86 Evas_Object *obj;
87
88 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
89 return NULL;
90 MAGIC_CHECK_END();
91 obj = evas_object_new(e);
92 evas_object_gradient2_linear_init(obj);
93 evas_object_inject(obj, e);
94 if (obj->object_data)
95 {
96 Evas_Object_Gradient2_Linear *o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
97
98 o->engine_data = e->engine.func->gradient2_linear_new(e->engine.data.output);
99 }
100 return obj;
101}
102
103
104/**
105 * Sets the start and end points of the linear gradient geometry for the object.
106 *
107 * Note that the gradient may extend beyond these,
108 * according to its spread value - restrict, repeat, or reflect. To have
109 * only one 'cycle' of the gradient drawn, the spread value must be set
110 * to restrict.
111 * The default values for the fill parameters is @p x0 = 0, @p y0 = 0,
112 * @p x1 = 0 and @p y1 = 0.
113 *
114 * @param obj The given evas linear gradient object.
115 * @param x0 The X coordinate of the start point.
116 * @param y0 The Y coordinate of the start point.
117 * @param x1 The X coordinate of the end point.
118 * @param y1 The Y coordinate of the end point
119 */
120EAPI void
121evas_object_gradient2_linear_fill_set(Evas_Object *obj, float x0, float y0, float x1, float y1)
122{
123 Evas_Object_Gradient2_Linear *o;
124 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
125 return;
126 MAGIC_CHECK_END();
127 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
128 MAGIC_CHECK(o, Evas_Object_Gradient2_Linear, MAGIC_OBJ_GRADIENT_LINEAR);
129 return;
130 MAGIC_CHECK_END();
131 if ((o->cur.fill.x0 == x0) &&
132 (o->cur.fill.y0 == y0) &&
133 (o->cur.fill.x1 == x1) &&
134 (o->cur.fill.y1 == y1)) return;
135 o->cur.fill.x0 = x0;
136 o->cur.fill.y0 = y0;
137 o->cur.fill.x1 = x1;
138 o->cur.fill.y1 = y1;
139 o->gradient_changed = 1;
140 o->changed = 1;
141 evas_object_change(obj);
142}
143
144/*FIXME: To be documented*/
145EAPI void
146evas_object_gradient2_linear_fill_get(const Evas_Object *obj, float *x0, float *y0, float *x1, float *y1)
147{
148 Evas_Object_Gradient2_Linear *o;
149
150 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
151 if (x0) *x0 = 0;
152 if (y0) *y0 = 0;
153 if (x1) *x1 = 0;
154 if (y1) *y1 = 0;
155 return;
156 MAGIC_CHECK_END();
157 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
158 MAGIC_CHECK(o, Evas_Object_Gradient2_Linear, MAGIC_OBJ_GRADIENT_LINEAR);
159 if (x0) *x0 = 0;
160 if (y0) *y0 = 0;
161 if (x1) *x1 = 0;
162 if (y1) *y1 = 0;
163 return;
164 MAGIC_CHECK_END();
165 if (x0) *x0 = o->cur.fill.x0;
166 if (y0) *y0 = o->cur.fill.y0;
167 if (x1) *x1 = o->cur.fill.x1;
168 if (y1) *y1 = o->cur.fill.y1;
169 return;
170}
171
172/**
173 * @}
174 */
175
176/* all nice and private */
177static void
178evas_object_gradient2_linear_init(Evas_Object *obj)
179{
180 /* alloc grad ob, setup methods and default values */
181 obj->object_data = evas_object_gradient2_linear_new();
182 /* set up default settings for this kind of object */
183 obj->cur.color.r = 255;
184 obj->cur.color.g = 255;
185 obj->cur.color.b = 255;
186 obj->cur.color.a = 255;
187 obj->cur.geometry.x = 0;
188 obj->cur.geometry.y = 0;
189 obj->cur.geometry.w = 0;
190 obj->cur.geometry.h = 0;
191 obj->cur.layer = 0;
192 obj->cur.anti_alias = 1;
193 obj->cur.interpolation_color_space = EVAS_COLOR_SPACE_ARGB;
194 obj->cur.render_op = EVAS_RENDER_BLEND;
195 /* set up object-specific settings */
196 obj->prev = obj->cur;
197 /* set up methods (compulsory) */
198 obj->func = &object_func;
199 obj->type = lg_type;
200 obj->changed = 1;
201}
202
203static void *
204evas_object_gradient2_linear_new(void)
205{
206 Evas_Object_Gradient2_Linear *o;
207 Evas_Object_Gradient2 *og;
208
209 /* alloc obj private data */
210 o = calloc(1, sizeof(Evas_Object_Gradient2_Linear));
211 if (!o) return NULL;
212 o->magic = MAGIC_OBJ_GRADIENT_LINEAR;
213 o->cur.fill.x0 = 0;
214 o->cur.fill.y0 = 0;
215 o->cur.fill.x1 = 1;
216 o->cur.fill.y1 = 1;
217 og = (Evas_Object_Gradient2 *)o;
218 og->magic = MAGIC_OBJ_GRADIENT;
219 og->cur.fill.transform.mxx = og->cur.fill.transform.myy = og->cur.fill.transform.mzz = 1;
220 og->cur.fill.spread = EVAS_TEXTURE_REPEAT;
221 og->cur.gradient_opaque = 0;
222 og->prev = og->cur;
223 og->gradient_changed = 1;
224 o->prev = o->cur;
225 o->changed = 1;
226 o->gradient_changed = 1;
227 return o;
228}
229
230static void
231evas_object_gradient2_linear_free(Evas_Object *obj)
232{
233 Evas_Object_Gradient2_Linear *o;
234
235 /* frees private object data. very simple here */
236 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
237 MAGIC_CHECK(o, Evas_Object_Gradient2_Linear, MAGIC_OBJ_GRADIENT_LINEAR);
238 return;
239 MAGIC_CHECK_END();
240 /* free obj */
241 if (o->engine_data)
242 obj->layer->evas->engine.func->gradient2_linear_free(obj->layer->evas->engine.data.output,
243 o->engine_data);
244 free(o);
245 obj->object_data = NULL;
246}
247
248
249
250static void
251evas_object_gradient2_linear_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
252{
253 Evas_Object_Gradient2_Linear *o;
254
255 /* render object to surface with context, and offxet by x,y */
256 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
257 obj->layer->evas->engine.func->context_multiplier_unset(output, context);
258 obj->layer->evas->engine.func->context_anti_alias_set(output, context, obj->cur.anti_alias);
259 obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op);
260 if (o->engine_data)
261 {
262 obj->layer->evas->engine.func->gradient2_linear_draw(output, context, surface,
263 o->engine_data,
264 obj->cur.geometry.x + x,
265 obj->cur.geometry.y + y,
266 obj->cur.geometry.w,
267 obj->cur.geometry.h);
268 }
269}
270
271static void
272evas_object_gradient2_linear_render_pre(Evas_Object *obj)
273{
274 Evas_Object_Gradient2_Linear *o;
275 Evas_Object_Gradient2 *og;
276 int is_v, was_v;
277
278 /* dont pre-render the obj twice! */
279 if (obj->pre_render_done) return;
280 obj->pre_render_done = 1;
281 /* pre-render phase. this does anything an object needs to do just before */
282 /* rendering. this could mean loading the image data, retrieving it from */
283 /* elsewhere, decoding video etc. */
284 /* then when this is done the object needs to figure if it changed and */
285 /* if so what and where and add the appropriate redraw rectangles */
286 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
287 og = (Evas_Object_Gradient2 *)(o);
288 /* if someone is clipping this obj - go calculate the clipper */
289 if (obj->cur.clipper)
290 {
291 if (obj->cur.cache.clip.dirty)
292 evas_object_clip_recalc(obj->cur.clipper);
293 obj->cur.clipper->func->render_pre(obj->cur.clipper);
294 }
295 /* if it changed color */
296 if ((obj->cur.color.r != obj->prev.color.r) ||
297 (obj->cur.color.g != obj->prev.color.g) ||
298 (obj->cur.color.b != obj->prev.color.b) ||
299 (obj->cur.color.a != obj->prev.color.a))
300 { o->gradient_changed = 1; o->changed = 1; }
301 if ((!o->gradient_changed) && ((obj->cur.cache.clip.r != obj->prev.cache.clip.r) ||
302 (obj->cur.cache.clip.g != obj->prev.cache.clip.g) ||
303 (obj->cur.cache.clip.b != obj->prev.cache.clip.b) ||
304 (obj->cur.cache.clip.a != obj->prev.cache.clip.a)))
305 { o->gradient_changed = 1; o->changed = 1; }
306 if (!o->gradient_changed && (obj->cur.interpolation_color_space != obj->prev.interpolation_color_space))
307 { o->gradient_changed = 1; o->changed = 1; }
308 if (!o->changed && (obj->cur.render_op != obj->prev.render_op))
309 o->changed = 1;
310// if (!o->changed && (obj->cur.anti_alias != obj->prev.anti_alias))
311// o->changed = 1;
312 if (og->gradient_changed)
313 { o->gradient_changed = 1; o->changed = 1; }
314 if (o->changed && o->engine_data)
315 {
316 obj->layer->evas->engine.func->context_render_op_set(obj->layer->evas->engine.data.output,
317 obj->layer->evas->engine.data.context, obj->cur.render_op);
318 obj->layer->evas->engine.func->context_multiplier_set(obj->layer->evas->engine.data.output,
319 obj->layer->evas->engine.data.context,
320 obj->cur.cache.clip.r, obj->cur.cache.clip.g,
321 obj->cur.cache.clip.b, obj->cur.cache.clip.a);
322 obj->layer->evas->engine.func->context_color_interpolation_set(obj->layer->evas->engine.data.output,
323 obj->layer->evas->engine.data.context,
324 obj->cur.interpolation_color_space);
325 if (o->gradient_changed)
326 {
327 obj->layer->evas->engine.func->gradient2_linear_fill_set(obj->layer->evas->engine.data.output, o->engine_data, o->cur.fill.x0, o->cur.fill.y0, o->cur.fill.x1, o->cur.fill.y1);
328 obj->layer->evas->engine.func->gradient2_fill_transform_set(obj->layer->evas->engine.data.output, o->engine_data,
329 &og->cur.fill.transform);
330 obj->layer->evas->engine.func->gradient2_fill_spread_set(obj->layer->evas->engine.data.output, o->engine_data,
331 og->cur.fill.spread);
332 obj->layer->evas->engine.func->gradient2_linear_render_pre(obj->layer->evas->engine.data.output,
333 obj->layer->evas->engine.data.context,
334 o->engine_data);
335 }
336 og->cur.gradient_opaque = obj->layer->evas->engine.func->gradient2_linear_is_opaque(obj->layer->evas->engine.data.output,
337 obj->layer->evas->engine.data.context,
338 o->engine_data,
339 obj->cur.cache.clip.x, obj->cur.cache.clip.y,
340 obj->cur.cache.clip.w, obj->cur.cache.clip.h);
341
342 if (obj->cur.cache.clip.a != 255)
343 og->cur.gradient_opaque = 0;
344 }
345
346 /* now figure what changed and add draw rects */
347 /* if it just became visible or invisible */
348 is_v = evas_object_is_visible(obj);
349 was_v = evas_object_was_visible(obj);
350 if (is_v != was_v)
351 {
352 evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes, obj, is_v, was_v);
353 goto done;
354 }
355 if ((obj->cur.map != obj->prev.map) ||
356 (obj->cur.usemap != obj->prev.usemap))
357 {
358 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
359 goto done;
360 }
361 /* its not visible - we accounted for it appearing or not so just abort */
362 if (!is_v) goto done;
363 /* clipper changed this is in addition to anything else for obj */
364 evas_object_render_pre_clipper_change(&obj->layer->evas->clip_changes, obj);
365 /* gradient changed */
366 if (o->changed || obj->restack)
367 {
368 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
369 goto done;
370 }
371 /* if it changed geometry */
372 if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
373 (obj->cur.geometry.y != obj->prev.geometry.y) ||
374 (obj->cur.geometry.w != obj->prev.geometry.w) ||
375 (obj->cur.geometry.h != obj->prev.geometry.h))
376 {
377 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
378 goto done;
379 }
380 /* it obviously didn't change - add a NO obscure - this "unupdates" this */
381 /* area so if there were updates for it they get wiped. don't do it if we */
382 /* arent fully opaque and we are visible */
383
384 if (evas_object_is_visible(obj) &&
385 evas_object_is_opaque(obj))
386 obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output,
387 obj->cur.cache.clip.x,
388 obj->cur.cache.clip.y,
389 obj->cur.cache.clip.w,
390 obj->cur.cache.clip.h);
391
392 done:
393 evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, obj, is_v, was_v);
394}
395
396static void
397evas_object_gradient2_linear_render_post(Evas_Object *obj)
398{
399 Evas_Object_Gradient2_Linear *o;
400 Evas_Object_Gradient2 *og;
401
402 /* this moves the current data to the previous state parts of the object */
403 /* in whatever way is safest for the object. also if we don't need object */
404 /* data anymore we can free it if the object deems this is a good idea */
405 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
406 og = (Evas_Object_Gradient2 *)(o);
407 /* remove those pesky changes */
408 evas_object_clip_changes_clean(obj);
409 /* move cur to prev safely for object data */
410 obj->prev = obj->cur;
411 obj->changed = 0;
412 o->prev = o->cur;
413 o->changed = 0;
414 o->gradient_changed = 0;
415 og->prev = og->cur;
416 og->gradient_changed = 0;
417}
418
419static unsigned int evas_object_gradient2_linear_id_get(Evas_Object *obj)
420{
421 Evas_Object_Gradient2_Linear *o;
422
423 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
424 if (!o) return 0;
425 return MAGIC_OBJ_GRADIENT_LINEAR;
426}
427
428static unsigned int evas_object_gradient2_linear_visual_id_get(Evas_Object *obj)
429{
430 Evas_Object_Gradient2_Linear *o;
431
432 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
433 if (!o) return 0;
434 return MAGIC_OBJ_GRADIENT;
435}
436
437static void *evas_object_gradient2_linear_engine_data_get(Evas_Object *obj)
438{
439 Evas_Object_Gradient2_Linear *o;
440
441 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
442 if (!o) return NULL;
443 return o->engine_data;
444}
445
446
447static int
448evas_object_gradient2_linear_is_opaque(Evas_Object *obj)
449{
450 Evas_Object_Gradient2_Linear *o;
451 Evas_Object_Gradient2 *og;
452
453 /* this returns 1 if the internal object data implies that the object is */
454 /* currently fully opaque over the entire region it occupies */
455 if ((obj->cur.map) && (obj->cur.usemap)) return 0;
456 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
457 if (!o->engine_data) return 0;
458 og = (Evas_Object_Gradient2 *)(o);
459 return og->cur.gradient_opaque;
460 }
461
462static int
463evas_object_gradient2_linear_was_opaque(Evas_Object *obj)
464{
465 Evas_Object_Gradient2_Linear *o;
466 Evas_Object_Gradient2 *og;
467
468 /* this returns 1 if the internal object data implies that the object was */
469 /* currently fully opaque over the entire region it occupies */
470 o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
471 if (!o->engine_data) return 0;
472 og = (Evas_Object_Gradient2 *)(o);
473 return og->prev.gradient_opaque;
474}
diff --git a/legacy/evas/src/lib/canvas/evas_object_gradient2_radial.c b/legacy/evas/src/lib/canvas/evas_object_gradient2_radial.c
deleted file mode 100644
index a0048bebd3..0000000000
--- a/legacy/evas/src/lib/canvas/evas_object_gradient2_radial.c
+++ /dev/null
@@ -1,471 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4/* private magic number for radial gradient objects */
5static const char rg_type[] = "radial_gradient";
6
7/* private struct for gradient object internal data */
8typedef struct _Evas_Object_Gradient2_Radial Evas_Object_Gradient2_Radial;
9
10struct _Evas_Object_Gradient2_Radial
11{
12 Evas_Object_Gradient2 base;
13
14 DATA32 magic;
15
16 struct {
17 struct {
18 float cx, cy, rx, ry;
19 } fill;
20 } cur, prev;
21
22 void *engine_data;
23
24 unsigned char gradient_changed : 1;
25 unsigned char changed : 1;
26};
27
28/* private methods for radial gradient objects */
29static void evas_object_gradient2_radial_init(Evas_Object *obj);
30static void *evas_object_gradient2_radial_new(void);
31
32static void evas_object_gradient2_radial_free(Evas_Object *obj);
33static void evas_object_gradient2_radial_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y);
34static void evas_object_gradient2_radial_render_pre(Evas_Object *obj);
35static void evas_object_gradient2_radial_render_post(Evas_Object *obj);
36
37static unsigned int evas_object_gradient2_radial_id_get(Evas_Object *obj);
38static unsigned int evas_object_gradient2_radial_visual_id_get(Evas_Object *obj);
39static void *evas_object_gradient2_radial_engine_data_get(Evas_Object *obj);
40
41static int evas_object_gradient2_radial_is_opaque(Evas_Object *obj);
42static int evas_object_gradient2_radial_was_opaque(Evas_Object *obj);
43
44static const Evas_Object_Func rg_object_func =
45{
46 /* methods (compulsory) */
47 evas_object_gradient2_radial_free,
48 evas_object_gradient2_radial_render,
49 evas_object_gradient2_radial_render_pre,
50 evas_object_gradient2_radial_render_post,
51 evas_object_gradient2_radial_id_get,
52 evas_object_gradient2_radial_visual_id_get,
53 evas_object_gradient2_radial_engine_data_get,
54 /* these are optional. NULL = nothing */
55 NULL,
56 NULL,
57 NULL,
58 NULL,
59 evas_object_gradient2_radial_is_opaque,
60 evas_object_gradient2_radial_was_opaque,
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 NULL,
66 NULL,
67 NULL
68};
69
70/* the actual api call to add a gradient */
71
72/**
73 * @addtogroup Evas_Object_Gradient2_Group
74 * @{
75 * @ingroup Evas_Object_Specific
76 */
77
78/**
79 * Adds a gradient object to the given evas.
80 * @param e The given evas.
81 * @return A new evas gradient object if successful. Otherwise, @c NULL.
82 */
83EAPI Evas_Object *
84evas_object_gradient2_radial_add(Evas *e)
85{
86 Evas_Object *obj;
87
88 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
89 return NULL;
90 MAGIC_CHECK_END();
91 obj = evas_object_new(e);
92 evas_object_gradient2_radial_init(obj);
93 evas_object_inject(obj, e);
94 if (obj->object_data)
95 {
96 Evas_Object_Gradient2_Radial *o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
97
98 o->engine_data = e->engine.func->gradient2_radial_new(e->engine.data.output);
99 }
100 return obj;
101}
102
103/**
104 * Sets the center and radii of the radial gradient geometry for the object.
105 *
106 * Note that the gradient may extend beyond these,
107 * according to its spread value - restrict, repeat, or reflect. To have
108 * only one 'cycle' of the gradient drawn, the spread value must be set
109 * to restrict.
110 * The default values for the fill parameters is @p cx = 0, @p cy = 0,
111 * @p rx = 0 and @p ry = 0.
112 *
113 * @param obj The given evas radial gradient object.
114 * @param cx The X coordinate of the start point.
115 * @param cy The Y coordinate of the start point.
116 * @param rx The length of the x-cordinate radius.
117 * @param ry The length of the y-coordinate radius.
118 */
119EAPI void
120evas_object_gradient2_radial_fill_set(Evas_Object *obj, float cx, float cy, float rx, float ry)
121{
122 Evas_Object_Gradient2_Radial *o;
123 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
124 return;
125 MAGIC_CHECK_END();
126 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
127 MAGIC_CHECK(o, Evas_Object_Gradient2_Radial, MAGIC_OBJ_GRADIENT_RADIAL);
128 return;
129 MAGIC_CHECK_END();
130 if ((o->cur.fill.cx == cx) &&
131 (o->cur.fill.cy == cy) &&
132 (o->cur.fill.rx == rx) &&
133 (o->cur.fill.ry == ry)) return;
134 o->cur.fill.cx = cx;
135 o->cur.fill.cy = cy;
136 o->cur.fill.rx = rx;
137 o->cur.fill.ry = ry;
138 o->gradient_changed = 1;
139 o->changed = 1;
140 evas_object_change(obj);
141}
142
143EAPI void
144evas_object_gradient2_radial_fill_get(const Evas_Object *obj, float *cx, float *cy, float *rx, float *ry)
145{
146 Evas_Object_Gradient2_Radial *o;
147
148 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
149 if (cx) *cx = 0;
150 if (cy) *cy = 0;
151 if (rx) *rx = 0;
152 if (ry) *ry = 0;
153 return;
154 MAGIC_CHECK_END();
155 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
156 MAGIC_CHECK(o, Evas_Object_Gradient2_Radial, MAGIC_OBJ_GRADIENT_RADIAL);
157 if (cx) *cx = 0;
158 if (cy) *cy = 0;
159 if (rx) *rx = 0;
160 if (ry) *ry = 0;
161 return;
162 MAGIC_CHECK_END();
163 if (cx) *cx = o->cur.fill.cx;
164 if (cy) *cy = o->cur.fill.cy;
165 if (rx) *rx = o->cur.fill.rx;
166 if (ry) *ry = o->cur.fill.ry;
167 return;
168}
169
170/**
171 * @}
172 */
173
174/* all nice and private */
175static void
176evas_object_gradient2_radial_init(Evas_Object *obj)
177{
178 /* alloc grad ob, setup methods and default values */
179 obj->object_data = evas_object_gradient2_radial_new();
180 /* set up default settings for this kind of object */
181 obj->cur.color.r = 255;
182 obj->cur.color.g = 255;
183 obj->cur.color.b = 255;
184 obj->cur.color.a = 255;
185 obj->cur.geometry.x = 0;
186 obj->cur.geometry.y = 0;
187 obj->cur.geometry.w = 0;
188 obj->cur.geometry.h = 0;
189 obj->cur.layer = 0;
190 obj->cur.anti_alias = 1;
191 obj->cur.interpolation_color_space = EVAS_COLOR_SPACE_ARGB;
192 obj->cur.render_op = EVAS_RENDER_BLEND;
193 /* set up object-specific settings */
194 obj->prev = obj->cur;
195 /* set up methods (compulsory) */
196 obj->func = &rg_object_func;
197 obj->type = rg_type;
198 obj->changed = 1;
199}
200
201static void *
202evas_object_gradient2_radial_new(void)
203{
204 Evas_Object_Gradient2_Radial *o;
205 Evas_Object_Gradient2 *og;
206
207 /* alloc obj private data */
208 o = calloc(1, sizeof(Evas_Object_Gradient2_Radial));
209 if (!o) return NULL;
210 o->magic = MAGIC_OBJ_GRADIENT_RADIAL;
211 o->cur.fill.cx = 0;
212 o->cur.fill.cy = 0;
213 o->cur.fill.rx = 1;
214 o->cur.fill.ry = 1;
215 og = (Evas_Object_Gradient2 *)o;
216 og->magic = MAGIC_OBJ_GRADIENT;
217 og->cur.fill.transform.mxx = og->cur.fill.transform.myy = og->cur.fill.transform.mzz = 1;
218 og->cur.fill.spread = EVAS_TEXTURE_REPEAT;
219 og->cur.gradient_opaque = 0;
220 og->prev = og->cur;
221 og->gradient_changed = 1;
222 o->prev = o->cur;
223 o->changed = 1;
224 o->gradient_changed = 1;
225 return o;
226}
227
228static void
229evas_object_gradient2_radial_free(Evas_Object *obj)
230{
231 Evas_Object_Gradient2_Radial *o;
232
233 /* frees private object data. very simple here */
234 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
235 MAGIC_CHECK(o, Evas_Object_Gradient2_Radial, MAGIC_OBJ_GRADIENT_RADIAL);
236 return;
237 MAGIC_CHECK_END();
238 /* free obj */
239 if (o->engine_data)
240 obj->layer->evas->engine.func->gradient2_radial_free(obj->layer->evas->engine.data.output,
241 o->engine_data);
242 free(o);
243 obj->object_data = NULL;
244}
245
246
247
248static void
249evas_object_gradient2_radial_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
250{
251 Evas_Object_Gradient2_Radial *o;
252
253 /* render object to surface with context, and offxet by x,y */
254 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
255 obj->layer->evas->engine.func->context_multiplier_unset(output, context);
256 obj->layer->evas->engine.func->context_anti_alias_set(output, context, obj->cur.anti_alias);
257 obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op);
258 if (o->engine_data)
259 {
260 obj->layer->evas->engine.func->gradient2_radial_draw(output, context, surface,
261 o->engine_data,
262 obj->cur.geometry.x + x,
263 obj->cur.geometry.y + y,
264 obj->cur.geometry.w,
265 obj->cur.geometry.h);
266 }
267}
268
269static void
270evas_object_gradient2_radial_render_pre(Evas_Object *obj)
271{
272 Evas_Object_Gradient2_Radial *o;
273 Evas_Object_Gradient2 *og;
274 int is_v, was_v;
275
276 /* dont pre-render the obj twice! */
277 if (obj->pre_render_done) return;
278 obj->pre_render_done = 1;
279 /* pre-render phase. this does anything an object needs to do just before */
280 /* rendering. this could mean loading the image data, retrieving it from */
281 /* elsewhere, decoding video etc. */
282 /* then when this is done the object needs to figure if it changed and */
283 /* if so what and where and add the appropriate redraw rectangles */
284 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
285 og = (Evas_Object_Gradient2 *)(o);
286 /* if someone is clipping this obj - go calculate the clipper */
287 if (obj->cur.clipper)
288 {
289 if (obj->cur.cache.clip.dirty)
290 evas_object_clip_recalc(obj->cur.clipper);
291 obj->cur.clipper->func->render_pre(obj->cur.clipper);
292 }
293 /* if it changed color */
294 if ((obj->cur.color.r != obj->prev.color.r) ||
295 (obj->cur.color.g != obj->prev.color.g) ||
296 (obj->cur.color.b != obj->prev.color.b) ||
297 (obj->cur.color.a != obj->prev.color.a))
298 { o->gradient_changed = 1; o->changed = 1; }
299 if ((!o->gradient_changed) && ((obj->cur.cache.clip.r != obj->prev.cache.clip.r) ||
300 (obj->cur.cache.clip.g != obj->prev.cache.clip.g) ||
301 (obj->cur.cache.clip.b != obj->prev.cache.clip.b) ||
302 (obj->cur.cache.clip.a != obj->prev.cache.clip.a)))
303 { o->gradient_changed = 1; o->changed = 1; }
304 if (!o->gradient_changed && (obj->cur.interpolation_color_space != obj->prev.interpolation_color_space))
305 { o->gradient_changed = 1; o->changed = 1; }
306 if (!o->changed && (obj->cur.render_op != obj->prev.render_op))
307 o->changed = 1;
308// if (!o->changed && (obj->cur.anti_alias != obj->prev.anti_alias))
309// o->changed = 1;
310 if (og->gradient_changed)
311 { o->gradient_changed = 1; o->changed = 1; }
312 if (o->changed && o->engine_data)
313 {
314 obj->layer->evas->engine.func->context_render_op_set(obj->layer->evas->engine.data.output,
315 obj->layer->evas->engine.data.context, obj->cur.render_op);
316 obj->layer->evas->engine.func->context_multiplier_set(obj->layer->evas->engine.data.output,
317 obj->layer->evas->engine.data.context,
318 obj->cur.cache.clip.r, obj->cur.cache.clip.g,
319 obj->cur.cache.clip.b, obj->cur.cache.clip.a);
320 obj->layer->evas->engine.func->context_color_interpolation_set(obj->layer->evas->engine.data.output,
321 obj->layer->evas->engine.data.context,
322 obj->cur.interpolation_color_space);
323 if (o->gradient_changed)
324 {
325 obj->layer->evas->engine.func->gradient2_radial_fill_set(obj->layer->evas->engine.data.output, o->engine_data, o->cur.fill.cx, o->cur.fill.cy, o->cur.fill.rx, o->cur.fill.ry);
326 obj->layer->evas->engine.func->gradient2_fill_transform_set(obj->layer->evas->engine.data.output, o->engine_data,
327 &og->cur.fill.transform);
328 obj->layer->evas->engine.func->gradient2_fill_spread_set(obj->layer->evas->engine.data.output, o->engine_data,
329 og->cur.fill.spread);
330 obj->layer->evas->engine.func->gradient2_radial_render_pre(obj->layer->evas->engine.data.output,
331 obj->layer->evas->engine.data.context,
332 o->engine_data);
333 }
334 og->cur.gradient_opaque = obj->layer->evas->engine.func->gradient2_radial_is_opaque(obj->layer->evas->engine.data.output,
335 obj->layer->evas->engine.data.context,
336 o->engine_data,
337 obj->cur.cache.clip.x, obj->cur.cache.clip.y,
338 obj->cur.cache.clip.w, obj->cur.cache.clip.h);
339
340 if (obj->cur.cache.clip.a != 255)
341 og->cur.gradient_opaque = 0;
342 }
343 /* now figure what changed and add draw rects */
344 /* if it just became visible or invisible */
345 is_v = evas_object_is_visible(obj);
346 was_v = evas_object_was_visible(obj);
347 if (is_v != was_v)
348 {
349 evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes, obj, is_v, was_v);
350 goto done;
351 }
352 if ((obj->cur.map != obj->prev.map) ||
353 (obj->cur.usemap != obj->prev.usemap))
354 {
355 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
356 goto done;
357 }
358 /* its not visible - we accounted for it appearing or not so just abort */
359 if (!is_v) goto done;
360 /* clipper changed this is in addition to anything else for obj */
361 evas_object_render_pre_clipper_change(&obj->layer->evas->clip_changes, obj);
362 /* gradient changed */
363 if (o->changed || obj->restack)
364 {
365 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
366 goto done;
367 }
368 /* if it changed geometry */
369 if ((obj->cur.geometry.x != obj->prev.geometry.x) ||
370 (obj->cur.geometry.y != obj->prev.geometry.y) ||
371 (obj->cur.geometry.w != obj->prev.geometry.w) ||
372 (obj->cur.geometry.h != obj->prev.geometry.h))
373 {
374 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
375 goto done;
376 }
377 /* it obviously didn't change - add a NO obscure - this "unupdates" this */
378 /* area so if there were updates for it they get wiped. don't do it if we */
379 /* arent fully opaque and we are visible */
380
381 if (evas_object_is_visible(obj) &&
382 evas_object_is_opaque(obj))
383 obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output,
384 obj->cur.cache.clip.x,
385 obj->cur.cache.clip.y,
386 obj->cur.cache.clip.w,
387 obj->cur.cache.clip.h);
388
389 done:
390 evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, obj, is_v, was_v);
391}
392
393static void
394evas_object_gradient2_radial_render_post(Evas_Object *obj)
395{
396 Evas_Object_Gradient2_Radial *o;
397 Evas_Object_Gradient2 *og;
398
399 /* this moves the current data to the previous state parts of the object */
400 /* in whatever way is safest for the object. also if we don't need object */
401 /* data anymore we can free it if the object deems this is a good idea */
402 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
403 og = (Evas_Object_Gradient2 *)(o);
404 /* remove those pesky changes */
405 evas_object_clip_changes_clean(obj);
406 /* move cur to prev safely for object data */
407 obj->prev = obj->cur;
408 obj->changed = 0;
409 o->prev = o->cur;
410 o->changed = 0;
411 o->gradient_changed = 0;
412 og->prev = og->cur;
413 og->gradient_changed = 0;
414}
415
416static unsigned int evas_object_gradient2_radial_id_get(Evas_Object *obj)
417{
418 Evas_Object_Gradient2_Radial *o;
419
420 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
421 if (!o) return 0;
422 return MAGIC_OBJ_GRADIENT_RADIAL;
423}
424
425static unsigned int evas_object_gradient2_radial_visual_id_get(Evas_Object *obj)
426{
427 Evas_Object_Gradient2_Radial *o;
428
429 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
430 if (!o) return 0;
431 return MAGIC_OBJ_GRADIENT;
432}
433
434static void *evas_object_gradient2_radial_engine_data_get(Evas_Object *obj)
435{
436 Evas_Object_Gradient2_Radial *o;
437
438 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
439 if (!o) return NULL;
440 return o->engine_data;
441}
442
443
444static int
445evas_object_gradient2_radial_is_opaque(Evas_Object *obj)
446{
447 Evas_Object_Gradient2_Radial *o;
448 Evas_Object_Gradient2 *og;
449
450 /* this returns 1 if the internal object data implies that the object is */
451 /* currently fully opaque over the entire region it occupies */
452 if ((obj->cur.map) && (obj->cur.usemap)) return 0;
453 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
454 if (!o->engine_data) return 0;
455 og = (Evas_Object_Gradient2 *)(o);
456 return og->cur.gradient_opaque;
457 }
458
459static int
460evas_object_gradient2_radial_was_opaque(Evas_Object *obj)
461{
462 Evas_Object_Gradient2_Radial *o;
463 Evas_Object_Gradient2 *og;
464
465 /* this returns 1 if the internal object data implies that the object was */
466 /* currently fully opaque over the entire region it occupies */
467 o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
468 if (!o->engine_data) return 0;
469 og = (Evas_Object_Gradient2 *)(o);
470 return og->prev.gradient_opaque;
471}
diff --git a/legacy/evas/src/lib/engines/common/Makefile.am b/legacy/evas/src/lib/engines/common/Makefile.am
index e1d66bf952..00fbb06261 100644
--- a/legacy/evas/src/lib/engines/common/Makefile.am
+++ b/legacy/evas/src/lib/engines/common/Makefile.am
@@ -44,15 +44,6 @@ evas_font_draw.c \
44evas_font_load.c \ 44evas_font_load.c \
45evas_font_main.c \ 45evas_font_main.c \
46evas_font_query.c \ 46evas_font_query.c \
47evas_gradient_main.c \
48evas_gradient_linear.c \
49evas_gradient_radial.c \
50evas_gradient_angular.c \
51evas_gradient_rectangular.c \
52evas_gradient_sinusoidal.c \
53evas_gradient2_main.c \
54evas_gradient2_linear.c \
55evas_gradient2_radial.c \
56evas_image_load.c \ 47evas_image_load.c \
57evas_image_save.c \ 48evas_image_save.c \
58evas_image_main.c \ 49evas_image_main.c \
@@ -91,8 +82,6 @@ evas_draw.h \
91evas_encoding.h \ 82evas_encoding.h \
92evas_font.h \ 83evas_font.h \
93evas_font_private.h \ 84evas_font_private.h \
94evas_gradient.h \
95evas_gradient_private.h \
96evas_image.h \ 85evas_image.h \
97evas_image_private.h \ 86evas_image_private.h \
98evas_line.h \ 87evas_line.h \
diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c
index 246b3fa8b5..a2723e4949 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c
@@ -42,7 +42,6 @@ evas_common_init(void)
42 evas_common_convert_init(); 42 evas_common_convert_init();
43 evas_common_scale_init(); 43 evas_common_scale_init();
44 evas_common_rectangle_init(); 44 evas_common_rectangle_init();
45 evas_common_gradient_init();
46 evas_common_polygon_init(); 45 evas_common_polygon_init();
47 evas_common_line_init(); 46 evas_common_line_init();
48 evas_common_font_init(); 47 evas_common_font_init();
diff --git a/legacy/evas/src/lib/engines/common/evas_gradient.h b/legacy/evas/src/lib/engines/common/evas_gradient.h
deleted file mode 100644
index acd4828097..0000000000
--- a/legacy/evas/src/lib/engines/common/evas_gradient.h
+++ /dev/null
@@ -1,46 +0,0 @@
1#ifndef _EVAS_GRADIENT_H
2#define _EVAS_GRADIENT_H
3
4
5EAPI void evas_common_gradient_init (void);
6
7EAPI RGBA_Gradient *evas_common_gradient_new (void);
8EAPI void evas_common_gradient_free (RGBA_Gradient *gr);
9EAPI void evas_common_gradient_clear (RGBA_Gradient *gr);
10EAPI void evas_common_gradient_color_stop_add (RGBA_Gradient *gr, int r, int g, int b, int a, int dist);
11EAPI void evas_common_gradient_alpha_stop_add (RGBA_Gradient *gr, int a, int dist);
12EAPI void evas_common_gradient_color_data_set (RGBA_Gradient *gr, DATA32 *data, int len, int alpha_flags);
13EAPI void evas_common_gradient_alpha_data_set (RGBA_Gradient *gr, DATA8 *adata, int len);
14EAPI void evas_common_gradient_type_set (RGBA_Gradient *gr, const char *name, char *params);
15EAPI void evas_common_gradient_fill_set (RGBA_Gradient *gr, int x, int y, int w, int h);
16EAPI void evas_common_gradient_fill_angle_set (RGBA_Gradient *gr, float angle);
17EAPI void evas_common_gradient_fill_spread_set (RGBA_Gradient *gr, int spread);
18EAPI void evas_common_gradient_map_angle_set (RGBA_Gradient *gr, float angle);
19EAPI void evas_common_gradient_map_offset_set (RGBA_Gradient *gr, float offset);
20EAPI void evas_common_gradient_map_direction_set (RGBA_Gradient *gr, int direction);
21EAPI void evas_common_gradient_map (RGBA_Draw_Context *dc, RGBA_Gradient *gr, int len);
22EAPI void evas_common_gradient_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient *gr);
23
24EAPI RGBA_Gradient_Type *evas_common_gradient_geometer_get (const char *name);
25
26
27
28EAPI void evas_common_gradient2_free (RGBA_Gradient2 *gr);
29EAPI RGBA_Gradient2 *evas_common_gradient2_linear_new (void);
30EAPI void evas_common_gradient2_linear_fill_set (RGBA_Gradient2 *gr, float x0, float y0, float x1, float y1);
31EAPI RGBA_Gradient2 *evas_common_gradient2_radial_new (void);
32EAPI void evas_common_gradient2_radial_fill_set (RGBA_Gradient2 *gr, float cx, float cy, float rx, float ry);
33EAPI void evas_common_gradient2_clear (RGBA_Gradient2 *gr);
34EAPI void evas_common_gradient2_color_np_stop_insert (RGBA_Gradient2 *gr, int r, int g, int b, int a, float pos);
35EAPI void evas_common_gradient2_fill_spread_set (RGBA_Gradient2 *gr, int spread);
36EAPI void evas_common_gradient2_fill_transform_set (RGBA_Gradient2 *gr, Evas_Common_Transform *t);
37EAPI void evas_common_gradient2_map (RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len);
38EAPI void evas_common_gradient2_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient2 *gr);
39
40EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_linear_get (void);
41EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_radial_get (void);
42//EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_angular_get (void);
43//EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_rectangular_get (void);
44//EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_sinusoidal_get (void);
45
46#endif /* _EVAS_GRADIENT_H */
diff --git a/legacy/evas/src/lib/engines/common/evas_gradient2_linear.c b/legacy/evas/src/lib/engines/common/evas_gradient2_linear.c
deleted file mode 100644
index 773685186a..0000000000
--- a/legacy/evas/src/lib/engines/common/evas_gradient2_linear.c
+++ /dev/null
@@ -1,728 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3#include <math.h>
4
5#define LINEAR_EPSILON 0.000030517578125
6#define LINEAR_INT_TOLERANCE 0.001953125
7// 1/512 = 0.001953125 <-- will use this one as our subpixel pos tolerance.
8// 1/256 = 0.00390625 <-- though this one would be ok too for our uses.
9
10typedef struct _Linear_Data Linear_Data;
11
12struct _Linear_Data
13{
14 float x0, y0, x1, y1;
15 float fx0, fy0;
16 int ayx, ayy;
17 int len;
18 unsigned char int_axis_aligned : 1;
19};
20
21
22static void
23linear_init(void);
24
25static void
26linear_shutdown(void);
27
28static void
29linear_init_geom(RGBA_Gradient2 *gr);
30
31static void
32linear_update_geom(RGBA_Gradient2 *gr);
33
34static void
35linear_free_geom(void *gdata);
36
37static int
38linear_has_alpha(RGBA_Gradient2 *gr, int op);
39
40static int
41linear_has_mask(RGBA_Gradient2 *gr, int op);
42
43static int
44linear_get_map_len(RGBA_Gradient2 *gr);
45
46static Gfx_Func_Gradient2_Fill
47linear_get_fill_func(RGBA_Gradient2 *gr, int op);
48
49static RGBA_Gradient2_Type linear = {"linear", linear_init, linear_shutdown,
50 linear_init_geom,
51 linear_update_geom, linear_free_geom,
52 linear_has_alpha, linear_has_mask,
53 linear_get_map_len, linear_get_fill_func};
54
55
56EAPI RGBA_Gradient2_Type *
57evas_common_gradient2_type_linear_get(void)
58{
59 return &linear;
60}
61
62EAPI RGBA_Gradient2 *
63evas_common_gradient2_linear_new(void)
64{
65 RGBA_Gradient2 *gr;
66
67 gr = calloc(1, sizeof(RGBA_Gradient2));
68 if (!gr) return NULL;
69 gr->references = 1;
70 gr->type.id = MAGIC_OBJ_GRADIENT_LINEAR;
71 gr->type.geometer = &linear;
72 linear_init_geom(gr);
73 return gr;
74}
75
76EAPI void
77evas_common_gradient2_linear_fill_set(RGBA_Gradient2 *gr, float x0, float y0, float x1, float y1)
78{
79 Linear_Data *linear_data;
80
81 if (!gr) return;
82 if (gr->type.id != MAGIC_OBJ_GRADIENT_LINEAR) return;
83 if (gr->type.geometer != &linear) return;
84 linear_data = (Linear_Data *)gr->type.gdata;
85 if (!linear_data) return;
86 linear_data->x0 = x0; linear_data->y0 = y0;
87 linear_data->x1 = x1; linear_data->y1 = y1;
88}
89
90
91
92/** internal functions **/
93
94static void
95linear_reflect_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
96 int x, int y, void *params_data);
97
98static void
99linear_repeat_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
100 int x, int y, void *params_data);
101
102static void
103linear_restrict_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
104 int x, int y, void *params_data);
105
106static void
107linear_restrict_masked_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
108 int x, int y, void *params_data);
109
110static void
111linear_pad_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
112 int x, int y, void *params_data);
113
114
115
116static void
117linear_init(void)
118{
119}
120
121static void
122linear_shutdown(void)
123{
124}
125
126static void
127linear_free_geom(void *gdata)
128{
129 Linear_Data *data = (Linear_Data *)gdata;
130 if (data) free(data);
131}
132
133static void
134linear_init_geom(RGBA_Gradient2 *gr)
135{
136 Linear_Data *linear_data;
137
138 if (!gr || (gr->type.geometer != &linear)) return;
139 linear_data = (Linear_Data *)gr->type.gdata;
140 if (!linear_data)
141 {
142 linear_data = calloc(1, sizeof(Linear_Data));
143 if (!linear_data) return;
144 linear_data->ayy = 65536; linear_data->ayx = 0;
145 }
146 gr->type.gdata = linear_data;
147}
148
149
150static void
151linear_update_geom(RGBA_Gradient2 *gr)
152{
153 Linear_Data *linear_data;
154 double f;
155 double fx0, fy0, fx1, fy1;
156 int len;
157
158 if (!gr || (gr->type.geometer != &linear)) return;
159 linear_data = (Linear_Data *)gr->type.gdata;
160 if (!linear_data) return;
161
162 linear_data->int_axis_aligned = 0;
163 linear_data->len = 0;
164 f = (gr->fill.transform.mxx * (double)gr->fill.transform.myy) - (gr->fill.transform.mxy * (double)gr->fill.transform.myx);
165 if (fabs(f) < LINEAR_EPSILON) return;
166
167 f = 1.0 / f;
168 fx0 = (((gr->fill.transform.myy * (double)linear_data->x0) - (gr->fill.transform.mxy * (double)linear_data->y0)) * f) - gr->fill.transform.mxz;
169 fy0 = ((-(gr->fill.transform.myx * (double)linear_data->x0) + (gr->fill.transform.mxx * (double)linear_data->y0)) * f) - gr->fill.transform.myz;
170
171 fx1 = (((gr->fill.transform.myy * (double)linear_data->x1) - (gr->fill.transform.mxy * (double)linear_data->y1)) * f) - gr->fill.transform.mxz;
172 fy1 = ((-(gr->fill.transform.myx * (double)linear_data->x1) + (gr->fill.transform.mxx * (double)linear_data->y1)) * f) - gr->fill.transform.myz;
173
174 f = hypot(fx1 - fx0, fy1 - fy0);
175 linear_data->len = len = f + 0.5;
176 if (!len) return;
177
178 linear_data->ayx = ((fx1 - fx0) / f) * 65536;
179 linear_data->ayy = ((fy1 - fy0) / f) * 65536;
180
181 if (fabs(fy0 - fy1) < LINEAR_INT_TOLERANCE)
182 {
183 if ( (fabs(((int)fy0) - fy0) < LINEAR_INT_TOLERANCE) &&
184 (fabs(((int)fy1) - fy1) < LINEAR_INT_TOLERANCE) )
185 { linear_data->int_axis_aligned = 1; linear_data->ayy = 0; }
186 }
187 else if (fabs(fx0 - fx1) < LINEAR_INT_TOLERANCE)
188 {
189 if ( (fabs(((int)fx0) - fx0) < LINEAR_INT_TOLERANCE) &&
190 (fabs(((int)fx1) - fx1) < LINEAR_INT_TOLERANCE) )
191 { linear_data->int_axis_aligned = 1; linear_data->ayx = 0; }
192 }
193 linear_data->fx0 = fx0;
194 linear_data->fy0 = fy0;
195}
196
197static int
198linear_has_alpha(RGBA_Gradient2 *gr, int op)
199{
200 if (!gr || (gr->type.geometer != &linear)) return 0;
201 if (gr->has_alpha | gr->map.has_alpha)
202 return 1;
203 if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) ||
204 (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) )
205 return 0;
206 if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
207 return 1;
208 return 0;
209}
210
211static int
212linear_has_mask(RGBA_Gradient2 *gr, int op)
213{
214 if (!gr || (gr->type.geometer != &linear)) return 0;
215 if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) ||
216 (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) )
217 {
218 if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
219 return 1;
220 }
221 return 0;
222}
223
224static int
225linear_get_map_len(RGBA_Gradient2 *gr)
226{
227 Linear_Data *linear_data;
228
229 if (!gr || (gr->type.geometer != &linear)) return 0;
230 linear_data = (Linear_Data *)gr->type.gdata;
231 if (!linear_data) return 0;
232 return linear_data->len;
233}
234
235static Gfx_Func_Gradient2_Fill
236linear_get_fill_func(RGBA_Gradient2 *gr, int op)
237{
238 Linear_Data *linear_data;
239 Gfx_Func_Gradient2_Fill sfunc = NULL;
240 int masked_op = 0;
241
242 if (!gr || (gr->type.geometer != &linear))
243 return sfunc;
244 linear_data = (Linear_Data *)gr->type.gdata;
245 if (!linear_data) return sfunc;
246
247 if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) ||
248 (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) )
249 masked_op = 1;
250
251 switch (gr->fill.spread)
252 {
253 case _EVAS_TEXTURE_REPEAT:
254 sfunc = linear_repeat_aa;
255 break;
256 case _EVAS_TEXTURE_REFLECT:
257 sfunc = linear_reflect_aa;
258 break;
259 case _EVAS_TEXTURE_RESTRICT:
260 if (masked_op)
261 sfunc = linear_restrict_masked_aa;
262 else
263 sfunc = linear_restrict_aa;
264 break;
265 case _EVAS_TEXTURE_PAD:
266 sfunc = linear_pad_aa;
267 break;
268 default:
269 sfunc = linear_repeat_aa;
270 break;
271 }
272 return sfunc;
273}
274
275
276/* the fill functions */
277
278#ifdef BUILD_MMX
279#define INTERP_256_P2R(a, s, mma, mms, mmd, mmz) \
280 MOV_A2R(a, mma) \
281 MOV_P2R(s, mms, mmz) \
282 INTERP_256_R2R(mma, mms, mmd, mm5)
283
284#define MUL_256_A2R(a, mma, mmd, mmz) \
285 MOV_A2R(a, mma) \
286 MUL4_256_R2R(mma, mmd)
287#endif
288
289static void
290linear_repeat_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask __UNUSED__, int dst_len,
291 int x, int y, void *params_data)
292{
293 DATA32 *dst_end = dst + dst_len;
294 Linear_Data *gdata = (Linear_Data *)params_data;
295 int yy;
296
297 evas_common_cpu_end_opt();
298 yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
299
300 if (gdata->int_axis_aligned && (gdata->ayx == 0))
301 {
302 DATA32 c;
303
304 y = (yy >> 16);
305 y = y % src_len;
306 if (y < 0)
307 y += src_len;
308 c = src[y];
309 while (dst < dst_end)
310 *dst++ = c;
311 return;
312 }
313
314 if (gdata->int_axis_aligned && (gdata->ayy == 0))
315 {
316 Gfx_Func_Copy func;
317 int l;
318
319 x = (yy >> 16);
320 x = x % src_len;
321 if (x < 0)
322 x += src_len;
323 if (gdata->ayx < 0)
324 {
325 l = x + 1; x = 0;
326 }
327 else
328 l = src_len - x;
329 if (l > dst_len) l = dst_len;
330 func = evas_common_draw_func_copy_get(1, (gdata->ayx < 0 ? -1 : 0));
331 func(src + x, dst, l);
332 if (l == dst_len) return;
333 dst += l; dst_len -= l;
334 l = dst_len / src_len;
335 while (l--)
336 {
337 func(src, dst, src_len);
338 dst += src_len;
339 }
340 l = dst_len % src_len;
341 if (gdata->ayx < 0)
342 src += src_len - l;
343 func(src, dst, l);
344 return;
345 }
346
347#ifdef BUILD_MMX
348 pxor_r2r(mm0, mm0);
349 MOV_A2R(ALPHA_255, mm5)
350#endif
351 while (dst < dst_end)
352 {
353 int l = (yy >> 16);
354 int a = 1 + ((yy & 0xffff) >> 8);
355
356 if ((l >= src_len) || (l < 0))
357 { l = l % src_len; if (l < 0) l += src_len; }
358
359#ifdef BUILD_MMX
360 MOV_P2R(src[l], mm1, mm0)
361#else
362 *dst = src[l];
363#endif
364 if (l + 1 < src_len)
365 {
366#ifdef BUILD_MMX
367 INTERP_256_P2R(a, src[l + 1], mm3, mm2, mm1, mm0)
368#else
369 *dst = INTERP_256(a, src[l + 1], *dst);
370#endif
371 }
372 if (l == (src_len - 1))
373 {
374#ifdef BUILD_MMX
375 INTERP_256_P2R(a, src[0], mm3, mm2, mm1, mm0)
376#else
377 *dst = INTERP_256(a, src[0], *dst);
378#endif
379 }
380#ifdef BUILD_MMX
381 MOV_R2P(mm1, *dst, mm0)
382#endif
383 dst++; yy += gdata->ayx;
384 }
385}
386
387
388static void
389linear_reflect_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask __UNUSED__, int dst_len,
390 int x, int y, void *params_data)
391{
392 DATA32 *dst_end = dst + dst_len;
393 Linear_Data *gdata = (Linear_Data *)params_data;
394 int yy;
395
396 evas_common_cpu_end_opt();
397 yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
398
399 if (gdata->int_axis_aligned && (gdata->ayx == 0))
400 {
401 DATA32 c;
402
403 y = (yy >> 16);
404 if (y < 0) y = -y;
405 if (y >= src_len)
406 {
407 int m = (y % (2 * src_len));
408
409 y = (y % src_len);
410 if (m >= src_len)
411 y = src_len - y - 1;
412 }
413 c = src[y];
414 while (dst < dst_end)
415 *dst++ = c;
416 return;
417 }
418
419 if (gdata->int_axis_aligned && (gdata->ayy == 0))
420 {
421 Gfx_Func_Copy func, ofunc;
422 int l, sgn;
423
424 x = (yy >> 16);
425 sgn = (gdata->ayx < 0 ? -1 : 1);
426 if (x < 0)
427 {
428 x = -x; sgn *= -1;
429 }
430 if (x >= src_len)
431 {
432 int m = (x % (2 * src_len));
433
434 x = (x % src_len);
435 if (m >= src_len)
436 { x = src_len - x - 1; sgn *= -1; }
437 }
438
439 if (sgn < 0)
440 {
441 l = x + 1; x = 0;
442 }
443 else
444 l = src_len - x;
445
446 if (l > dst_len) l = dst_len;
447 func = evas_common_draw_func_copy_get(1, 0);
448 ofunc = evas_common_draw_func_copy_get(1, -1);
449
450 if (sgn > 0)
451 func(src + x, dst, l);
452 else
453 ofunc(src + x, dst, l);
454 if (l == dst_len) return;
455
456 dst += l; dst_len -= l;
457 l = dst_len / src_len;
458 sgn *= -1;
459 while (l--)
460 {
461 if (sgn > 0)
462 func(src, dst, src_len);
463 else
464 ofunc(src, dst, src_len);
465 sgn *= -1;
466 dst += src_len;
467 }
468 l = dst_len % src_len;
469 if (sgn < 0)
470 {
471 src += src_len - l;
472 ofunc(src, dst, l);
473 }
474 else
475 func(src, dst, l);
476 return;
477 }
478
479#ifdef BUILD_MMX
480 pxor_r2r(mm0, mm0);
481 MOV_A2R(ALPHA_255, mm5)
482#endif
483 while (dst < dst_end)
484 {
485 int l = (yy >> 16);
486 int a = 1 + ((yy & 0xffff) >> 8);
487
488 if (l < 0) { l = -l; a = 257 - a; }
489 if (l >= src_len)
490 {
491 int m = (l % (2 * src_len));
492
493 l = (l % src_len);
494 if (m >= src_len)
495 { l = src_len - l - 1; a = 257 - a; }
496 }
497#ifdef BUILD_MMX
498 MOV_P2R(src[l], mm1, mm0)
499#else
500 *dst = src[l];
501#endif
502 if (l + 1 < src_len)
503 {
504#ifdef BUILD_MMX
505 INTERP_256_P2R(a, src[l + 1], mm3, mm2, mm1, mm0)
506#else
507 *dst = INTERP_256(a, src[l + 1], *dst);
508#endif
509 }
510#ifdef BUILD_MMX
511 MOV_R2P(mm1, *dst, mm0)
512#endif
513 dst++; yy += gdata->ayx;
514 }
515}
516
517
518static void
519linear_restrict_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask __UNUSED__, int dst_len,
520 int x, int y, void *params_data)
521{
522 DATA32 *dst_end = dst + dst_len;
523 Linear_Data *gdata = (Linear_Data *)params_data;
524 int yy;
525
526 evas_common_cpu_end_opt();
527 yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
528
529 if (gdata->int_axis_aligned && (gdata->ayx == 0))
530 {
531 DATA32 c;
532
533 y = (yy >> 16);
534 if ((y < 0) || (y >= src_len))
535 {
536 memset(dst, 0, sizeof(DATA32) * dst_len);
537 return;
538 }
539 c = src[y];
540 while (dst < dst_end)
541 *dst++ = c;
542 return;
543 }
544
545 if (gdata->int_axis_aligned && (gdata->ayy == 0))
546 {
547 Gfx_Func_Copy func;
548 int sgn;
549
550 x = yy >> 16;
551 sgn = (gdata->ayx < 0 ? -1 : 1);
552 if ((unsigned)x < src_len)
553 {
554 if ((sgn > 0) && ((src_len - x) >= dst_len))
555 {
556 func = evas_common_draw_func_copy_get(dst_len, 0);
557 func(src + x, dst, dst_len);
558 return;
559 }
560 if ((sgn < 0) && (x >= (dst_len - 1)))
561 {
562 func = evas_common_draw_func_copy_get(dst_len, -1);
563 func(src + x - (dst_len - 1), dst, dst_len);
564 return;
565 }
566 }
567 while (dst < dst_end)
568 {
569 *dst = 0;
570 if ((unsigned)x < src_len)
571 *dst = src[x];
572 dst++; x += sgn;
573 }
574 return;
575 }
576
577#ifdef BUILD_MMX
578 pxor_r2r(mm0, mm0);
579 MOV_A2R(ALPHA_255, mm5)
580#endif
581 while (dst < dst_end)
582 {
583 int l = (yy >> 16);
584
585 *dst = 0;
586 if ((unsigned)(l + 1) < (src_len + 1))
587 {
588 int a = 1 + ((yy & 0xffff) >> 8);
589 int lp = l;
590
591 if (l == -1) lp = 0;
592#ifdef BUILD_MMX
593 MOV_P2R(src[lp], mm1, mm0)
594#else
595 *dst = src[lp];
596#endif
597 if (lp + 1 < src_len)
598 {
599#ifdef BUILD_MMX
600 INTERP_256_P2R(a, src[lp + 1], mm3, mm2, mm1, mm0)
601#else
602 *dst = INTERP_256(a, src[lp + 1], *dst);
603#endif
604 }
605 if (l == -1)
606 {
607#ifdef BUILD_MMX
608 MUL_256_A2R(a, mm3, mm1, mm0)
609#else
610 *dst = MUL_256(a, *dst);
611#endif
612 }
613 if (l == (src_len - 1))
614 {
615#ifdef BUILD_MMX
616 a = 257 - a;
617 MUL_256_A2R(a, mm3, mm1, mm0)
618#else
619 *dst = MUL_256(257 - a, *dst);
620#endif
621 }
622 }
623#ifdef BUILD_MMX
624 MOV_R2P(mm1, *dst, mm0)
625#endif
626 dst++; yy += gdata->ayx;
627 }
628}
629
630
631static void
632linear_restrict_masked_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len,
633 int x, int y, void *params_data)
634{
635 DATA32 *dst_end = dst + dst_len;
636 Linear_Data *gdata = (Linear_Data *)params_data;
637 int yy;
638
639 evas_common_cpu_end_opt();
640 yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
641
642#ifdef BUILD_MMX
643 pxor_r2r(mm0, mm0);
644 MOV_A2R(ALPHA_255, mm5)
645#endif
646 while (dst < dst_end)
647 {
648 int l = (yy >> 16);
649
650 *dst = 0; *mask = 0;
651 if ((unsigned)(l + 1) < (src_len + 1))
652 {
653 int a = 1 + ((yy & 0xffff) >> 8);
654 int lp = l;
655
656 if (l == -1) lp = 0;
657
658#ifdef BUILD_MMX
659 MOV_P2R(src[lp], mm1, mm0)
660#else
661 *dst = src[lp]; *mask = 255;
662#endif
663 if (lp + 1 < src_len)
664 {
665#ifdef BUILD_MMX
666 INTERP_256_P2R(a, src[lp + 1], mm3, mm2, mm1, mm0)
667#else
668 *dst = INTERP_256(a, src[lp + 1], *dst);
669#endif
670 }
671#ifdef BUILD_MMX
672 MOV_R2P(mm1, *dst, mm0)
673#endif
674 if (l == -1)
675 *mask = a - 1;
676 if (l == (src_len - 1))
677 *mask = 256 - a;
678 }
679 dst++; mask++; yy += gdata->ayx;
680 }
681}
682
683
684static void
685linear_pad_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask __UNUSED__, int dst_len,
686 int x, int y, void *params_data)
687{
688 DATA32 *dst_end = dst + dst_len;
689 Linear_Data *gdata = (Linear_Data *)params_data;
690 int yy;
691
692 evas_common_cpu_end_opt();
693 yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
694
695#ifdef BUILD_MMX
696 pxor_r2r(mm0, mm0);
697 MOV_A2R(ALPHA_255, mm5)
698#endif
699 while (dst < dst_end)
700 {
701 int l = (yy >> 16);
702
703 if (l < 0) *dst = src[0];
704 if (l >= src_len) *dst = src[src_len - 1];
705 if ((unsigned)l < src_len)
706 {
707 int a = 1 + ((yy & 0xffff) >> 8);
708
709#ifdef BUILD_MMX
710 MOV_P2R(src[l], mm1, mm0)
711#else
712 *dst = src[l];
713#endif
714 if (l && (l + 1 < src_len))
715 {
716#ifdef BUILD_MMX
717 INTERP_256_P2R(a, src[l + 1], mm3, mm2, mm1, mm0)
718#else
719 *dst = INTERP_256(a, src[l + 1], *dst);
720#endif
721 }
722#ifdef BUILD_MMX
723 MOV_R2P(mm1, *dst, mm0)
724#endif
725 }
726 dst++; yy += gdata->ayx;
727 }
728}
diff --git a/legacy/evas/src/lib/engines/common/evas_gradient2_main.c b/legacy/evas/src/lib/engines/common/evas_gradient2_main.c
deleted file mode 100644
index 5d3893e187..0000000000
--- a/legacy/evas/src/lib/engines/common/evas_gradient2_main.c
+++ /dev/null
@@ -1,587 +0,0 @@
1#include "evas_common.h"
2#include "evas_blend_private.h"
3#include "evas_private.h"
4#include <math.h>
5
6static void _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr);
7static void _evas_common_gradient2_stops_scale(RGBA_Gradient2 *gr);
8
9static void _evas_common_gradient2_map_argb(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len);
10static void _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len);
11
12static int grad_initialised = 0;
13
14EAPI void
15evas_common_gradient2_init(void)
16{
17 RGBA_Gradient2_Type *geom;
18
19 if (grad_initialised)
20 return;
21 geom = evas_common_gradient2_type_linear_get();
22 if (geom)
23 geom->init();
24 geom = evas_common_gradient2_type_radial_get();
25 if (geom)
26 geom->init();
27 grad_initialised = 1;
28}
29
30void
31evas_common_gradient2_shutdown(void)
32{
33 RGBA_Gradient2_Type *geom;
34
35 if (!grad_initialised)
36 return;
37 geom = evas_common_gradient2_type_linear_get();
38 if (geom)
39 geom->shutdown();
40 geom = evas_common_gradient2_type_radial_get();
41 if (geom)
42 geom->shutdown();
43 grad_initialised = 0;
44}
45
46static void
47_evas_common_gradient2_stops_free(RGBA_Gradient2 *gr)
48{
49 if (!gr) return;
50 if (gr->stops.stops)
51 {
52 Eina_Inlist *l;
53
54 while (gr->stops.stops)
55 {
56 l = gr->stops.stops;
57 gr->stops.stops = eina_inlist_remove(gr->stops.stops, gr->stops.stops);
58 free(l);
59 }
60 gr->stops.stops = NULL;
61 gr->stops.nstops = 0;
62 }
63}
64
65EAPI void
66evas_common_gradient2_free(RGBA_Gradient2 *gr)
67{
68 if (!gr) return;
69 gr->references--;
70 if (gr->references > 0) return;
71#ifdef EVAS_FRAME_QUEUING
72 LKL(gr->ref_fq_add); LKL(gr->ref_fq_del);
73 if (gr->ref_fq[0] != gr->ref_fq[1])
74 {
75 LKU(gr->ref_fq_add); LKU(gr->ref_fq_del);
76 return;
77 }
78 LKU(gr->ref_fq_add); LKU(gr->ref_fq_del);
79#endif
80 evas_common_gradient2_clear(gr);
81 if (gr->stops.cdata) free(gr->stops.cdata);
82 if (gr->stops.adata) free(gr->stops.adata);
83 if (gr->type.geometer && gr->type.gdata)
84 gr->type.geometer->geom_free(gr->type.gdata);
85 if (gr->map.data) free(gr->map.data);
86 free(gr);
87}
88
89EAPI void
90evas_common_gradient2_clear(RGBA_Gradient2 *gr)
91{
92 if (!gr) return;
93
94 _evas_common_gradient2_stops_free(gr);
95 gr->has_alpha = 0;
96}
97
98EAPI void
99evas_common_gradient2_color_np_stop_insert(RGBA_Gradient2 *gr, int r, int g, int b, int a, float pos)
100{
101 RGBA_Gradient2_Color_Np_Stop *gc;
102 Eina_Inlist *l;
103
104 if (!gr) return;
105 if (!gr->stops.stops)
106 {
107 RGBA_Gradient2_Color_Np_Stop *gc1;
108
109 gc = malloc(sizeof(RGBA_Gradient2_Color_Np_Stop));
110 if (!gc) return;
111 gc1 = malloc(sizeof(RGBA_Gradient2_Color_Np_Stop));
112 if (!gc1) { free(gc); return; }
113 gc->r = gc->g = gc->b = gc->a = 255; gc->pos = 0.0; gc->dist = 0;
114 gc1->r = gc1->g = gc1->b = gc1->a = 255; gc1->pos = 1.0; gc1->dist = 0;
115
116 gr->stops.stops = eina_inlist_append(gr->stops.stops, EINA_INLIST_GET(gc));
117 gr->stops.stops = eina_inlist_append(gr->stops.stops, EINA_INLIST_GET(gc1));
118 gr->stops.nstops = 2;
119 gr->stops.len = 0;
120 }
121
122 if (r < 0) r = 0; if (r > 255) r = 255;
123 if (g < 0) g = 0; if (g > 255) g = 255;
124 if (b < 0) b = 0; if (b > 255) b = 255;
125 if (a < 0) a = 0; if (a > 255) a = 255;
126 if (pos < 0.0) pos = 0.0;
127 if (pos > 1.0) pos = 1.0;
128
129 if (pos == 0.0)
130 {
131 gc = (RGBA_Gradient2_Color_Np_Stop *)gr->stops.stops;
132 gc->r = r; gc->g = g; gc->b = b; gc->a = a; gc->dist = 0;
133 if (a < 255) gr->has_alpha = 1;
134 return;
135 }
136 if (pos == 1.0)
137 {
138 gc = (RGBA_Gradient2_Color_Np_Stop *)(gr->stops.stops->last);
139 gc->r = r; gc->g = g; gc->b = b; gc->a = a; gc->dist = 0;
140 if (a < 255) gr->has_alpha = 1;
141 return;
142 }
143
144 l = gr->stops.stops->next;
145 while (l)
146 {
147 gc = (RGBA_Gradient2_Color_Np_Stop *)l;
148 if (pos <= gc->pos)
149 {
150 if (pos == gc->pos)
151 {
152 gc->r = r; gc->g = g; gc->b = b; gc->a = a; gc->dist = 0;
153 if (a < 255) gr->has_alpha = 1;
154 return;
155 }
156 break;
157 }
158 l = l->next;
159 }
160
161 gc = malloc(sizeof(RGBA_Gradient2_Color_Np_Stop));
162 if (!gc) return;
163 gc->r = r;
164 gc->g = g;
165 gc->b = b;
166 gc->a = a;
167 gc->pos = pos;
168 gc->dist = 0;
169
170 gr->stops.stops = eina_inlist_prepend_relative(gr->stops.stops, EINA_INLIST_GET(gc), l);
171 gr->stops.nstops++;
172 if (a < 255)
173 gr->has_alpha = 1;
174}
175
176EAPI void
177evas_common_gradient2_fill_transform_set(RGBA_Gradient2 *gr, Evas_Common_Transform *t)
178{
179 if (!gr) return;
180 if (!t)
181 {
182 gr->fill.transform.mxx = 1; gr->fill.transform.mxy = 0; gr->fill.transform.mxz = 0;
183 gr->fill.transform.myx = 0; gr->fill.transform.myy = 1; gr->fill.transform.myz = 0;
184 gr->fill.transform.mzx = 1; gr->fill.transform.mzy = 0; gr->fill.transform.mzz = 1;
185 return;
186 }
187 gr->fill.transform.mxx = t->mxx; gr->fill.transform.mxy = t->mxy; gr->fill.transform.mxz = t->mxz;
188 gr->fill.transform.myx = t->myx; gr->fill.transform.myy = t->myy; gr->fill.transform.myz = t->myz;
189 gr->fill.transform.mzx = t->mzx; gr->fill.transform.mzy = t->mzy; gr->fill.transform.mzz = t->mzz;
190}
191
192EAPI void
193evas_common_gradient2_fill_spread_set(RGBA_Gradient2 *gr, int spread)
194{
195 if (!gr) return;
196 gr->fill.spread = spread;
197}
198
199EAPI void
200evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
201 int x, int y, int w, int h, RGBA_Gradient2 *gr)
202{
203 Gfx_Func_Gradient2_Fill gfunc;
204 RGBA_Gfx_Func bfunc = NULL;
205 int len;
206 int xin, yin, xoff, yoff;
207 int clx, cly, clw, clh;
208 DATA32 *pdst, *dst_end, *buf, *map;
209 RGBA_Image *argb_buf = NULL, *alpha_buf = NULL;
210 DATA8 *mask = NULL;
211 void *gdata;
212 int direct_copy = 0, buf_step = 0;
213
214 if (!dst || !dc || !gr || !dst || !dst->image.data)
215 return;
216 if (!gr->map.data || !gr->type.geometer)
217 return;
218 if ((w < 1) || (h < 1))
219 return;
220 clx = 0; cly = 0; clw = dst->cache_entry.w; clh = dst->cache_entry.h;
221 if ((clw < 1) || (clh < 1)) return;
222
223 if (dc->clip.use)
224 RECTS_CLIP_TO_RECT(clx,cly,clw,clh, dc->clip.x,dc->clip.y,dc->clip.w,dc->clip.h);
225 if ((clw < 1) || (clh < 1)) return;
226
227 xin = x; yin = y;
228 RECTS_CLIP_TO_RECT(x,y,w,h, clx,cly,clw,clh);
229 if ((w < 1) || (h < 1)) return;
230
231 xoff = (x - xin);