summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-01-04 21:46:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 16:02:27 +0900
commitc1b4728487715c66120ed4c4d75065012bd42682 (patch)
treed45b0ff9298333eac655fcf49c9dacf3d4662df6
parent13f66f8887b3f7f63be26c6ec55cebd6ca7bd1bd (diff)
Evas filters: Final fix after the ector refactor
This implements a generic way of scaling buffers, using fake RGBA_Image wrapping ector buffer maps. The underlying algo is still the good old linear sw scaler. Now the filters *should* be back to their previous level of usability. Performance will probably be even worse than it was before, for GL, as more glReadPixels may be involved. Optimization now consists in actually implementing the filters with GL shaders.
-rw-r--r--src/Makefile_Evas.am2
-rw-r--r--src/lib/evas/canvas/evas_filter_mixin.c32
-rw-r--r--src/lib/evas/filters/evas_filter.c2
-rw-r--r--src/lib/evas/filters/evas_filter_mask.c10
-rw-r--r--src/lib/evas/filters/evas_filter_utils.c64
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c16
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c6
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c2
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c43
9 files changed, 126 insertions, 51 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 24e99299e5..d5b3167d09 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -778,6 +778,8 @@ CLEANFILES += \
778 $(evas_gl_generic_eolian_c) \ 778 $(evas_gl_generic_eolian_c) \
779 $(evas_gl_generic_eolian_h) 779 $(evas_gl_generic_eolian_h)
780 780
781EXTRA_DIST += $(evas_gl_generic_eolian_files)
782
781#evaseolianfilesdir = $(datadir)/eolian/include/evas-@VMAJ@ 783#evaseolianfilesdir = $(datadir)/eolian/include/evas-@VMAJ@
782#evaseolianfiles_DATA += $(evas_gl_generic_eolian_files) 784#evaseolianfiles_DATA += $(evas_gl_generic_eolian_files)
783 785
diff --git a/src/lib/evas/canvas/evas_filter_mixin.c b/src/lib/evas/canvas/evas_filter_mixin.c
index 8c5c8ae9c7..6cf205a369 100644
--- a/src/lib/evas/canvas/evas_filter_mixin.c
+++ b/src/lib/evas/canvas/evas_filter_mixin.c
@@ -11,6 +11,9 @@
11#define ENFN obj->layer->evas->engine.func 11#define ENFN obj->layer->evas->engine.func
12#define ENDT obj->layer->evas->engine.data.output 12#define ENDT obj->layer->evas->engine.data.output
13 13
14#define FCOW_BEGIN(_pd) eina_cow_write(evas_object_filter_cow, (const Eina_Cow_Data**)&(_pd->data))
15#define FCOW_END(_fcow, _pd) eina_cow_done(evas_object_filter_cow, (const Eina_Cow_Data**)&(_pd->data), _fcow, EINA_TRUE)
16
14typedef struct _Evas_Filter_Data Evas_Filter_Data; 17typedef struct _Evas_Filter_Data Evas_Filter_Data;
15struct _Evas_Filter_Data 18struct _Evas_Filter_Data
16{ 19{
@@ -21,9 +24,9 @@ static void
21_filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) 24_filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success)
22{ 25{
23 Eo *eo_obj = data; 26 Eo *eo_obj = data;
27 Evas_Filter_Data *pd = eo_data_scope_get(eo_obj, MY_CLASS);
24 28
25 // Destroy context as we won't reuse it. 29 // FIXME: This needs to run in the main loop
26 evas_filter_context_destroy(ctx);
27 30
28 // Redraw text with normal styles in case of failure 31 // Redraw text with normal styles in case of failure
29 if (!success) 32 if (!success)
@@ -39,6 +42,18 @@ _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success)
39 evas_object_coords_recalc(eo_obj, obj); 42 evas_object_coords_recalc(eo_obj, obj);
40 evas_object_inform_call_resize(eo_obj); 43 evas_object_inform_call_resize(eo_obj);
41 } 44 }
45 else
46 {
47 Evas_Object_Filter_Data *fcow;
48 void *output = evas_filter_buffer_backing_steal(ctx, EVAS_FILTER_BUFFER_OUTPUT_ID);
49
50 fcow = FCOW_BEGIN(pd);
51 fcow->output = output;
52 FCOW_END(fcow, pd);
53 }
54
55 // Destroy context as we won't reuse it.
56 evas_filter_context_destroy(ctx);
42} 57}
43 58
44static void 59static void
@@ -76,9 +91,6 @@ _filter_source_hash_free_cb(void *data)
76 free(pb); 91 free(pb);
77} 92}
78 93
79#define FCOW_BEGIN(_pd) eina_cow_write(evas_object_filter_cow, (const Eina_Cow_Data**)&(_pd->data))
80#define FCOW_END(_fcow, _pd) eina_cow_done(evas_object_filter_cow, (const Eina_Cow_Data**)&(_pd->data), _fcow, EINA_TRUE)
81
82Eina_Bool 94Eina_Bool
83evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, 95evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
84 void *output, void *context, void *surface, 96 void *output, void *context, void *surface,
@@ -86,6 +98,10 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
86{ 98{
87 Evas_Filter_Data *pd = eo_data_scope_get(eo_obj, MY_CLASS); 99 Evas_Filter_Data *pd = eo_data_scope_get(eo_obj, MY_CLASS);
88 100
101 // FIXME: Forcing sync render for all engines! (cb needs the main loop)
102 if (do_async) WRN("Disarding async render flag!");
103 do_async = EINA_FALSE;
104
89 if (!pd->data->invalid && (pd->data->chain || pd->data->code)) 105 if (!pd->data->invalid && (pd->data->chain || pd->data->code))
90 { 106 {
91 int X, Y, W, H, l = 0, r = 0, t = 0, b = 0; 107 int X, Y, W, H, l = 0, r = 0, t = 0, b = 0;
@@ -94,7 +110,6 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
94 Eina_Bool ok; 110 Eina_Bool ok;
95 void *previous = pd->data->output; 111 void *previous = pd->data->output;
96 Evas_Object_Filter_Data *fcow; 112 Evas_Object_Filter_Data *fcow;
97 void *filter_output;
98 113
99 /* NOTE: Filter rendering is now done ENTIRELY on CPU. 114 /* NOTE: Filter rendering is now done ENTIRELY on CPU.
100 * So we rely on cache/cache2 to allocate a real image buffer, 115 * So we rely on cache/cache2 to allocate a real image buffer,
@@ -236,8 +251,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
236 evas_filter_context_buffers_allocate_all(filter); 251 evas_filter_context_buffers_allocate_all(filter);
237 evas_filter_target_set(filter, context, surface, X + x, Y + y); 252 evas_filter_target_set(filter, context, surface, X + x, Y + y);
238 253
239 // Steal output and release previous 254 // Release previous output
240 filter_output = evas_filter_buffer_backing_steal(filter, EVAS_FILTER_BUFFER_OUTPUT_ID);
241 evas_filter_buffer_backing_release(filter, previous); 255 evas_filter_buffer_backing_release(filter, previous);
242 256
243 // Request rendering from the object itself (child class) 257 // Request rendering from the object itself (child class)
@@ -252,7 +266,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
252 ok = evas_filter_run(filter); 266 ok = evas_filter_run(filter);
253 267
254 fcow = FCOW_BEGIN(pd); 268 fcow = FCOW_BEGIN(pd);
255 fcow->output = filter_output; 269 fcow->output = NULL;
256 fcow->changed = EINA_FALSE; 270 fcow->changed = EINA_FALSE;
257 fcow->async = do_async; 271 fcow->async = do_async;
258 if (!ok) fcow->invalid = EINA_TRUE; 272 if (!ok) fcow->invalid = EINA_TRUE;
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index d632d9bb93..3b798f427e 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -209,6 +209,8 @@ _ector_buffer_create(Evas_Filter_Buffer const *fb, void *data)
209 flags = ECTOR_BUFFER_FLAG_CPU_READABLE | ECTOR_BUFFER_FLAG_CPU_WRITABLE; 209 flags = ECTOR_BUFFER_FLAG_CPU_READABLE | ECTOR_BUFFER_FLAG_CPU_WRITABLE;
210 if (fb->id == EVAS_FILTER_BUFFER_INPUT_ID) 210 if (fb->id == EVAS_FILTER_BUFFER_INPUT_ID)
211 flags |= ECTOR_BUFFER_FLAG_RENDERABLE; 211 flags |= ECTOR_BUFFER_FLAG_RENDERABLE;
212 else if (fb->id == EVAS_FILTER_BUFFER_OUTPUT_ID)
213 flags |= ECTOR_BUFFER_FLAG_DRAWABLE;
212 214
213 cspace = fb->alpha_only ? EVAS_COLORSPACE_GRY8 : EVAS_COLORSPACE_ARGB8888; 215 cspace = fb->alpha_only ? EVAS_COLORSPACE_GRY8 : EVAS_COLORSPACE_ARGB8888;
214 return fb->ENFN->ector_buffer_new(fb->ENDT, fb->ctx->evas->evas, 216 return fb->ENFN->ector_buffer_new(fb->ENDT, fb->ctx->evas->evas,
diff --git a/src/lib/evas/filters/evas_filter_mask.c b/src/lib/evas/filters/evas_filter_mask.c
index 949caa96f6..9f5b683606 100644
--- a/src/lib/evas/filters/evas_filter_mask.c
+++ b/src/lib/evas/filters/evas_filter_mask.c
@@ -64,7 +64,7 @@ evas_filter_mask_cpu_func_get(Evas_Filter_Command *cmd)
64static Eina_Bool 64static Eina_Bool
65_mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd) 65_mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd)
66{ 66{
67 unsigned int src_len, src_stride, msk_len, msk_stride, dst_len, dst_stride; 67 unsigned int src_len = 0, src_stride, msk_len = 0, msk_stride, dst_len = 0, dst_stride;
68 Efl_Gfx_Render_Op render_op = cmd->draw.rop; 68 Efl_Gfx_Render_Op render_op = cmd->draw.rop;
69 Evas_Filter_Buffer *msk_fb; 69 Evas_Filter_Buffer *msk_fb;
70 Alpha_Gfx_Func func; 70 Alpha_Gfx_Func func;
@@ -225,7 +225,7 @@ _mask_cpu_alpha_rgba_rgba(Evas_Filter_Command *cmd)
225 } 225 }
226 else msk_fb = cmd->mask; 226 else msk_fb = cmd->mask;
227 227
228 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_WRITE, E_ALPHA, &src_stride); 228 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_READ, E_ALPHA, &src_stride);
229 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ARGB, &msk_stride); 229 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ARGB, &msk_stride);
230 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride); 230 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride);
231 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end); 231 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end);
@@ -316,8 +316,8 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
316 } 316 }
317 else msk_fb = cmd->mask; 317 else msk_fb = cmd->mask;
318 318
319 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_WRITE, E_ALPHA, &src_stride); 319 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_READ, E_ALPHA, &src_stride);
320 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ARGB, &msk_stride); 320 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ALPHA, &msk_stride);
321 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride); 321 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride);
322 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end); 322 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end);
323 323
@@ -400,7 +400,7 @@ _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
400 } 400 }
401 else msk_fb = cmd->mask; 401 else msk_fb = cmd->mask;
402 402
403 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_WRITE, E_ARGB, &src_stride); 403 src_map = _buffer_map_all(cmd->input->buffer, &src_len, E_READ, E_ARGB, &src_stride);
404 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ARGB, &msk_stride); 404 msk_map = _buffer_map_all(msk_fb->buffer, &msk_len, E_READ, E_ARGB, &msk_stride);
405 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride); 405 dst_map = _buffer_map_all(cmd->output->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride);
406 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end); 406 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map && msk_map, end);
diff --git a/src/lib/evas/filters/evas_filter_utils.c b/src/lib/evas/filters/evas_filter_utils.c
index 8bb98d5bf5..802f09aad9 100644
--- a/src/lib/evas/filters/evas_filter_utils.c
+++ b/src/lib/evas/filters/evas_filter_utils.c
@@ -7,39 +7,65 @@ evas_filter_buffer_scaled_get(Evas_Filter_Context *ctx,
7 Evas_Filter_Buffer *src, 7 Evas_Filter_Buffer *src,
8 unsigned w, unsigned h) 8 unsigned w, unsigned h)
9{ 9{
10 Evas_Filter_Buffer *fb; 10 unsigned int src_len = 0, src_stride, dst_len = 0, dst_stride;
11 RGBA_Image *dstim, *srcim; 11 uint8_t *src_map = NULL, *dst_map = NULL;
12 Evas_Filter_Buffer *dst;
13 RGBA_Image dstim, srcim;
12 RGBA_Draw_Context dc; 14 RGBA_Draw_Context dc;
13 Eina_Bool ok; 15 Eina_Bool ok;
14 16
15 // only for RGBA 17 DBG("Scaling buffer from %dx%d to %dx%d, this is a slow operation!",
16 EINA_SAFETY_ON_FALSE_RETURN_VAL(!src->alpha_only, NULL); 18 src->w, src->h, w, h);
17 19 DEBUG_TIME_BEGIN();
18 srcim = evas_filter_buffer_backing_get(ctx, src->id); 20
19 EINA_SAFETY_ON_NULL_RETURN_VAL(srcim, NULL); 21 // Get destination buffer
20 22 dst = evas_filter_temporary_buffer_get(ctx, w, h, src->alpha_only);
21 fb = evas_filter_temporary_buffer_get(ctx, w, h, src->alpha_only); 23 EINA_SAFETY_ON_NULL_RETURN_VAL(dst, NULL);
22 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); 24
23 25 // Map input and output
24 dstim = evas_filter_buffer_backing_get(ctx, fb->id); 26 src_map = _buffer_map_all(src->buffer, &src_len, E_READ, E_ARGB, &src_stride);
25 EINA_SAFETY_ON_NULL_RETURN_VAL(dstim, NULL); 27 dst_map = _buffer_map_all(dst->buffer, &dst_len, E_WRITE, E_ARGB, &dst_stride);
26 EINA_SAFETY_ON_FALSE_RETURN_VAL((dstim->cache_entry.w == w) && 28 EINA_SAFETY_ON_FALSE_GOTO(src_map && dst_map, end);
27 (dstim->cache_entry.h == h), NULL); 29 EINA_SAFETY_ON_FALSE_GOTO((src_stride == ((unsigned) src->w * 4)) &&
28 30 (dst_stride == (w * 4)), end);
31
32 // Wrap as basic RGBA_Images
33 memset(&dstim, 0, sizeof(dstim));
34 dstim.cache_entry.w = w;
35 dstim.cache_entry.h = h;
36 dstim.cache_entry.flags.alpha = 1;
37 dstim.cache_entry.flags.alpha_sparse = 0;
38 dstim.cache_entry.space = EVAS_COLORSPACE_ARGB8888;
39 dstim.image.data8 = dst_map;
40
41 memset(&srcim, 0, sizeof(srcim));
42 srcim.cache_entry.w = src->w;
43 srcim.cache_entry.h = src->h;
44 srcim.cache_entry.flags.alpha = 1;
45 srcim.cache_entry.flags.alpha_sparse = 0;
46 srcim.cache_entry.space = EVAS_COLORSPACE_ARGB8888;
47 srcim.image.data8 = src_map;
48
49 // Basic draw context
29 memset(&dc, 0, sizeof(dc)); 50 memset(&dc, 0, sizeof(dc));
30 dc.sli.h = 1; 51 dc.sli.h = 1;
31 dc.render_op = EVAS_RENDER_COPY; 52 dc.render_op = EVAS_RENDER_COPY;
32 53
54 // Do the scale
33 ok = evas_common_scale_rgba_in_to_out_clip_smooth 55 ok = evas_common_scale_rgba_in_to_out_clip_smooth
34 (srcim, dstim, &dc, 0, 0, src->w, src->h, 0, 0, w, h); 56 (&srcim, &dstim, &dc, 0, 0, src->w, src->h, 0, 0, w, h);
35 57
36 if (!ok) 58 if (!ok)
37 { 59 {
38 ERR("RGBA Image scaling failed."); 60 ERR("RGBA Image scaling failed.");
39 return NULL; 61 dst = NULL;
40 } 62 }
41 63
42 return fb; 64end:
65 if (src_map) eo_do(src->buffer, ector_buffer_unmap(src_map, src_len));
66 if (dst_map) eo_do(dst->buffer, ector_buffer_unmap(dst_map, dst_len));
67 DEBUG_TIME_END();
68 return dst;
43} 69}
44 70
45static Eina_Bool 71static Eina_Bool
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
index 2b5b644d44..dc68f1c52b 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_image_buffer.c
@@ -54,17 +54,6 @@ _pixels_argb_to_gry8_convert(uint8_t *dst, const uint32_t *src, int len)
54 } 54 }
55} 55}
56 56
57static inline void
58_pixels_gry8_to_argb_convert(uint32_t *dst, const uint8_t *src, int len)
59{
60 int k;
61 for (k = 0; k < len; k++)
62 {
63 uint8_t s = *src++;
64 *dst++ = ARGB_JOIN(s, s, s, s);
65 }
66}
67
68EOLIAN static void 57EOLIAN static void
69_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd, 58_evas_ector_gl_image_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_GL_Image_Buffer_Data *pd,
70 Evas *evas, void *image) 59 Evas *evas, void *image)
@@ -175,7 +164,7 @@ _evas_ector_gl_image_buffer_ector_generic_buffer_map(Eo *obj EINA_UNUSED, Evas_E
175 if (tofree) 164 if (tofree)
176 map->im = im; 165 map->im = im;
177 else 166 else
178 map->im = ENFN->image_ref(ENDT, im); 167 map->im = NULL;
179 168
180 len = w * h; 169 len = w * h;
181 if (cspace == EFL_GFX_COLORSPACE_GRY8) 170 if (cspace == EFL_GFX_COLORSPACE_GRY8)
@@ -218,7 +207,8 @@ _evas_ector_gl_image_buffer_ector_generic_buffer_unmap(Eo *obj EINA_UNUSED, Evas
218 { 207 {
219 CRI("Not implemented yet. Dropping pixel changes."); 208 CRI("Not implemented yet. Dropping pixel changes.");
220 } 209 }
221 ENFN->image_free(ENDT, map->im); 210 if (map->im)
211 ENFN->image_free(ENDT, map->im);
222 if (map->allocated) 212 if (map->allocated)
223 free(map->ptr); 213 free(map->ptr);
224 return; 214 return;
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c
index 6b2e127ddc..4fb6723bd6 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c
@@ -73,6 +73,12 @@ _evas_ector_gl_rgbaimage_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_
73 goto end; 73 goto end;
74 74
75 gc = re->window_gl_context_get(re->software.ob); 75 gc = re->window_gl_context_get(re->software.ob);
76#ifdef EVAS_CSERVE2
77 if (evas_cache2_image_cached(&pd->image->cache_entry))
78 evas_cache2_image_ref(&pd->image->cache_entry);
79 else
80#endif
81 evas_cache_image_ref(&pd->image->cache_entry);
76 pd->glim = evas_gl_common_image_new_from_rgbaimage(gc, pd->image, NULL, &err); 82 pd->glim = evas_gl_common_image_new_from_rgbaimage(gc, pd->image, NULL, &err);
77 if ((err != EVAS_LOAD_ERROR_NONE) || !pd->glim) 83 if ((err != EVAS_LOAD_ERROR_NONE) || !pd->glim)
78 { 84 {
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 6cc4b90bef..ddedadd777 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2502,7 +2502,7 @@ eng_ector_buffer_new(void *data, Evas *evas, void *pixels,
2502 Ector_Buffer *buf = NULL; 2502 Ector_Buffer *buf = NULL;
2503 int iw = width + l + r; 2503 int iw = width + l + r;
2504 int ih = height + t + b; 2504 int ih = height + t + b;
2505 int pxs = (cspace = EFL_GFX_COLORSPACE_ARGB8888) ? 4 : 1; 2505 int pxs = (cspace == EFL_GFX_COLORSPACE_ARGB8888) ? 4 : 1;
2506 2506
2507 if (stride && (stride != iw * pxs)) 2507 if (stride && (stride != iw * pxs))
2508 WRN("stride support is not implemented for ector gl buffers at this point!"); 2508 WRN("stride support is not implemented for ector gl buffers at this point!");
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 06d2a5d4ca..8a4429a592 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -3772,17 +3772,52 @@ eng_ector_buffer_wrap(void *data EINA_UNUSED, Evas *e, void *engine_image, Eina_
3772} 3772}
3773 3773
3774static Ector_Buffer * 3774static Ector_Buffer *
3775eng_ector_buffer_new(void *data EINA_UNUSED, Evas *e, void *pixels, 3775eng_ector_buffer_new(void *data EINA_UNUSED, Evas *evas, void *pixels,
3776 int width, int height, int stride, 3776 int width, int height, int stride,
3777 Efl_Gfx_Colorspace cspace, Eina_Bool writeable, 3777 Efl_Gfx_Colorspace cspace, Eina_Bool writeable,
3778 int l, int r, int t, int b, 3778 int l, int r, int t, int b,
3779 Ector_Buffer_Flag flags EINA_UNUSED) 3779 Ector_Buffer_Flag flags EINA_UNUSED)
3780{ 3780{
3781 Ector_Buffer *buf = NULL; 3781 Ector_Buffer *buf = NULL;
3782 int pxs = (cspace == EFL_GFX_COLORSPACE_ARGB8888) ? 4 : 1;
3783 int iw = width + l + r;
3784 int ih = height + t + b;
3782 3785
3783 buf = eo_add(ECTOR_SOFTWARE_BUFFER_CLASS, e, 3786 if ((flags & (ECTOR_BUFFER_FLAG_RENDERABLE | ECTOR_BUFFER_FLAG_DRAWABLE)) == 0)
3784 ector_buffer_pixels_set(pixels, width, height, stride, cspace, 3787 {
3785 writeable, l, r, t, b)); 3788 buf = eo_add(ECTOR_SOFTWARE_BUFFER_CLASS, evas,
3789 ector_buffer_pixels_set(pixels, width, height, stride, cspace,
3790 writeable, l, r, t, b));
3791 }
3792 else
3793 {
3794 // Create an RGBA Image as backing
3795 Image_Entry *ie;
3796
3797 if (pixels)
3798 {
3799 // no copy
3800 ie = evas_cache_image_data(evas_common_image_cache_get(), iw, ih,
3801 pixels, EINA_TRUE, (Evas_Colorspace) cspace);
3802 if (!ie) return NULL;
3803 }
3804 else
3805 {
3806 // alloc buffer
3807 ie = evas_cache_image_copied_data(evas_common_image_cache_get(), iw, ih,
3808 NULL, EINA_TRUE, (Evas_Colorspace) cspace);
3809 if (!ie) return NULL;
3810 pixels = ((RGBA_Image *) ie)->image.data;
3811 memset(pixels, 0, iw * ih * pxs);
3812 }
3813 ie->borders.l = l;
3814 ie->borders.r = r;
3815 ie->borders.t = t;
3816 ie->borders.b = b;
3817
3818 buf = eng_ector_buffer_wrap(data, evas, ie, EINA_TRUE);
3819 evas_cache_image_drop(ie);
3820 }
3786 3821
3787 return buf; 3822 return buf;
3788} 3823}