ector: Updated the ector_buffer_pixels_set() api with stride info

Reviewers: jypark, jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5795
This commit is contained in:
subhransu mohanty 2018-02-08 14:27:15 +09:00 committed by Jean-Philippe Andre
parent 80cc3f230d
commit 48433efc43
6 changed files with 16 additions and 11 deletions

View File

@ -51,7 +51,7 @@ struct _Ector_Cairo_Software_Surface_Data
EOLIAN static Eina_Bool
_ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd,
void *pixels, int width, int height,
void *pixels, int width, int height, int stride,
Efl_Gfx_Colorspace cspace, Eina_Bool writable)
{
cairo_t *ctx = NULL;
@ -72,7 +72,7 @@ _ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Softw
cairo_surface_destroy(pd->surface);
pd->surface = NULL;
ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, cspace, writable);
ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, stride, cspace, writable);
if (ok && pixels)
{

View File

@ -77,6 +77,7 @@ mixin Ector.Buffer
@in pixels: void_ptr; [[If $null, allocates an empty buffer]]
@in width: int; [[Buffer width]]
@in height: int; [[Buffer height]]
@in stride: int; [[Buffer stride (in bytes). If 0 then calculated based on $cspace and $width]]
@in cspace: Efl.Gfx.Colorspace; [[Buffer colorspace]]
@in writable: bool; [[Buffer is writable]]
}

View File

@ -71,10 +71,10 @@ on_fail:
EOLIAN static Eina_Bool
_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
void *pixels, int width, int height,
void *pixels, int width, int height, int stride,
Efl_Gfx_Colorspace cspace, Eina_Bool writable)
{
unsigned pxs, stride;
unsigned pxs;
if (pd->generic->immutable)
fail("This buffer is immutable.");
@ -92,7 +92,11 @@ _ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buff
if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1))
fail ("Pixel data is not aligned to %u bytes!", pxs);
stride = width * pxs;
if (stride == 0)
stride = width * pxs;
else if (stride < (int)(width * pxs))
fail ("Stride is less than minimum stride: provided %u bytes, minimum %u bytes!", stride, (width * pxs));
if (pd->pixels.u8 && (pd->pixels.u8 != pixels))
_ector_software_buffer_base_pixels_clear(obj, pd);

View File

@ -2657,7 +2657,7 @@ eng_ector_begin(void *engine, void *output,
memset(pixels, 0, stride * h);
// it just uses the software backend to draw for now
ector_buffer_pixels_set(ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_surface_reference_point_set(ector, x, y);
}
else
@ -2681,7 +2681,7 @@ eng_ector_end(void *engine, void *output,
eng_image_data_put(engine, glim, pixels);
eng_image_data_put(engine, glim, pixels);
ector_buffer_pixels_set(ector, NULL, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_buffer_pixels_set(ector, NULL, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
evas_common_cpu_end_opt();
}
else if (use_gl)

View File

@ -32,7 +32,7 @@ _evas_ector_software_buffer_evas_ector_buffer_engine_image_set(Eo *obj,
evas_cache_image_ref(&im->cache_entry);
pd->image = im;
ector_buffer_pixels_set(obj, im->image.data, im->cache_entry.w, im->cache_entry.h, im->cache_entry.space, EINA_TRUE);
ector_buffer_pixels_set(obj, im->image.data, im->cache_entry.w, im->cache_entry.h, 0, im->cache_entry.space, EINA_TRUE);
}
EOLIAN static void *

View File

@ -4574,7 +4574,7 @@ _draw_thread_ector_surface_set(void *data)
memset(pixels, 0, (w * h * 4));
}
ector_buffer_pixels_set(ector_surface->ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_buffer_pixels_set(ector_surface->ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_surface_reference_point_set(ector_surface->ector, x, y);
eina_mempool_free(_mp_command_ector_surface, ector_surface);
@ -4612,7 +4612,7 @@ eng_ector_begin(void *engine EINA_UNUSED, void *surface,
// clear the surface before giving to ector
memset(pixels, 0, (w * h * 4));
ector_buffer_pixels_set(ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_buffer_pixels_set(ector, pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_surface_reference_point_set(ector, x, y);
}
}
@ -4636,7 +4636,7 @@ eng_ector_end(void *engine EINA_UNUSED, void *surface EINA_UNUSED,
}
else
{
ector_buffer_pixels_set(ector, NULL, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
ector_buffer_pixels_set(ector, NULL, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
evas_common_cpu_end_opt();
}
}