summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2020-01-09 15:00:22 +0900
committerHermet Park <hermetpark@gmail.com>2020-01-09 15:01:47 +0900
commitf6f67d60f3c2171a7e96cff2a205d4895c13117c (patch)
tree27db65443d9d9b743e0b163f8aef2c2cedcdc761
parentb03f06ca8d9ff95a11b2d9be7b522c2d591adf66 (diff)
evas ector: ++safety.
add return value by ector_begin() for vector safety.
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c8
-rw-r--r--src/lib/evas/include/evas_private.h2
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c6
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c7
4 files changed, 17 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index c94cf28b48..60008de27a 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -519,7 +519,11 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
519 _evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, 255, NULL, 0); 519 _evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, 255, NULL, 0);
520 520
521 //Actual content drawing 521 //Actual content drawing
522 ENFN->ector_begin(engine, buffer, context, ector, 0, 0, do_async); 522 if (!ENFN->ector_begin(engine, buffer, context, ector, 0, 0, do_async))
523 {
524 ERR("Failed ector begin!");
525 return NULL;
526 }
523 527
524 //draw on buffer 528 //draw on buffer
525 _evas_vg_render(obj, pd, 529 _evas_vg_render(obj, pd,
@@ -546,6 +550,8 @@ _render_buffer_to_screen(Evas_Object_Protected_Data *obj,
546 int x, int y, int w, int h, 550 int x, int y, int w, int h,
547 Eina_Bool do_async, Eina_Bool cacheable) 551 Eina_Bool do_async, Eina_Bool cacheable)
548{ 552{
553 if (!buffer) return;
554
549 Eina_Bool async_unref; 555 Eina_Bool async_unref;
550 556
551 //Draw the buffer as image to canvas 557 //Draw the buffer as image to canvas
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index aacbe016f8..e57910f930 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1514,7 +1514,7 @@ struct _Evas_Func
1514 void (*ector_destroy) (void *engine, Ector_Surface *surface); 1514 void (*ector_destroy) (void *engine, Ector_Surface *surface);
1515 Ector_Buffer *(*ector_buffer_wrap) (void *engine, Evas *e, void *engine_image); 1515 Ector_Buffer *(*ector_buffer_wrap) (void *engine, Evas *e, void *engine_image);
1516 Ector_Buffer *(*ector_buffer_new) (void *engine, Evas *e, int width, int height, Efl_Gfx_Colorspace cspace, Ector_Buffer_Flag flags); 1516 Ector_Buffer *(*ector_buffer_new) (void *engine, Evas *e, int width, int height, Efl_Gfx_Colorspace cspace, Ector_Buffer_Flag flags);
1517 void (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool do_async); 1517 Eina_Bool (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool do_async);
1518 void (*ector_renderer_draw) (void *engine, void *output, void *context, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async); 1518 void (*ector_renderer_draw) (void *engine, void *output, void *context, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async);
1519 void (*ector_end) (void *engine, void *output, void *context, Ector_Surface *ector, Eina_Bool do_async); 1519 void (*ector_end) (void *engine, void *output, void *context, Ector_Surface *ector, Eina_Bool do_async);
1520 1520
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 045323b680..ec14e2bacc 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2712,7 +2712,7 @@ eng_ector_surface_cache_drop(void *engine, void *key)
2712 generic_cache_data_drop(e->software.surface_cache, key); 2712 generic_cache_data_drop(e->software.surface_cache, key);
2713} 2713}
2714 2714
2715static void 2715static Eina_Bool
2716eng_ector_begin(void *engine, void *surface, 2716eng_ector_begin(void *engine, void *surface,
2717 void *context EINA_UNUSED, Ector_Surface *ector, 2717 void *context EINA_UNUSED, Ector_Surface *ector,
2718 int x, int y, Eina_Bool do_async EINA_UNUSED) 2718 int x, int y, Eina_Bool do_async EINA_UNUSED)
@@ -2720,6 +2720,7 @@ eng_ector_begin(void *engine, void *surface,
2720 if (use_gl) 2720 if (use_gl)
2721 { 2721 {
2722 //FIXME: No implementation yet 2722 //FIXME: No implementation yet
2723 return EINA_FALSE;
2723 } 2724 }
2724 else 2725 else
2725 { 2726 {
@@ -2729,6 +2730,7 @@ eng_ector_begin(void *engine, void *surface,
2729 int load_err; 2730 int load_err;
2730 2731
2731 glim = eng_image_data_get(engine, glim, EINA_TRUE, &pixels, &load_err,NULL); 2732 glim = eng_image_data_get(engine, glim, EINA_TRUE, &pixels, &load_err,NULL);
2733 if (!glim || !pixels) return EINA_FALSE;
2732 eng_image_stride_get(engine, glim, &stride); 2734 eng_image_stride_get(engine, glim, &stride);
2733 eng_image_size_get(engine, glim, &w, &h); 2735 eng_image_size_get(engine, glim, &w, &h);
2734 2736
@@ -2737,8 +2739,8 @@ eng_ector_begin(void *engine, void *surface,
2737 // it just uses the software backend to draw for now 2739 // it just uses the software backend to draw for now
2738 ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 2740 ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
2739 ector_surface_reference_point_set(ector, x, y); 2741 ector_surface_reference_point_set(ector, x, y);
2740
2741 } 2742 }
2743 return EINA_TRUE;
2742} 2744}
2743 2745
2744static void 2746static void
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 33c56b1238..b548322539 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4463,7 +4463,7 @@ _draw_thread_ector_surface_set(void *data)
4463 eina_mempool_free(_mp_command_ector_surface, ector_surface); 4463 eina_mempool_free(_mp_command_ector_surface, ector_surface);
4464} 4464}
4465 4465
4466static void 4466static Eina_Bool
4467eng_ector_begin(void *engine EINA_UNUSED, void *surface, 4467eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4468 void *context EINA_UNUSED, Ector_Surface *ector, 4468 void *context EINA_UNUSED, Ector_Surface *ector,
4469 int x, int y, Eina_Bool do_async) 4469 int x, int y, Eina_Bool do_async)
@@ -4473,7 +4473,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4473 Evas_Thread_Command_Ector_Surface *nes; 4473 Evas_Thread_Command_Ector_Surface *nes;
4474 4474
4475 nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface)); 4475 nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface));
4476 if (!nes) return; 4476 if (!nes) return EINA_FALSE;
4477 4477
4478 nes->ector = ector; 4478 nes->ector = ector;
4479 nes->pixels = surface; 4479 nes->pixels = surface;
@@ -4490,6 +4490,8 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4490 unsigned int h = 0; 4490 unsigned int h = 0;
4491 4491
4492 pixels = evas_cache_image_pixels(&sf->cache_entry); 4492 pixels = evas_cache_image_pixels(&sf->cache_entry);
4493 if (!pixels) return EINA_FALSE;
4494
4493 w = sf->cache_entry.w; 4495 w = sf->cache_entry.w;
4494 h = sf->cache_entry.h; 4496 h = sf->cache_entry.h;
4495 // clear the surface before giving to ector 4497 // clear the surface before giving to ector
@@ -4498,6 +4500,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4498 ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 4500 ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
4499 ector_surface_reference_point_set(ector, x, y); 4501 ector_surface_reference_point_set(ector, x, y);
4500 } 4502 }
4503 return EINA_TRUE;
4501} 4504}
4502 4505
4503static void 4506static void