summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/software_generic/filters
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-01-17 20:48:31 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-04-14 11:26:42 +0900
commitc9eec7400275405520d242747e3bf80801eb8b04 (patch)
treedfbb070636ffe1fa370a8d38f7290b1d4d5855d0 /src/modules/evas/engines/software_generic/filters
parentb6df13b02448621e5264152e2db1de370c7a6529 (diff)
evas filters: Move fill to software generic (4/8)
This also moves the header evas_engine_filter.h to its subdir.
Diffstat (limited to 'src/modules/evas/engines/software_generic/filters')
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_engine_filter.h12
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_blend.c2
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_curve.c2
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_fill.c65
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_mask.c2
5 files changed, 80 insertions, 3 deletions
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
new file mode 100644
index 0000000000..fd282bdd42
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/filters/evas_engine_filter.h
@@ -0,0 +1,12 @@
1#ifndef EVAS_ENGINE_FILTER_H
2#define EVAS_ENGINE_FILTER_H
3
4#include "evas_filter_private.h"
5#include "draw.h"
6
7Evas_Filter_Apply_Func eng_filter_blend_func_get(Evas_Filter_Command *cmd);
8Evas_Filter_Apply_Func eng_filter_curve_func_get(Evas_Filter_Command *cmd);
9Evas_Filter_Apply_Func eng_filter_fill_func_get(Evas_Filter_Command *cmd);
10Evas_Filter_Apply_Func eng_filter_mask_func_get(Evas_Filter_Command *cmd);
11
12#endif // EVAS_ENGINE_FILTER_H
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c b/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
index e6ab9bf4d6..947723ef50 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
@@ -1,4 +1,4 @@
1#include "../evas_engine_filter.h" 1#include "evas_engine_filter.h"
2 2
3// FIXME: This should all be based on ector renderer 3// FIXME: This should all be based on ector renderer
4 4
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_curve.c b/src/modules/evas/engines/software_generic/filters/evas_filter_curve.c
index 6202b80c18..c19d1d6ab8 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_filter_curve.c
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_curve.c
@@ -1,4 +1,4 @@
1#include "../evas_engine_filter.h" 1#include "evas_engine_filter.h"
2 2
3static Eina_Bool 3static Eina_Bool
4_filter_curve_cpu_rgba(Evas_Filter_Command *cmd) 4_filter_curve_cpu_rgba(Evas_Filter_Command *cmd)
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_fill.c b/src/modules/evas/engines/software_generic/filters/evas_filter_fill.c
new file mode 100644
index 0000000000..dcd1f64e2f
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_fill.c
@@ -0,0 +1,65 @@
1#include "evas_engine_filter.h"
2
3static Eina_Bool
4_fill_cpu(Evas_Filter_Command *cmd)
5{
6 Evas_Filter_Buffer *fb = cmd->output;
7 int step = fb->alpha_only ? sizeof(uint8_t) : sizeof(uint32_t);
8 int x = MAX(0, cmd->draw.clip.x);
9 int y = MAX(0, cmd->draw.clip.y);
10 uint32_t color = ARGB_JOIN(cmd->draw.A, cmd->draw.R, cmd->draw.G, cmd->draw.B);
11 unsigned int stride, len;
12 int w, h, k;
13 uint8_t *ptr;
14
15 if (!cmd->draw.clip_mode_lrtb)
16 {
17 if (cmd->draw.clip.w)
18 w = MIN(cmd->draw.clip.w, fb->w - x);
19 else
20 w = fb->w - x;
21 if (cmd->draw.clip.h)
22 h = MIN(cmd->draw.clip.h, fb->h - y);
23 else
24 h = fb->h - y;
25 }
26 else
27 {
28 x = MAX(0, cmd->draw.clip.l);
29 y = MAX(0, cmd->draw.clip.t);
30 w = CLAMP(0, fb->w - x - cmd->draw.clip.r, fb->w - x);
31 h = CLAMP(0, fb->h - y - cmd->draw.clip.b, fb->h - y);
32 }
33
34 ptr = _buffer_map_all(fb->buffer, &len, E_WRITE, fb->alpha_only ? E_ALPHA : E_ARGB, &stride);
35 if (!ptr) return EINA_FALSE;
36
37 ptr += y * stride;
38 if (fb->alpha_only)
39 {
40 for (k = 0; k < h; k++)
41 {
42 memset(ptr + (x * step), cmd->draw.A, step * w);
43 ptr += stride;
44 }
45 }
46 else
47 {
48 for (k = 0; k < h; k++)
49 {
50 uint32_t *dst = ((uint32_t *) (ptr + (y + k) * stride)) + x;
51 draw_memset32(dst, color, w);
52 }
53 }
54
55 ector_buffer_unmap(fb->buffer, ptr, len);
56 return EINA_TRUE;
57}
58
59Evas_Filter_Apply_Func
60eng_filter_fill_func_get(Evas_Filter_Command *cmd)
61{
62 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL);
63 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->output, NULL);
64 return _fill_cpu;
65}
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_mask.c b/src/modules/evas/engines/software_generic/filters/evas_filter_mask.c
index 46fdc2ca9b..6b1d0beaba 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_filter_mask.c
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_mask.c
@@ -1,6 +1,6 @@
1/* Implementation of some masking functions for the software engine */ 1/* Implementation of some masking functions for the software engine */
2 2
3#include "../evas_engine_filter.h" 3#include "evas_engine_filter.h"
4 4
5// Naming convention: _func_engine_incolor_maskcolor_outcolor() 5// Naming convention: _func_engine_incolor_maskcolor_outcolor()
6static Eina_Bool _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd); 6static Eina_Bool _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd);