evas ector: ++safety.

add return value by ector_begin() for vector safety.
This commit is contained in:
Hermet Park 2020-01-09 15:00:22 +09:00
parent b03f06ca8d
commit f6f67d60f3
4 changed files with 17 additions and 6 deletions

View File

@ -519,7 +519,11 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
_evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, 255, NULL, 0);
//Actual content drawing
ENFN->ector_begin(engine, buffer, context, ector, 0, 0, do_async);
if (!ENFN->ector_begin(engine, buffer, context, ector, 0, 0, do_async))
{
ERR("Failed ector begin!");
return NULL;
}
//draw on buffer
_evas_vg_render(obj, pd,
@ -546,6 +550,8 @@ _render_buffer_to_screen(Evas_Object_Protected_Data *obj,
int x, int y, int w, int h,
Eina_Bool do_async, Eina_Bool cacheable)
{
if (!buffer) return;
Eina_Bool async_unref;
//Draw the buffer as image to canvas

View File

@ -1514,7 +1514,7 @@ struct _Evas_Func
void (*ector_destroy) (void *engine, Ector_Surface *surface);
Ector_Buffer *(*ector_buffer_wrap) (void *engine, Evas *e, void *engine_image);
Ector_Buffer *(*ector_buffer_new) (void *engine, Evas *e, int width, int height, Efl_Gfx_Colorspace cspace, Ector_Buffer_Flag flags);
void (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool do_async);
Eina_Bool (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool do_async);
void (*ector_renderer_draw) (void *engine, void *output, void *context, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async);
void (*ector_end) (void *engine, void *output, void *context, Ector_Surface *ector, Eina_Bool do_async);

View File

@ -2712,7 +2712,7 @@ eng_ector_surface_cache_drop(void *engine, void *key)
generic_cache_data_drop(e->software.surface_cache, key);
}
static void
static Eina_Bool
eng_ector_begin(void *engine, void *surface,
void *context EINA_UNUSED, Ector_Surface *ector,
int x, int y, Eina_Bool do_async EINA_UNUSED)
@ -2720,6 +2720,7 @@ eng_ector_begin(void *engine, void *surface,
if (use_gl)
{
//FIXME: No implementation yet
return EINA_FALSE;
}
else
{
@ -2729,6 +2730,7 @@ eng_ector_begin(void *engine, void *surface,
int load_err;
glim = eng_image_data_get(engine, glim, EINA_TRUE, &pixels, &load_err,NULL);
if (!glim || !pixels) return EINA_FALSE;
eng_image_stride_get(engine, glim, &stride);
eng_image_size_get(engine, glim, &w, &h);
@ -2737,8 +2739,8 @@ eng_ector_begin(void *engine, void *surface,
// it just uses the software backend to draw for now
ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_surface_reference_point_set(ector, x, y);
}
return EINA_TRUE;
}
static void

View File

@ -4463,7 +4463,7 @@ _draw_thread_ector_surface_set(void *data)
eina_mempool_free(_mp_command_ector_surface, ector_surface);
}
static void
static Eina_Bool
eng_ector_begin(void *engine EINA_UNUSED, void *surface,
void *context EINA_UNUSED, Ector_Surface *ector,
int x, int y, Eina_Bool do_async)
@ -4473,7 +4473,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
Evas_Thread_Command_Ector_Surface *nes;
nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface));
if (!nes) return;
if (!nes) return EINA_FALSE;
nes->ector = ector;
nes->pixels = surface;
@ -4490,6 +4490,8 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
unsigned int h = 0;
pixels = evas_cache_image_pixels(&sf->cache_entry);
if (!pixels) return EINA_FALSE;
w = sf->cache_entry.w;
h = sf->cache_entry.h;
// clear the surface before giving to ector
@ -4498,6 +4500,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_surface_reference_point_set(ector, x, y);
}
return EINA_TRUE;
}
static void