summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-31 14:33:03 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:44 +0900
commit9e0670a7051cb7cee928078b362ae8642908902f (patch)
treedbc8acd7b41bef96e400b668e00760f9f27cd4dc /src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
parentdc4790e08ba8bd239e499227881ba8b7c95c127e (diff)
Evas filters & Ector GL: Prepare ground work for GL buffers
This fixes crashes, adds safety, and notes a couple of things that are not yet implemented: - Make an Evas_GL_Image from an RGBA_Image so we can draw it on the canvas. This means Evas.Ector.GL.RGBA_Image.Buffer - Readable Evas_GL_Image objects with gl_read_pixels --> Implement proper map() & unmap() for GL buffers
Diffstat (limited to 'src/modules/evas/engines/software_generic/evas_ector_software_buffer.c')
-rw-r--r--src/modules/evas/engines/software_generic/evas_ector_software_buffer.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
index 22efa05329..d46b2c1119 100644
--- a/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
+++ b/src/modules/evas/engines/software_generic/evas_ector_software_buffer.c
@@ -5,7 +5,6 @@
5#include <software/Ector_Software.h> 5#include <software/Ector_Software.h>
6#include "evas_common_private.h" 6#include "evas_common_private.h"
7#include "evas_private.h" 7#include "evas_private.h"
8#include "draw.h"
9 8
10#include "evas_ector_buffer.eo.h" 9#include "evas_ector_buffer.eo.h"
11#include "evas_ector_software_buffer.eo.h" 10#include "evas_ector_software_buffer.eo.h"
@@ -15,28 +14,26 @@
15typedef struct { 14typedef struct {
16 Ector_Software_Buffer_Base_Data *base; 15 Ector_Software_Buffer_Base_Data *base;
17 Evas *evas; 16 Evas *evas;
18 Image_Entry *image; 17 RGBA_Image *image;
19} Evas_Ector_Software_Buffer_Data; 18} Evas_Ector_Software_Buffer_Data;
20 19
21#define ENFN e->engine.func 20// Note: Don't use ENFN, ENDT here because the GL engine may also use SW buffers
22#define ENDT e->engine.data.output 21// eg. in the filters.
23 22
24EOLIAN static void 23EOLIAN static void
25_evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_Software_Buffer_Data *pd, 24_evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ector_Software_Buffer_Data *pd,
26 Evas *evas, void *image) 25 Evas *evas, void *image)
27{ 26{
28 Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CANVAS_CLASS); 27 RGBA_Image *im = image;
29 Image_Entry *ie = image;
30 RGBA_Image *im;
31 Eina_Bool b; 28 Eina_Bool b;
32 29
30 EINA_SAFETY_ON_NULL_RETURN(image);
33 if (eo_do_ret(obj, b, eo_finalized_get())) 31 if (eo_do_ret(obj, b, eo_finalized_get()))
34 { 32 {
35 CRI("engine_image must be set at construction time only"); 33 CRI("engine_image must be set at construction time only");
36 return; 34 return;
37 } 35 }
38 36
39 im = (RGBA_Image *) ie;
40 if (!im->image.data) 37 if (!im->image.data)
41 { 38 {
42 CRI("image has no pixels yet"); 39 CRI("image has no pixels yet");
@@ -44,12 +41,13 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj, Evas_Ect
44 } 41 }
45 42
46 pd->evas = eo_xref(evas, obj); 43 pd->evas = eo_xref(evas, obj);
47 pd->image = ENFN->image_ref(ENDT, ie); 44 evas_cache_image_ref(&im->cache_entry);
45 pd->image = im;
48 if (!pd->image) return; 46 if (!pd->image) return;
49 47
50 eo_do(obj, ector_buffer_pixels_set(im->image.data, 48 eo_do(obj, ector_buffer_pixels_set(im->image.data,
51 im->cache_entry.w, im->cache_entry.h, 0, 49 im->cache_entry.w, im->cache_entry.h, 0,
52 im->cache_entry.space, 50 (Efl_Gfx_Colorspace) im->cache_entry.space,
53 EINA_TRUE, 0, 0, 0, 0)); 51 EINA_TRUE, 0, 0, 0, 0));
54} 52}
55 53
@@ -58,7 +56,16 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_get(Eo *obj EINA_UNUS
58 Evas_Ector_Software_Buffer_Data *pd, 56 Evas_Ector_Software_Buffer_Data *pd,
59 Evas **evas, void **image) 57 Evas **evas, void **image)
60{ 58{
59 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
60
61 if (evas) *evas = pd->evas; 61 if (evas) *evas = pd->evas;
62 if (e->engine.func->gl_surface_read_pixels)
63 {
64 ERR("Invalid: requesting engine_image from a GL image from a simple SW buffer!");
65 if (image) *image = NULL;
66 return;
67 }
68
62 if (image) *image = pd->image; 69 if (image) *image = pd->image;
63} 70}
64 71
@@ -82,10 +89,8 @@ _evas_ector_software_buffer_eo_base_finalize(Eo *obj, Evas_Ector_Software_Buffer
82EOLIAN static void 89EOLIAN static void
83_evas_ector_software_buffer_eo_base_destructor(Eo *obj, Evas_Ector_Software_Buffer_Data *pd) 90_evas_ector_software_buffer_eo_base_destructor(Eo *obj, Evas_Ector_Software_Buffer_Data *pd)
84{ 91{
85 Evas_Public_Data *e = eo_data_scope_get(pd->evas, EVAS_CANVAS_CLASS);
86
87 eo_data_xunref(obj, pd->base, obj); 92 eo_data_xunref(obj, pd->base, obj);
88 ENFN->image_free(ENDT, pd->image); 93 evas_cache_image_drop(&pd->image->cache_entry);
89 eo_xunref(pd->evas, obj); 94 eo_xunref(pd->evas, obj);
90 eo_do_super(obj, MY_CLASS, eo_destructor()); 95 eo_do_super(obj, MY_CLASS, eo_destructor());
91} 96}