Evas image: Move content_hint and scale_hint to Efl.Image

This commit is contained in:
Jean-Philippe Andre 2016-03-11 13:59:14 +09:00
parent 35f8d81d97
commit 055ea6445a
10 changed files with 160 additions and 68 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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]]
}
}
}
}

View File

@ -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 */

View File

@ -3378,6 +3378,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.

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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;
}
@ -4698,6 +4697,30 @@ evas_object_image_source_events_get(const Evas_Object *eo)
return _evas_image_proxy_source_events_get(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)
{

View File

@ -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().