summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/software_generic
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/evas/engines/software_generic')
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c13
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_engine_filter.h1
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_inverse_color.c57
3 files changed, 66 insertions, 5 deletions
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 085f053..b548322 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4463,23 +4463,22 @@ _draw_thread_ector_surface_set(void *data)
4463 eina_mempool_free(_mp_command_ector_surface, ector_surface); 4463 eina_mempool_free(_mp_command_ector_surface, ector_surface);
4464} 4464}
4465 4465
4466static void 4466static Eina_Bool
4467eng_ector_begin(void *engine EINA_UNUSED, void *surface, 4467eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4468 void *context EINA_UNUSED, Ector_Surface *ector, 4468 void *context EINA_UNUSED, Ector_Surface *ector,
4469 int x, int y, Eina_Bool clear, Eina_Bool do_async) 4469 int x, int y, Eina_Bool do_async)
4470{ 4470{
4471 if (do_async) 4471 if (do_async)
4472 { 4472 {
4473 Evas_Thread_Command_Ector_Surface *nes; 4473 Evas_Thread_Command_Ector_Surface *nes;
4474 4474
4475 nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface)); 4475 nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface));
4476 if (!nes) return; 4476 if (!nes) return EINA_FALSE;
4477 4477
4478 nes->ector = ector; 4478 nes->ector = ector;
4479 nes->pixels = surface; 4479 nes->pixels = surface;
4480 nes->x = x; 4480 nes->x = x;
4481 nes->y = y; 4481 nes->y = y;
4482 nes->clear = clear;
4483 4482
4484 QCMD(_draw_thread_ector_surface_set, nes); 4483 QCMD(_draw_thread_ector_surface_set, nes);
4485 } 4484 }
@@ -4491,14 +4490,17 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4491 unsigned int h = 0; 4490 unsigned int h = 0;
4492 4491
4493 pixels = evas_cache_image_pixels(&sf->cache_entry); 4492 pixels = evas_cache_image_pixels(&sf->cache_entry);
4493 if (!pixels) return EINA_FALSE;
4494
4494 w = sf->cache_entry.w; 4495 w = sf->cache_entry.w;
4495 h = sf->cache_entry.h; 4496 h = sf->cache_entry.h;
4496 // clear the surface before giving to ector 4497 // clear the surface before giving to ector
4497 if (clear) memset(pixels, 0, (w * h * 4)); 4498 memset(pixels, 0, (w * h * 4));
4498 4499
4499 ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 4500 ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
4500 ector_surface_reference_point_set(ector, x, y); 4501 ector_surface_reference_point_set(ector, x, y);
4501 } 4502 }
4503 return EINA_TRUE;
4502} 4504}
4503 4505
4504static void 4506static void
@@ -4545,6 +4547,7 @@ _gfx_filter_func_get(Evas_Filter_Command *cmd)
4545 case EVAS_FILTER_MODE_MASK: func = eng_filter_mask_func_get(cmd); break; 4547 case EVAS_FILTER_MODE_MASK: func = eng_filter_mask_func_get(cmd); break;
4546 case EVAS_FILTER_MODE_TRANSFORM: func = eng_filter_transform_func_get(cmd); break; 4548 case EVAS_FILTER_MODE_TRANSFORM: func = eng_filter_transform_func_get(cmd); break;
4547 case EVAS_FILTER_MODE_GRAYSCALE: func = eng_filter_grayscale_func_get(cmd); break; 4549 case EVAS_FILTER_MODE_GRAYSCALE: func = eng_filter_grayscale_func_get(cmd); break;
4550 case EVAS_FILTER_MODE_INVERSE_COLOR: func = eng_filter_inverse_color_func_get(cmd); break;
4548 default: return NULL; 4551 default: return NULL;
4549 } 4552 }
4550 4553
diff --git a/src/modules/evas/engines/software_generic/filters/evas_engine_filter.h b/src/modules/evas/engines/software_generic/filters/evas_engine_filter.h
index 33998f9..bc6bbbd 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_engine_filter.h
+++ b/src/modules/evas/engines/software_generic/filters/evas_engine_filter.h
@@ -14,5 +14,6 @@ Software_Filter_Func eng_filter_fill_func_get(Evas_Filter_Command *cmd);
14Software_Filter_Func eng_filter_mask_func_get(Evas_Filter_Command *cmd); 14Software_Filter_Func eng_filter_mask_func_get(Evas_Filter_Command *cmd);
15Software_Filter_Func eng_filter_transform_func_get(Evas_Filter_Command *cmd); 15Software_Filter_Func eng_filter_transform_func_get(Evas_Filter_Command *cmd);
16Software_Filter_Func eng_filter_grayscale_func_get(Evas_Filter_Command *cmd); 16Software_Filter_Func eng_filter_grayscale_func_get(Evas_Filter_Command *cmd);
17Software_Filter_Func eng_filter_inverse_color_func_get(Evas_Filter_Command *cmd);
17 18
18#endif // EVAS_ENGINE_FILTER_H 19#endif // EVAS_ENGINE_FILTER_H
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_inverse_color.c b/src/modules/evas/engines/software_generic/filters/evas_filter_inverse_color.c
new file mode 100644
index 0000000..8079e3a
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_inverse_color.c
@@ -0,0 +1,57 @@
1#include "evas_engine_filter.h"
2
3static Eina_Bool
4_evas_filter_inverse_color(Evas_Filter_Command *cmd)
5{
6 int sw, sh, dw, dh, x, y, slen, dlen;
7 unsigned int src_len, src_stride, dst_len, dst_stride;
8 Eina_Bool ret = EINA_FALSE;
9 DATA32 *ts, *td, *src = NULL, *dst = NULL;
10
11 ector_buffer_size_get(cmd->input->buffer, &sw, &sh);
12 EINA_SAFETY_ON_FALSE_RETURN_VAL((sw > 0) && (sh > 0), ret);
13
14 ector_buffer_size_get(cmd->output->buffer, &dw, &dh);
15 EINA_SAFETY_ON_FALSE_RETURN_VAL((dw > 0) && (dh > 0), ret);
16
17 src = _buffer_map_all(cmd->input->buffer, &src_len, E_READ, E_ARGB, &src_stride);
18 EINA_SAFETY_ON_FALSE_GOTO(src, end);
19
20 dst = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride);
21 EINA_SAFETY_ON_FALSE_GOTO(dst, end);
22
23 slen = src_stride / sizeof(*src);
24 dlen = dst_stride / sizeof(*dst);
25
26 ts = src;
27 td = dst;
28 for (y = 0; y < sh ; y++)
29 {
30 for (x = 0; x < sw; x++)
31 {
32 A_VAL(td + x) = A_VAL(ts + x);
33 R_VAL(td + x) = A_VAL(ts + x) - R_VAL(ts + x);
34 G_VAL(td + x) = A_VAL(ts + x) - G_VAL(ts + x);
35 B_VAL(td + x) = A_VAL(ts + x) - B_VAL(ts + x);
36 }
37 ts += slen;
38 td += dlen;
39 }
40
41 ret = EINA_TRUE;
42
43end:
44 if (src) ector_buffer_unmap(cmd->input->buffer, src, src_len);
45 if (dst) ector_buffer_unmap(cmd->output->buffer, dst, dst_len);
46 return ret;
47}
48
49Software_Filter_Func
50eng_filter_inverse_color_func_get(Evas_Filter_Command *cmd)
51{
52 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL);
53 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->output, NULL);
54 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->input, NULL);
55
56 return _evas_filter_inverse_color;
57}