summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2018-02-08 14:27:15 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-02-08 14:44:29 +0900
commit48433efc43de9eeaf353e3da18c7109e434902da (patch)
tree38bba818fa70f69175e8677b35e8e4da9a8f102c
parent80cc3f230d47bc3f3d049e59adde449694e93b2c (diff)
ector: Updated the ector_buffer_pixels_set() api with stride info
Reviewers: jypark, jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5795
-rw-r--r--src/lib/ector/cairo/ector_cairo_software_surface.c4
-rw-r--r--src/lib/ector/ector_buffer.eo1
-rw-r--r--src/lib/ector/software/ector_software_buffer.c10
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c4
-rw-r--r--src/modules/evas/engines/software_generic/evas_ector_software_buffer.c2
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c6
6 files changed, 16 insertions, 11 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_software_surface.c b/src/lib/ector/cairo/ector_cairo_software_surface.c
index 98dd8e0a4f..96bf1c1081 100644
--- a/src/lib/ector/cairo/ector_cairo_software_surface.c
+++ b/src/lib/ector/cairo/ector_cairo_software_surface.c
@@ -51,7 +51,7 @@ struct _Ector_Cairo_Software_Surface_Data
51 51
52EOLIAN static Eina_Bool 52EOLIAN static Eina_Bool
53_ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, 53_ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd,
54 void *pixels, int width, int height, 54 void *pixels, int width, int height, int stride,
55 Efl_Gfx_Colorspace cspace, Eina_Bool writable) 55 Efl_Gfx_Colorspace cspace, Eina_Bool writable)
56{ 56{
57 cairo_t *ctx = NULL; 57 cairo_t *ctx = NULL;
@@ -72,7 +72,7 @@ _ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Softw
72 cairo_surface_destroy(pd->surface); 72 cairo_surface_destroy(pd->surface);
73 pd->surface = NULL; 73 pd->surface = NULL;
74 74
75 ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, cspace, writable); 75 ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, stride, cspace, writable);
76 76
77 if (ok && pixels) 77 if (ok && pixels)
78 { 78 {
diff --git a/src/lib/ector/ector_buffer.eo b/src/lib/ector/ector_buffer.eo
index 143dcbb846..58d5409f37 100644
--- a/src/lib/ector/ector_buffer.eo
+++ b/src/lib/ector/ector_buffer.eo
@@ -77,6 +77,7 @@ mixin Ector.Buffer
77 @in pixels: void_ptr; [[If $null, allocates an empty buffer]] 77 @in pixels: void_ptr; [[If $null, allocates an empty buffer]]
78 @in width: int; [[Buffer width]] 78 @in width: int; [[Buffer width]]
79 @in height: int; [[Buffer height]] 79 @in height: int; [[Buffer height]]
80 @in stride: int; [[Buffer stride (in bytes). If 0 then calculated based on $cspace and $width]]
80 @in cspace: Efl.Gfx.Colorspace; [[Buffer colorspace]] 81 @in cspace: Efl.Gfx.Colorspace; [[Buffer colorspace]]
81 @in writable: bool; [[Buffer is writable]] 82 @in writable: bool; [[Buffer is writable]]
82 } 83 }
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
index d44962bbec..8afe6c85c4 100644
--- a/src/lib/ector/software/ector_software_buffer.c
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -71,10 +71,10 @@ on_fail:
71 71
72EOLIAN static Eina_Bool 72EOLIAN static Eina_Bool
73_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd, 73_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
74 void *pixels, int width, int height, 74 void *pixels, int width, int height, int stride,
75 Efl_Gfx_Colorspace cspace, Eina_Bool writable) 75 Efl_Gfx_Colorspace cspace, Eina_Bool writable)
76{ 76{
77 unsigned pxs, stride; 77 unsigned pxs;
78 78
79 if (pd->generic->immutable) 79 if (pd->generic->immutable)
80 fail("This buffer is immutable."); 80 fail("This buffer is immutable.");
@@ -92,7 +92,11 @@ _ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buff
92 if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1)) 92 if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1))
93 fail ("Pixel data is not aligned to %u bytes!", pxs); 93 fail ("Pixel data is not aligned to %u bytes!", pxs);
94 94
95 stride = width * pxs; 95 if (stride == 0)
96 stride = width * pxs;
97 else if (stride < (int)(width * pxs))
98 fail ("Stride is less than minimum stride: provided %u bytes, minimum %u bytes!", stride, (width * pxs));
99
96 if (pd->pixels.u8 && (pd->pixels.u8 != pixels)) 100 if (pd->pixels.u8 && (pd->pixels.u8 != pixels))
97 _ector_software_buffer_base_pixels_clear(obj, pd); 101 _ector_software_buffer_base_pixels_clear(obj, pd);
98 102
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index b0edce0255..623e96aea4 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2657,7 +2657,7 @@ eng_ector_begin(void *engine, void *output,
2657 memset(pixels, 0, stride * h); 2657 memset(pixels, 0, stride * h);
2658 2658
2659 // it just uses the software backend to draw for now 2659 // it just uses the software backend to draw for now
2660 ector_buffer_pixels_set(ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 2660 ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
2661 ector_surface_reference_point_set(ector, x, y); 2661 ector_surface_reference_point_set(ector, x, y);
2662 } 2662 }
2663 else 2663 else
@@ -2681,7 +2681,7 @@ eng_ector_end(void *engine, void *output,
2681 2681
2682 eng_image_data_put(engine, glim, pixels); 2682 eng_image_data_put(engine, glim, pixels);
2683 eng_image_data_put(engine, glim, pixels); 2683 eng_image_data_put(engine, glim, pixels);
2684 ector_buffer_pixels_set(ector, NULL, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 2684 ector_buffer_pixels_set(ector, NULL, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
2685 evas_common_cpu_end_opt(); 2685 evas_common_cpu_end_opt();
2686 } 2686 }
2687 else if (use_gl) 2687 else if (use_gl)
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 0b85c33d9a..41730d7298 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
@@ -32,7 +32,7 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj,
32 evas_cache_image_ref(&im->cache_entry); 32 evas_cache_image_ref(&im->cache_entry);
33 pd->image = im; 33 pd->image = im;
34 34
35 ector_buffer_pixels_set(obj, im->image.data, im->cache_entry.w, im->cache_entry.h, im->cache_entry.space, EINA_TRUE); 35 ector_buffer_pixels_set(obj, im->image.data, im->cache_entry.w, im->cache_entry.h, 0, im->cache_entry.space, EINA_TRUE);
36} 36}
37 37
38EOLIAN static void * 38EOLIAN static void *
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index d1085c3665..a265c42d9c 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4574,7 +4574,7 @@ _draw_thread_ector_surface_set(void *data)
4574 memset(pixels, 0, (w * h * 4)); 4574 memset(pixels, 0, (w * h * 4));
4575 } 4575 }
4576 4576
4577 ector_buffer_pixels_set(ector_surface->ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 4577 ector_buffer_pixels_set(ector_surface->ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
4578 ector_surface_reference_point_set(ector_surface->ector, x, y); 4578 ector_surface_reference_point_set(ector_surface->ector, x, y);
4579 4579
4580 eina_mempool_free(_mp_command_ector_surface, ector_surface); 4580 eina_mempool_free(_mp_command_ector_surface, ector_surface);
@@ -4612,7 +4612,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
4612 // clear the surface before giving to ector 4612 // clear the surface before giving to ector
4613 memset(pixels, 0, (w * h * 4)); 4613 memset(pixels, 0, (w * h * 4));
4614 4614
4615 ector_buffer_pixels_set(ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 4615 ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
4616 ector_surface_reference_point_set(ector, x, y); 4616 ector_surface_reference_point_set(ector, x, y);
4617 } 4617 }
4618} 4618}
@@ -4636,7 +4636,7 @@ eng_ector_end(void *engine EINA_UNUSED, void *surface EINA_UNUSED,
4636 } 4636 }
4637 else 4637 else
4638 { 4638 {
4639 ector_buffer_pixels_set(ector, NULL, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE); 4639 ector_buffer_pixels_set(ector, NULL, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
4640 evas_common_cpu_end_opt(); 4640 evas_common_cpu_end_opt();
4641 } 4641 }
4642} 4642}