Evas.Image: Remove buffer_set/get

This will be properly implemented by the subclasses. In particular,
map/unmap will be used where it makes sense, and data_get/set will
be limited to Efl.Canvas.Image and Surface.
This commit is contained in:
Jean-Philippe Andre 2016-03-21 16:15:52 +09:00
parent d4e713a18c
commit f78cbac9e6
2 changed files with 0 additions and 85 deletions

View File

@ -68,9 +68,6 @@ class Evas.Image (Evas.Object, Evas.Filter,
Efl.Gfx.Buffer.alpha.set;
Efl.Gfx.Buffer.buffer_update_add;
Efl.Gfx.Buffer.colorspace.get;
Efl.Gfx.Buffer.buffer_get;
Efl.Gfx.Buffer.buffer_set;
Efl.Gfx.Buffer.buffer_copy_set;
Efl.Gfx.Fill.fill.set;
Efl.Gfx.Fill.fill.get;
Efl.Gfx.Fill.fill_auto.get;

View File

@ -3246,88 +3246,6 @@ _evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj)
return pd->engine_data;
}
EOLIAN static void *
_evas_image_efl_gfx_buffer_buffer_get(Eo *eo_obj, Evas_Image_Data *o,
Eina_Bool to_write,
int *width, int *height, int *stride_out,
Efl_Gfx_Colorspace *cspace)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
int stride = 0;
void *data;
// use the old api - same behaviour with more return info
data = evas_object_image_data_get(eo_obj, to_write);
if (!data) goto end;
// FIXME: length needs to be properly checked with the engine
// as we just ignore l,r,t,b here
if (ENFN->image_stride_get)
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
if (!stride)
stride = _evas_common_rgba_image_surface_size(o->cur->image.w, 1, o->cur->cspace, NULL, NULL, NULL, NULL);
end:
if (width) *width = o->cur->image.w;
if (height) *height = o->cur->image.h;
if (cspace) *cspace = (Efl_Gfx_Colorspace) o->cur->cspace;
if (stride_out) *stride_out = stride;
return data;
}
static Eina_Bool
_evas_image_buffer_set_common(Eo *obj, Evas_Image_Data *o, void *pixels,
int width, int height, int stride,
Efl_Gfx_Colorspace cspace, Eina_Bool copy)
{
Evas_Colorspace cs = (Evas_Colorspace) cspace;
int stride_min;
stride_min = _evas_common_rgba_image_surface_size(width, 1, cs, NULL, NULL, NULL, NULL);
if (!stride) stride = stride_min;
if (stride < stride_min)
{
ERR("Image stride is too small: given %d needs %d", stride, stride_min);
return EINA_FALSE;
}
if (stride > stride_min) // FIXME/TODO
{
ERR("Image stride support is not implemented: given %d needs %d", stride, stride_min);
return EINA_FALSE;
}
if (cs != o->cur->cspace)
evas_object_image_colorspace_set(obj, cs);
if ((width != o->cur->image.w) || (height != o->cur->image.h))
evas_object_image_size_set(obj, width, height);
if (!pixels)
evas_object_image_data_set(obj, NULL);
else if (!copy)
evas_object_image_data_set(obj, pixels);
else
evas_object_image_data_copy_set(obj, pixels);
return o->engine_data ? EINA_TRUE : EINA_FALSE;
}
EOLIAN static Eina_Bool
_evas_image_efl_gfx_buffer_buffer_set(Eo *obj, Evas_Image_Data *o, void *pixels,
int width, int height, int stride,
Efl_Gfx_Colorspace cspace)
{
return _evas_image_buffer_set_common(obj, o, pixels, width, height, stride, cspace, EINA_FALSE);
}
EOLIAN static Eina_Bool
_evas_image_efl_gfx_buffer_buffer_copy_set(Eo *obj, Evas_Image_Data *o, const void *pixels,
int width, int height, int stride,
Efl_Gfx_Colorspace cspace)
{
return _evas_image_buffer_set_common(obj, o, (void *) pixels, width, height, stride, cspace, EINA_TRUE);
}
/* FIXME: Temporarily allow efl_file_ APIs on Evas.Image.
* They don't belong here, as only Efl.Canvas.Image should support them.
* Elm.Image uses them, though, instead of using the legacy APIs...