forked from enlightenment/efl
Evas: Simplify direct access to image data
This should avoid issues with image_data_get from the engines, when we really just want to fetch the original data pointer.
This commit is contained in:
parent
08c1160888
commit
91e0bdb1e7
|
@ -709,18 +709,11 @@ _efl_canvas_image_efl_gfx_buffer_buffer_data_get(Eo *eo_obj, void *_pd EINA_UNUS
|
|||
{
|
||||
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
|
||||
Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
|
||||
DATA32 *data = NULL;
|
||||
|
||||
if (!o->buffer_data_set || !o->engine_data || !ENFN->image_data_has)
|
||||
if (!o->buffer_data_set || !o->engine_data || !ENFN->image_data_direct)
|
||||
return NULL;
|
||||
|
||||
if (ENFN->image_data_has(ENDT, o->engine_data, NULL))
|
||||
{
|
||||
// FIXME: this is horrible code - need to store ptr somewhere safe
|
||||
o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 0, &data, &o->load_error, NULL);
|
||||
}
|
||||
|
||||
return data;
|
||||
return ENFN->image_data_direct(ENDT, o->engine_data, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -850,11 +850,11 @@ _evas_image_efl_file_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file
|
|||
}
|
||||
}
|
||||
|
||||
if (!ENFN->image_data_has)
|
||||
if (!ENFN->image_data_direct)
|
||||
pixels = ENFN->image_data_get(ENDT, pixels, 0, &data, &o->load_error, &tofree);
|
||||
else
|
||||
{
|
||||
if (ENFN->image_data_has(ENDT, pixels, &cspace))
|
||||
if (ENFN->image_data_direct(ENDT, pixels, &cspace))
|
||||
{
|
||||
if ((want_cspace != (int) cspace) && (want_cspace != -1))
|
||||
cspace = EVAS_COLORSPACE_ARGB8888;
|
||||
|
|
|
@ -1348,7 +1348,7 @@ struct _Evas_Func
|
|||
void *(*image_dirty_region) (void *data, void *image, int x, int y, int w, int h);
|
||||
void *(*image_data_get) (void *data, void *image, int to_write, DATA32 **image_data, int *err, Eina_Bool *tofree);
|
||||
void *(*image_data_put) (void *data, void *image, DATA32 *image_data);
|
||||
Eina_Bool (*image_data_has) (void *data, void *image, Evas_Colorspace *cspace);
|
||||
void *(*image_data_direct) (void *data, void *image, Evas_Colorspace *cspace);
|
||||
void (*image_data_preload_request) (void *data, void *image, const Eo *target);
|
||||
void (*image_data_preload_cancel) (void *data, void *image, const Eo *target);
|
||||
void *(*image_alpha_set) (void *data, void *image, int has_alpha);
|
||||
|
|
|
@ -477,18 +477,14 @@ eng_image_file_colorspace_get(void *data EINA_UNUSED, void *image)
|
|||
return im->im->cache_entry.space;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_data_has(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
static void *
|
||||
eng_image_data_direct(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
{
|
||||
Evas_GL_Image *im = image;
|
||||
|
||||
if (!im || !im->im) return EINA_FALSE;
|
||||
if (im->im->image.data)
|
||||
{
|
||||
if (cspace) *cspace = im->im->cache_entry.space;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
if (!im || !im->im) return NULL;
|
||||
if (cspace) *cspace = im->im->cache_entry.space;
|
||||
return im->im->image.data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1381,7 +1377,7 @@ module_open(Evas_Module *em)
|
|||
ORD(image_dirty_region);
|
||||
ORD(image_data_get);
|
||||
ORD(image_data_put);
|
||||
ORD(image_data_has);
|
||||
ORD(image_data_direct);
|
||||
ORD(image_data_preload_request);
|
||||
ORD(image_data_preload_cancel);
|
||||
ORD(image_alpha_set);
|
||||
|
|
|
@ -265,18 +265,14 @@ eng_image_file_colorspace_get(void *data EINA_UNUSED, void *image)
|
|||
return im->im->cache_entry.space;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_data_has(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
static void *
|
||||
eng_image_data_direct(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
{
|
||||
Evas_GL_Image *im = image;
|
||||
|
||||
if (!im || !im->im) return EINA_FALSE;
|
||||
if (im->im->image.data)
|
||||
{
|
||||
if (cspace) *cspace = im->im->cache_entry.space;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
if (!im || !im->im) return NULL;
|
||||
if (cspace) *cspace = im->im->cache_entry.space;
|
||||
return im->im->image.data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2827,7 +2823,7 @@ module_open(Evas_Module *em)
|
|||
ORD(image_dirty_region);
|
||||
ORD(image_data_get);
|
||||
ORD(image_data_put);
|
||||
ORD(image_data_has);
|
||||
ORD(image_data_direct);
|
||||
ORD(image_data_preload_request);
|
||||
ORD(image_data_preload_cancel);
|
||||
ORD(image_alpha_set);
|
||||
|
|
|
@ -1090,18 +1090,14 @@ eng_image_file_colorspace_get(void *data EINA_UNUSED, void *image)
|
|||
return im->cache_entry.space;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_data_has(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
static void *
|
||||
eng_image_data_direct(void *data EINA_UNUSED, void *image, Evas_Colorspace *cspace)
|
||||
{
|
||||
RGBA_Image *im = image;
|
||||
|
||||
if (!im) return EINA_FALSE;
|
||||
if (im->image.data)
|
||||
{
|
||||
if (cspace) *cspace = im->cache_entry.space;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
if (!im) return NULL;
|
||||
if (cspace) *cspace = im->cache_entry.space;
|
||||
return im->image.data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4148,7 +4144,7 @@ static Evas_Func func =
|
|||
eng_image_dirty_region,
|
||||
eng_image_data_get,
|
||||
eng_image_data_put,
|
||||
eng_image_data_has,
|
||||
eng_image_data_direct,
|
||||
eng_image_data_preload_request,
|
||||
eng_image_data_preload_cancel,
|
||||
eng_image_alpha_set,
|
||||
|
|
Loading…
Reference in New Issue