forked from enlightenment/efl
evas/evas_object_image - clean the code
SVN revision: 76114
This commit is contained in:
parent
89413ab06e
commit
c368c8c27b
|
@ -182,8 +182,7 @@ evas_object_image_add(Evas *e)
|
|||
evas_object_image_init(obj);
|
||||
evas_object_inject(obj, e);
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -358,12 +357,9 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
if (o->preloading)
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, o->engine_data, obj);
|
||||
}
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
}
|
||||
o->load_error = EVAS_LOAD_ERROR_NONE;
|
||||
lo.scale_down_by = o->load_opts.scale_down_by;
|
||||
|
@ -385,17 +381,13 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
int w, h;
|
||||
int stride;
|
||||
|
||||
obj->layer->evas->engine.func->image_size_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data, &w, &h);
|
||||
obj->layer->evas->engine.func->image_size_get(obj->layer->evas->engine.data.output, o->engine_data, &w, &h);
|
||||
if (obj->layer->evas->engine.func->image_stride_get)
|
||||
obj->layer->evas->engine.func->image_stride_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data, &stride);
|
||||
obj->layer->evas->engine.func->image_stride_get(obj->layer->evas->engine.data.output, o->engine_data, &stride);
|
||||
else
|
||||
stride = w * 4;
|
||||
o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
o->cur.has_alpha = obj->layer->evas->engine.func->image_alpha_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
o->cur.image.w = w;
|
||||
o->cur.image.h = h;
|
||||
o->cur.image.stride = stride;
|
||||
|
@ -618,7 +610,8 @@ evas_object_image_filled_set(Evas_Object *obj, Eina_Bool setting)
|
|||
|
||||
o->filled = setting;
|
||||
if (!o->filled)
|
||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_RESIZE, evas_object_image_filled_resize_listener);
|
||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_RESIZE,
|
||||
evas_object_image_filled_resize_listener);
|
||||
else
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
|
@ -626,7 +619,9 @@ evas_object_image_filled_set(Evas_Object *obj, Eina_Bool setting)
|
|||
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
||||
evas_object_image_fill_set(obj, 0, 0, w, h);
|
||||
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, evas_object_image_filled_resize_listener, NULL);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
|
||||
evas_object_image_filled_resize_listener,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -793,9 +788,7 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h)
|
|||
o->cur.image.w = w;
|
||||
o->cur.image.h = h;
|
||||
if (o->engine_data)
|
||||
o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
w, h);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output, o->engine_data, w, h);
|
||||
else
|
||||
o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data
|
||||
(obj->layer->evas->engine.data.output, w, h, NULL, o->cur.has_alpha,
|
||||
|
@ -900,25 +893,18 @@ evas_object_image_data_convert(Evas_Object *obj, Evas_Colorspace to_cspace)
|
|||
if ((o->preloading) && (o->engine_data))
|
||||
{
|
||||
o->preloading = 0;
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
obj);
|
||||
obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, o->engine_data, obj);
|
||||
}
|
||||
if (!o->engine_data) return NULL;
|
||||
if (o->video_surface)
|
||||
o->video.update_pixels(o->video.data, obj, &o->video);
|
||||
if (o->cur.cspace == to_cspace) return NULL;
|
||||
data = NULL;
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data, 0, &data,
|
||||
&o->load_error);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output, o->engine_data, 0, &data, &o->load_error);
|
||||
result = evas_object_image_data_convert_internal(o, data, to_cspace);
|
||||
if (o->engine_data)
|
||||
{
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
|
||||
o->engine_data, data);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output, o->engine_data, data);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -981,8 +967,7 @@ evas_object_image_data_set(Evas_Object *obj, void *data)
|
|||
else
|
||||
{
|
||||
if (o->engine_data)
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
o->load_error = EVAS_LOAD_ERROR_NONE;
|
||||
o->cur.image.w = 0;
|
||||
o->cur.image.h = 0;
|
||||
|
@ -1029,11 +1014,7 @@ evas_object_image_data_get(const Evas_Object *obj, Eina_Bool for_writing)
|
|||
obj->layer->evas->engine.func->image_content_hint_set
|
||||
(obj->layer->evas->engine.data.output,
|
||||
o->engine_data, o->content_hint);
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
for_writing, &data,
|
||||
&o->load_error);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output, o->engine_data, for_writing, &data, &o->load_error);
|
||||
|
||||
/* if we fail to get engine_data, we have to return NULL */
|
||||
if (!o->engine_data) return NULL;
|
||||
|
@ -1327,11 +1308,7 @@ evas_object_image_save(const Evas_Object *obj, const char *file, const char *key
|
|||
MAGIC_CHECK_END();
|
||||
|
||||
if (!o->engine_data) return 0;
|
||||
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
0,
|
||||
&data,
|
||||
&o->load_error);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output, o->engine_data, 0, &data, &o->load_error);
|
||||
if (flags)
|
||||
{
|
||||
char *p, *pp;
|
||||
|
@ -1435,26 +1412,15 @@ evas_object_image_pixels_import(Evas_Object *obj, Evas_Pixel_Import_Source *pixe
|
|||
DATA32 *image_pixels = NULL;
|
||||
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
1,
|
||||
&image_pixels,
|
||||
&o->load_error);
|
||||
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output, o->engine_data, 1, &image_pixels,&o->load_error);
|
||||
if (image_pixels)
|
||||
evas_common_convert_yuv_420p_601_rgba((DATA8 **) pixels->rows,
|
||||
(DATA8 *) image_pixels,
|
||||
o->cur.image.w,
|
||||
o->cur.image.h);
|
||||
evas_common_convert_yuv_420p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur.image.w, o->cur.image.h);
|
||||
if (o->engine_data)
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
image_pixels);
|
||||
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output, o->engine_data, image_pixels);
|
||||
if (o->engine_data)
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
o->cur.has_alpha);
|
||||
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output, o->engine_data, o->cur.has_alpha);
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
@ -1730,9 +1696,7 @@ evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace)
|
|||
|
||||
o->cur.cspace = cspace;
|
||||
if (o->engine_data)
|
||||
obj->layer->evas->engine.func->image_colorspace_set(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
cspace);
|
||||
obj->layer->evas->engine.func->image_colorspace_set(obj->layer->evas->engine.data.output, o->engine_data, cspace);
|
||||
}
|
||||
|
||||
EAPI Evas_Colorspace
|
||||
|
@ -1831,10 +1795,7 @@ evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf
|
|||
if ((surf) &&
|
||||
((surf->version < 2) ||
|
||||
(surf->version > EVAS_NATIVE_SURFACE_VERSION))) return;
|
||||
o->engine_data =
|
||||
obj->layer->evas->engine.func->image_native_set(obj->layer->evas->engine.data.output,
|
||||
o->engine_data,
|
||||
surf);
|
||||
o->engine_data = obj->layer->evas->engine.func->image_native_set(obj->layer->evas->engine.data.output, o->engine_data, surf);
|
||||
}
|
||||
|
||||
EAPI Evas_Native_Surface *
|
||||
|
@ -1850,8 +1811,7 @@ evas_object_image_native_surface_get(const Evas_Object *obj)
|
|||
return NULL;
|
||||
MAGIC_CHECK_END();
|
||||
if (!obj->layer->evas->engine.func->image_native_get) return NULL;
|
||||
return obj->layer->evas->engine.func->image_native_get(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
return obj->layer->evas->engine.func->image_native_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -2363,7 +2323,7 @@ _proxy_subrender(Evas *e, Evas_Object *source)
|
|||
source->proxy.h = h;
|
||||
}
|
||||
|
||||
if (!source->proxy.surface) return;
|
||||
// if (!source->proxy.surface) return;
|
||||
|
||||
ctx = e->engine.func->context_new(e->engine.data.output);
|
||||
e->engine.func->context_color_set(e->engine.data.output, ctx, 0, 0, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue