summaryrefslogtreecommitdiff
path: root/src/modules/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-01-04 18:00:30 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:44 +0900
commit0d5b42e6bbff30ead404460a0538d80282a9d6c9 (patch)
tree3c42489655e4ac2e2ad97aaae75068a88fc3d72c /src/modules/evas
parent66961126916f6ab61ba6549f7ad96399bdf773af (diff)
Evas filters: Move evas image creation to the engine
Evas filters is now more and more unaware of evas images (RGBA_Image) and the engine + ector take care of everything. Still left to do: - map / unmap an FBO buffer into RO or RW memory
Diffstat (limited to 'src/modules/evas')
-rw-r--r--src/modules/evas/engines/gl_generic/evas_ector_gl_rgbaimage_buffer.c3
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c71
2 files changed, 63 insertions, 11 deletions
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 03d957ac81..6b2e127ddc 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
@@ -64,15 +64,14 @@ _evas_ector_gl_rgbaimage_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_
64{ 64{
65 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS); 65 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
66 Render_Engine_GL_Generic *re = e->engine.data.output; 66 Render_Engine_GL_Generic *re = e->engine.data.output;
67 Evas_Engine_GL_Context *gc = NULL;
68 int err = EVAS_LOAD_ERROR_NONE; 67 int err = EVAS_LOAD_ERROR_NONE;
68 Evas_Engine_GL_Context *gc;
69 69
70 if (evas) *evas = pd->evas; 70 if (evas) *evas = pd->evas;
71 if (image) *image = NULL; 71 if (image) *image = NULL;
72 if (pd->glim) 72 if (pd->glim)
73 goto end; 73 goto end;
74 74
75 EINA_SAFETY_ON_NULL_RETURN(re);
76 gc = re->window_gl_context_get(re->software.ob); 75 gc = re->window_gl_context_get(re->software.ob);
77 pd->glim = evas_gl_common_image_new_from_rgbaimage(gc, pd->image, NULL, &err); 76 pd->glim = evas_gl_common_image_new_from_rgbaimage(gc, pd->image, NULL, &err);
78 if ((err != EVAS_LOAD_ERROR_NONE) || !pd->glim) 77 if ((err != EVAS_LOAD_ERROR_NONE) || !pd->glim)
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index fc9caf04fc..6cc4b90bef 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2469,7 +2469,7 @@ eng_ector_destroy(void *data EINA_UNUSED, Ector_Surface *ector)
2469} 2469}
2470 2470
2471static Ector_Buffer * 2471static Ector_Buffer *
2472eng_ector_buffer_wrap(void *data EINA_UNUSED, Evas *e, void *engine_image, Eina_Bool is_rgba_image) 2472eng_ector_buffer_wrap(void *data EINA_UNUSED, Evas *evas, void *engine_image, Eina_Bool is_rgba_image)
2473{ 2473{
2474 Ector_Buffer *buf = NULL; 2474 Ector_Buffer *buf = NULL;
2475 EINA_SAFETY_ON_NULL_RETURN_VAL(engine_image, NULL); 2475 EINA_SAFETY_ON_NULL_RETURN_VAL(engine_image, NULL);
@@ -2477,27 +2477,80 @@ eng_ector_buffer_wrap(void *data EINA_UNUSED, Evas *e, void *engine_image, Eina_
2477 { 2477 {
2478 RGBA_Image *im = engine_image; 2478 RGBA_Image *im = engine_image;
2479 2479
2480 buf = eo_add(EVAS_ECTOR_GL_RGBAIMAGE_BUFFER_CLASS, e, 2480 buf = eo_add(EVAS_ECTOR_GL_RGBAIMAGE_BUFFER_CLASS, evas,
2481 evas_ector_buffer_engine_image_set(e, im)); 2481 evas_ector_buffer_engine_image_set(evas, im));
2482 } 2482 }
2483 else 2483 else
2484 { 2484 {
2485 Evas_GL_Image *im = engine_image; 2485 Evas_GL_Image *im = engine_image;
2486 2486
2487 buf = eo_add(EVAS_ECTOR_GL_IMAGE_BUFFER_CLASS, e, 2487 buf = eo_add(EVAS_ECTOR_GL_IMAGE_BUFFER_CLASS, evas,
2488 evas_ector_buffer_engine_image_set(e, im)); 2488 evas_ector_buffer_engine_image_set(evas, im));
2489 } 2489 }
2490 return buf; 2490 return buf;
2491} 2491}
2492 2492
2493static Ector_Buffer * 2493static Ector_Buffer *
2494eng_ector_buffer_new(void *data EINA_UNUSED, Evas *e, void *pixels, 2494eng_ector_buffer_new(void *data, Evas *evas, void *pixels,
2495 int width, int height, int stride, 2495 int width, int height, int stride,
2496 Efl_Gfx_Colorspace cspace, Eina_Bool writeable, 2496 Efl_Gfx_Colorspace cspace, Eina_Bool writeable EINA_UNUSED,
2497 int l, int r, int t, int b, Ector_Buffer_Flag flags) 2497 int l, int r, int t, int b, Ector_Buffer_Flag flags)
2498{ 2498{
2499 CRI("Not implemented."); 2499 Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CANVAS_CLASS);
2500 return NULL; 2500 Render_Engine_GL_Generic *re = e->engine.data.output;
2501 Evas_Engine_GL_Context *gc = NULL;
2502 Ector_Buffer *buf = NULL;
2503 int iw = width + l + r;
2504 int ih = height + t + b;
2505 int pxs = (cspace = EFL_GFX_COLORSPACE_ARGB8888) ? 4 : 1;
2506
2507 if (stride && (stride != iw * pxs))
2508 WRN("stride support is not implemented for ector gl buffers at this point!");
2509
2510 if ((flags & ECTOR_BUFFER_FLAG_RENDERABLE) == 0)
2511 {
2512 // Create an RGBA Image as backing
2513 Image_Entry *ie;
2514
2515 if (pixels)
2516 {
2517 // no copy
2518 ie = evas_cache_image_data(evas_common_image_cache_get(), iw, ih,
2519 pixels, EINA_TRUE, (Evas_Colorspace) cspace);
2520 if (!ie) return NULL;
2521 }
2522 else
2523 {
2524 // alloc buffer
2525 ie = evas_cache_image_copied_data(evas_common_image_cache_get(), iw, ih,
2526 NULL, EINA_TRUE, (Evas_Colorspace) cspace);
2527 if (!ie) return NULL;
2528 pixels = ((RGBA_Image *) ie)->image.data;
2529 memset(pixels, 0, iw * ih * pxs);
2530 }
2531 ie->borders.l = l;
2532 ie->borders.r = r;
2533 ie->borders.t = t;
2534 ie->borders.b = b;
2535
2536 buf = eng_ector_buffer_wrap(data, evas, ie, EINA_TRUE);
2537 evas_cache_image_drop(ie);
2538 }
2539 else
2540 {
2541 // Create only an Evas_GL_Image as backing
2542 Evas_GL_Image *im;
2543
2544 if (l || r || t || b)
2545 WRN("Borders are not supported by Evas surfaces!");
2546
2547 gc = re->window_gl_context_get(re->software.ob);
2548 im = evas_gl_common_image_surface_new(gc, iw, ih, EINA_TRUE);
2549 buf = eo_add(EVAS_ECTOR_GL_IMAGE_BUFFER_CLASS, evas,
2550 evas_ector_buffer_engine_image_set(evas, im));
2551 im->references--;
2552 }
2553 return buf;
2501} 2554}
2502 2555
2503static Efl_Gfx_Render_Op 2556static Efl_Gfx_Render_Op