diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-11 13:59:14 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-03-15 11:11:59 +0900 |
commit | 055ea6445a08941dc6b8739fbdef6230cdfdbef9 (patch) | |
tree | e6b908063c70cb2cd9c02986c9689ebe53567b3a | |
parent | 35f8d81d97cd6a9becf844ab2c2abc7da9d3b80d (diff) | |
download | efl-055ea6445a08941dc6b8739fbdef6230cdfdbef9.tar.gz |
Evas image: Move content_hint and scale_hint to Efl.Image
-rw-r--r-- | src/Makefile_Efl.am | 2 | ||||
-rw-r--r-- | src/lib/efl/Efl.h | 1 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_image.eo | 64 | ||||
-rw-r--r-- | src/lib/evas/Evas_Common.h | 5 | ||||
-rw-r--r-- | src/lib/evas/Evas_Legacy.h | 49 | ||||
-rw-r--r-- | src/lib/evas/cache2/evas_cache2.c | 2 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image.eo | 51 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image_private.h | 6 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 39 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_types.eot | 9 |
10 files changed, 160 insertions, 68 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index e507a38c5d..ae1ee1a5cf 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -2,13 +2,13 @@ efl_eolian_legacy_files = \ lib/efl/interfaces/efl_gfx_fill.eo \ lib/efl/interfaces/efl_gfx_base.eo \ + lib/efl/interfaces/efl_image.eo \ lib/efl/interfaces/efl_image_animated.eo \ $(NULL) efl_eolian_files = \ lib/efl/interfaces/efl_control.eo \ lib/efl/interfaces/efl_file.eo \ - lib/efl/interfaces/efl_image.eo \ lib/efl/interfaces/efl_image_load.eo \ lib/efl/interfaces/efl_player.eo \ lib/efl/interfaces/efl_text.eo \ diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index fccce5df31..2cb0bd7a0c 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -103,6 +103,7 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color, #include "interfaces/efl_gfx_types.eot.h" #include "interfaces/efl_gfx_fill.eo.legacy.h" #include "interfaces/efl_gfx_base.eo.legacy.h" +#include "interfaces/efl_image.eo.legacy.h" #include "interfaces/efl_image_animated.eo.legacy.h" #endif diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo index 619d17c302..8a5d015c95 100644 --- a/src/lib/efl/interfaces/efl_image.eo +++ b/src/lib/efl/interfaces/efl_image.eo @@ -1,3 +1,20 @@ +enum Efl.Image.Content_Hint +{ + [[How an image's data is to be treated by EFL, for optimization.]] + none = 0, [[No hint on the content (default).]] + dynamic = 1, [[The content will change over time.]] + static = 2 [[The content won't change over time.]] +} + +enum Efl.Image.Scale_Hint +{ + /* FIXME: Legacy is in Emile, where it does not belong. */ + [[How an image's data is to be treated by EFL, with regard to scaling cache.]] + none = 0, [[No hint on the scaling (default).]] + dynamic = 1, [[Image will be re-scaled over time, thus turning scaling cache OFF for its data.]] + static = 2 [[Image will not be re-scaled over time, thus turning scaling cache ON for its data.]] +} + interface Efl.Image () { [[Common APIs for all 2D images that can be rendered on the canvas.]] @@ -132,5 +149,52 @@ interface Efl.Image () fill: Efl.Gfx.Border_Fill_Mode; [[Fill mode of the center region.]] } } + + /* Note: those are obscure features of evas image. Expose in Efl.Image? */ + @property content_hint { + set { + [[Set the content hint setting of a given image object of the + canvas. + + This function sets the content hint value of the given image + of the canvas. For example, if you're on the GL engine and + your driver implementation supports it, setting this hint to + #EVAS_IMAGE_CONTENT_HINT_DYNAMIC will make it need zero copies + at texture upload time, which is an "expensive" operation. + ]] + } + get { + [[Get the content hint setting of a given image object of the + canvas. + + This returns #EVAS_IMAGE_CONTENT_HINT_NONE on error. + ]] + } + values { + hint: Efl.Image.Content_Hint; [[Dynamic or static content hint, + see @Efl.Image.Content_Hint]] + } + } + @property scale_hint { + set { + [[Set the scale hint of a given image of the canvas. + + This function sets the scale hint value of the given image + object in the canvas, which will affect how Evas is to cache + scaled versions of its original source image. + ]] + } + get { + [[Get the scale hint of a given image of the canvas. + + This function returns the scale hint value of the given image + object of the canvas. + ]] + } + values { + hint: Efl.Image.Scale_Hint; [[Scalable or static size hint, + see @Efl.Image.Scale_Hint]] + } + } } } diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index d3a1844181..cf6fb1bbf9 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -246,6 +246,11 @@ typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure f typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event structure that may come with #EVAS_CALLBACK_RENDER_POST event callbacks @since 1.8 */ typedef struct _Evas_Event_Axis_Update Evas_Event_Axis_Update; /**< Event structure for #EVAS_CALLBACK_AXIS_UPDATE event callbacks @since 1.13 */ +typedef Efl_Image_Content_Hint Evas_Image_Content_Hint; +#define EVAS_IMAGE_CONTENT_HINT_NONE EFL_IMAGE_CONTENT_HINT_NONE +#define EVAS_IMAGE_CONTENT_HINT_DYNAMIC EFL_IMAGE_CONTENT_HINT_DYNAMIC +#define EVAS_IMAGE_CONTENT_HINT_STATIC EFL_IMAGE_CONTENT_HINT_STATIC + typedef enum _Evas_Alloc_Error { EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */ diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index e53f0549c9..9f92dddbd4 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3379,6 +3379,55 @@ EAPI void evas_object_image_orient_set(Evas_Object *obj, Evas_Image_Orient orien EAPI Evas_Image_Orient evas_object_image_orient_get(const Evas_Object *obj); /** + * @brief Set the content hint setting of a given image object of the canvas. + * + * This function sets the content hint value of the given image of the canvas. + * For example, if you're on the GL engine and your driver implementation + * supports it, setting this hint to #EVAS_IMAGE_CONTENT_HINT_DYNAMIC will make + * it need zero copies at texture upload time, which is an "expensive" + * operation. + * + * @param[in] hint The content hint value, one of the + * @ref Evas_Image_Content_Hint ones. + */ +EAPI void evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint); + +/** + * @brief Get the content hint setting of a given image object of the canvas. + * + * This returns #EVAS_IMAGE_CONTENT_HINT_NONE on error. + * + * @return The content hint value, one of the @ref Evas_Image_Content_Hint + * ones. + */ +EAPI Evas_Image_Content_Hint evas_object_image_content_hint_get(const Evas_Object *obj); + +/** + * @brief Set the scale hint of a given image of the canvas. + * + * This function sets the scale hint value of the given image object in the + * canvas, which will affect how Evas is to cache scaled versions of its + * original source image. + * + * @param[in] hint The scale hint, a value in @ref Evas_Image_Scale_Hint. + * + * @ingroup Evas_Image + */ +EAPI void evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint); + +/** + * @brief Get the scale hint of a given image of the canvas. + * + * This function returns the scale hint value of the given image object of the + * canvas. + * + * @return The scale hint, a value in @ref Evas_Image_Scale_Hint. + * + * @ingroup Evas_Image + */ +EAPI Evas_Image_Scale_Hint evas_object_image_scale_hint_get(const Evas_Object *obj); + +/** * * Sets the size of the given image object. * diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c index 4603aae120..d9788aac31 100644 --- a/src/lib/evas/cache2/evas_cache2.c +++ b/src/lib/evas/cache2/evas_cache2.c @@ -913,7 +913,7 @@ evas_cache2_image_scale_load(Image_Entry *im, lo.scale_load.dst_w = dst_w; lo.scale_load.dst_h = dst_h; lo.scale_load.smooth = smooth; - lo.scale_load.scale_hint = im->scale_hint; + lo.scale_load.scale_hint = (Emile_Image_Scale_Hint) im->scale_hint; evas_cache2_image_cache_key_create(hkey, im->file, pathlen, im->key, keylen, &lo); diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index 60109ac134..f71d822b6a 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -5,53 +5,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An legacy_prefix: evas_object_image; eo_prefix: evas_obj_image; methods { - /* weird stuff - hints */ - @property content_hint { - set { - [[Set the content hint setting of a given image object of the - canvas. - - This function sets the content hint value of the given image - of the canvas. For example, if you're on the GL engine and - your driver implementation supports it, setting this hint to - #EVAS_IMAGE_CONTENT_HINT_DYNAMIC will make it need zero copies - at texture upload time, which is an "expensive" operation. - ]] - } - get { - [[Get the content hint setting of a given image object of the - canvas. - - This returns #EVAS_IMAGE_CONTENT_HINT_NONE on error. - ]] - } - values { - hint: Evas.Image_Content_Hint; [[The content hint value, one of - the @Evas.Image_Content_Hint ones.]] - } - } - @property scale_hint { - set { - [[Set the scale hint of a given image of the canvas. - - This function sets the scale hint value of the given image - object in the canvas, which will affect how Evas is to cache - scaled versions of its original source image. - ]] - } - get { - [[Get the scale hint of a given image of the canvas. - - This function returns the scale hint value of the given image - object of the canvas. - ]] - } - values { - hint: Evas.Image_Scale_Hint; [[The scale hint, a value in - @Evas.Image_Scale_Hint.]] - } - } - /* GL View */ @property pixels_dirty { set { @@ -111,6 +64,10 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Load, Efl.Image_An Efl.Image.border_scale.set; Efl.Image.border_center_fill.get; Efl.Image.border_center_fill.set; + Efl.Image.scale_hint.get; + Efl.Image.scale_hint.set; + Efl.Image.content_hint.get; + Efl.Image.content_hint.set; Efl.Image_Animated.animated.get; Efl.Image_Animated.animated_frame.get; Efl.Image_Animated.animated_frame.set; diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h index 68fa686c2d..9ccff4a736 100644 --- a/src/lib/evas/canvas/evas_image_private.h +++ b/src/lib/evas/canvas/evas_image_private.h @@ -109,8 +109,8 @@ struct _Evas_Image_Data int pixels_checked_out; int load_error; - Evas_Image_Scale_Hint scale_hint; - Evas_Image_Content_Hint content_hint; + Efl_Image_Scale_Hint scale_hint; + Efl_Image_Content_Hint content_hint; Eina_Bool changed : 1; Eina_Bool dirty_pixels : 1; @@ -165,4 +165,6 @@ Evas_Native_Surface *_evas_image_native_surface_get(const Evas_Object *eo_obj); # define EINA_COW_IMAGE_STATE_WRITE_END(Obj, Write) \ EINA_COW_WRITE_END(evas_object_image_state_cow, Obj->cur, Write) +#define FRAME_MAX 1024 + #endif // EVAS_IMAGE_PRIVATE_H diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index ddd71ae0e5..4666d6a659 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1657,7 +1657,7 @@ evas_object_image_native_surface_get(const Evas_Object *eo_obj) } EOLIAN static void -_evas_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Scale_Hint hint) +_evas_image_efl_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Scale_Hint hint) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); evas_object_async_block(obj); @@ -1683,14 +1683,14 @@ _evas_image_scale_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Scale_Hint } } -EOLIAN static Evas_Image_Scale_Hint -_evas_image_scale_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) +EOLIAN static Efl_Image_Scale_Hint +_evas_image_efl_image_scale_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) { - return o->scale_hint;; + return o->scale_hint; } EOLIAN static void -_evas_image_content_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Content_Hint hint) +_evas_image_efl_image_content_hint_set(Eo *eo_obj, Evas_Image_Data *o, Efl_Image_Content_Hint hint) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); evas_object_async_block(obj); @@ -1716,9 +1716,8 @@ _evas_image_content_hint_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Content_ } } -#define FRAME_MAX 1024 -EOLIAN static Evas_Image_Content_Hint -_evas_image_content_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) +EOLIAN static Efl_Image_Content_Hint +_evas_image_efl_image_content_hint_get(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) { return o->content_hint; } @@ -4699,6 +4698,30 @@ evas_object_image_source_events_get(const Evas_Object *eo) } EAPI void +evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hint) +{ + return efl_image_content_hint_set(obj, hint); +} + +EAPI Evas_Image_Content_Hint +evas_object_image_content_hint_get(const Evas_Object *obj) +{ + return efl_image_content_hint_get(obj); +} + +EAPI void +evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint) +{ + return efl_image_scale_hint_set(obj, (Efl_Image_Scale_Hint) hint); +} + +EAPI Evas_Image_Scale_Hint +evas_object_image_scale_hint_get(const Evas_Object *obj) +{ + return (Evas_Image_Scale_Hint) efl_image_scale_hint_get(obj); +} + +EAPI void evas_object_image_source_visible_set(Evas_Object *eo, Eina_Bool visible) { /* FIXME: I'd love to remove this feature and replace by no_render. diff --git a/src/lib/evas/canvas/evas_types.eot b/src/lib/evas/canvas/evas_types.eot index 138b319769..6f37537347 100644 --- a/src/lib/evas/canvas/evas_types.eot +++ b/src/lib/evas/canvas/evas_types.eot @@ -1,5 +1,4 @@ type @extern Evas.Load_Error: int; /* FIXME: Need to migrate emile. */ -type @extern Evas.Image_Scale_Hint: int; /* FIXME: Need to migrate emile. */ struct @extern Evas.Video_Surface; /* FIXME: The structure is full of the unsupported func pointers. */ /* FIXME: Unsupported annonymous structures inside */ @@ -231,14 +230,6 @@ enum Evas.Callback_Type last [[kept as last element/sentinel -- not really an event]] } -enum Evas.Image_Content_Hint -{ - [[How an image's data is to be treated by Evas, for optimization]] - none = 0, [[No hint at all]] - dynamic = 1, [[The contents will change over time]] - static = 2 [[The contents won't change over time]] -} - enum Evas.Image_Orient { [[Possible orientation options for evas_object_image_orient_set(). |