summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-05-20 11:51:56 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-20 11:51:56 -0400
commitb24fde67871707bafea7d3e638bca70c6ef75de0 (patch)
tree76ac9e3133401b0321df5b960d4866ecf8a568ce
parenta5267d3d9c55ebcc2da3e7e05b23bc88d436f3fb (diff)
downloadefl-b24fde67871707bafea7d3e638bca70c6ef75de0.tar.gz
Merge Efl.Orient and Efl.Flip into the same enum
Summary: This is similar to how it is in Evas, and simplifies the Efl.Orientation interface, which only needs one property now. Relates to T7919 Test Plan: Everything builds and tests pass. There's only one example of efl_orientation_set() so there's not much to test yet. Reviewers: zmike, bu5hm4n, cedric, Hermet, Jaehyun_Cho Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7919 Differential Revision: https://phab.enlightenment.org/D8912
-rw-r--r--src/examples/evas/evas-images5.c15
-rw-r--r--src/lib/efl/interfaces/efl_orientation.eo52
-rw-r--r--src/lib/elementary/efl_ui_image.c82
-rw-r--r--src/lib/elementary/efl_ui_image.eo1
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c142
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.eo1
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable_private.h1
-rw-r--r--src/lib/elementary/efl_ui_widget_image.h1
-rw-r--r--src/lib/evas/canvas/efl_canvas_image_internal.eo1
-rw-r--r--src/lib/evas/canvas/evas_image_private.h1
-rw-r--r--src/lib/evas/canvas/evas_object_image.c90
11 files changed, 108 insertions, 279 deletions
diff --git a/src/examples/evas/evas-images5.c b/src/examples/evas/evas-images5.c
index ed8a4e5541..fa2794e952 100644
--- a/src/examples/evas/evas-images5.c
+++ b/src/examples/evas/evas-images5.c
@@ -76,6 +76,7 @@ _on_keydown(void *data EINA_UNUSED,
void *einfo)
{
Evas_Event_Key_Down *ev = einfo;
+ Efl_Orient orient = efl_orientation_get(d.img);
if (strcmp(ev->key, "h") == 0) /* print help */
{
@@ -109,25 +110,25 @@ _on_keydown(void *data EINA_UNUSED,
switch (key_val)
{
case 0:
- efl_orientation_set(d.img, EFL_ORIENT_0);
+ efl_orientation_set(d.img, EFL_ORIENT_UP | (orient & EFL_ORIENT_FLIP_BITMASK));
break;
case 1:
- efl_orientation_set(d.img, EFL_ORIENT_90);
+ efl_orientation_set(d.img, EFL_ORIENT_RIGHT | (orient & EFL_ORIENT_FLIP_BITMASK));
break;
case 2:
- efl_orientation_set(d.img, EFL_ORIENT_180);
+ efl_orientation_set(d.img, EFL_ORIENT_DOWN | (orient & EFL_ORIENT_FLIP_BITMASK));
break;
case 3:
- efl_orientation_set(d.img, EFL_ORIENT_270);
+ efl_orientation_set(d.img, EFL_ORIENT_LEFT | (orient & EFL_ORIENT_FLIP_BITMASK));
break;
case 4:
- efl_orientation_flip_set(d.img, EFL_FLIP_HORIZONTAL);
+ efl_orientation_set(d.img, (orient & EFL_ORIENT_ROTATION_BITMASK) | EFL_ORIENT_FLIP_HORIZONTAL);
break;
case 5:
- efl_orientation_flip_set(d.img, EFL_FLIP_VERTICAL);
+ efl_orientation_set(d.img, (orient & EFL_ORIENT_ROTATION_BITMASK) | EFL_ORIENT_FLIP_VERTICAL);
break;
case 6:
- efl_orientation_flip_set(d.img, EFL_FLIP_NONE);
+ efl_orientation_set(d.img, (orient & EFL_ORIENT_ROTATION_BITMASK));
break;
}
}
diff --git a/src/lib/efl/interfaces/efl_orientation.eo b/src/lib/efl/interfaces/efl_orientation.eo
index e874dcfdb7..be42be5eca 100644
--- a/src/lib/efl/interfaces/efl_orientation.eo
+++ b/src/lib/efl/interfaces/efl_orientation.eo
@@ -2,38 +2,35 @@ parse efl_ui_direction;
enum @beta Efl.Orient
{
- [[An orientation type, to rotate visual objects.
-
+ [[An orientation type, to rotate and flip images.
+
+ This is similar to EXIF's orientation.
+ Directional values ($up, $down, $left, $right) indicate the final direction in
+ which the top of the image will be facing (e.g. a picture of a house will have
+ its roof pointing to the right if the $right orientation is used).
+ Flipping values ($flip_horizontal and $flip_vertical) can be additionaly added
+ to produce a mirroring in each axis.
Not to be confused with @Efl.Ui.Dir which is meant for widgets, rather
than images and canvases. This enum is used to rotate images, videos and
the like.
-
- See also @Efl.Orientation.
- ]]
- none = 0, [[Default, same as up]]
- up = 0, [[Orient up, do not rotate.]]
- right = 90, [[Orient right, rotate 90 degrees counter clock-wise.]]
- down = 180, [[Orient down, rotate 180 degrees.]]
- left = 270, [[Orient left, rotate 90 degrees clock-wise.]]
-}
-
-enum @beta Efl.Flip
-{
- [[A flip type, to flip visual objects.
-
- See also @Efl.Orientation.
]]
- none = 0, [[No flip]]
- horizontal = 1, [[Flip image horizontally]]
- vertical = 2 [[Flip image vertically]]
+ none = 0, [[Default, same as up, do not rotate.]]
+ up = 0, [[Orient up, do not rotate.]]
+ right = 1, [[Orient right, rotate 90 degrees clock-wise.]]
+ down = 2, [[Orient down, rotate 180 degrees.]]
+ left = 3, [[Orient left, rotate 270 degrees clock-wise.]]
+ rotation_bitmask = 3, [[Bitmask that can be used to isolate rotation values, that is, $none, $up, $down, $left and $right.]]
+ flip_horizontal = 4, [[Mirror horizontally. Can be added to the other values.]]
+ flip_vertical = 8, [[Mirror vertically. Can be added to the other values.]]
+ flip_bitmask = 12 [[Bitmask that can be used to isolate flipping values, that is, $flip_vertical and $flip_horizontal.]]
}
interface @beta Efl.Orientation
{
- [[Efl orientation interface]]
+ [[Interface for objects which can be oriented.]]
methods {
@property orientation {
- [[Control the orientation of a given object.
+ [[Control the orientation (rotation and flipping) of a given object.
This can be used to set the rotation on an image or a window, for
instance.
@@ -42,16 +39,5 @@ interface @beta Efl.Orientation
dir: Efl.Orient(Efl.Orient.none); [[The rotation angle (CCW), see @Efl.Orient.]]
}
}
- @property flip {
- [[Control the flip of the given image
-
- Use this function to change how your image is to be
- flipped: vertically or horizontally or transpose
- or traverse.
- ]]
- values {
- flip: Efl.Flip; [[Flip method]]
- }
- }
}
}
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 8fde088c88..687bdbcfec 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -808,7 +808,6 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
if (!sd->edje)
{
efl_orientation_set(sd->img, sd->orient);
- efl_orientation_flip_set(sd->img, sd->flip);
}
if (sd->img)
@@ -1380,23 +1379,6 @@ _efl_ui_image_efl_orientation_orientation_get(const Eo *obj EINA_UNUSED, Efl_Ui_
return sd->orient;
}
-
-EOLIAN static void
-_efl_ui_image_efl_orientation_flip_set(Eo *obj, Efl_Ui_Image_Data *sd, Efl_Flip flip)
-{
- if (sd->edje) return;
- if (sd->flip == flip) return;
-
- sd->flip = flip;
- _efl_ui_image_sizing_eval(obj);
-}
-
-EOLIAN static Efl_Flip
-_efl_ui_image_efl_orientation_flip_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
-{
- return sd->flip;
-}
-
/**
* Turns on editing through drag and drop and copy and paste.
*/
@@ -2134,57 +2116,25 @@ elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disable)
}
EAPI void
-elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
-{
- Efl_Orient dir;
- Efl_Flip flip;
+elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient elm_orient)
+{
+ // This array takes an Elm_Image_Orient and turns it into an Efl_Orient
+ static const Efl_Orient efl_orient[8] = {
+ EFL_ORIENT_NONE,
+ EFL_ORIENT_RIGHT,
+ EFL_ORIENT_DOWN,
+ EFL_ORIENT_LEFT,
+ EFL_ORIENT_FLIP_HORIZONTAL,
+ EFL_ORIENT_FLIP_VERTICAL,
+ EFL_ORIENT_LEFT | EFL_ORIENT_FLIP_VERTICAL,
+ EFL_ORIENT_RIGHT | EFL_ORIENT_FLIP_VERTICAL
+ };
EFL_UI_IMAGE_CHECK(obj);
EFL_UI_IMAGE_DATA_GET(obj, sd);
- sd->image_orient = orient;
-
- switch (orient)
- {
- case EVAS_IMAGE_ORIENT_0:
- dir = EFL_ORIENT_0;
- flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_90:
- dir = EFL_ORIENT_90;
- flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_180:
- dir = EFL_ORIENT_180;
- flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_270:
- dir = EFL_ORIENT_270;
- flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_FLIP_HORIZONTAL:
- dir = EFL_ORIENT_0;
- flip = EFL_FLIP_HORIZONTAL;
- break;
- case EVAS_IMAGE_FLIP_VERTICAL:
- dir = EFL_ORIENT_0;
- flip = EFL_FLIP_VERTICAL;
- break;
- case EVAS_IMAGE_FLIP_TRANSVERSE:
- dir = EFL_ORIENT_270;
- flip = EFL_FLIP_HORIZONTAL;
- break;
- case EVAS_IMAGE_FLIP_TRANSPOSE:
- dir = EFL_ORIENT_270;
- flip = EFL_FLIP_VERTICAL;
- break;
- default:
- dir = EFL_ORIENT_0;
- flip = EFL_FLIP_NONE;
- break;
- }
-
- efl_orientation_set(obj, dir);
- efl_orientation_flip_set(obj, flip);
+ EINA_SAFETY_ON_FALSE_RETURN(elm_orient >= 0 && elm_orient < 8);
+ sd->image_orient = elm_orient;
+ efl_orientation_set(obj, efl_orient[elm_orient]);
}
EAPI Elm_Image_Orient
diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo
index 5202850d36..d4e766e1b6 100644
--- a/src/lib/elementary/efl_ui_image.eo
+++ b/src/lib/elementary/efl_ui_image.eo
@@ -101,7 +101,6 @@ class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl.
Efl.Gfx.Image.smooth_scale { get; set; }
Efl.Gfx.Image.scale_type { get; set; }
Efl.Orientation.orientation { get; set; }
- Efl.Orientation.flip { get; set; }
Efl.Player.playable { get; }
Efl.Player.play { get; set; }
Efl.Layout.Signal.signal_emit;
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index f8c3f4ac9e..d306608a46 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -623,7 +623,6 @@ _grid_create(Evas_Object *obj)
evas_object_image_add(evas_object_evas_get(obj));
evas_object_image_load_orientation_set(g->grid[tn].img, EINA_TRUE);
efl_orientation_set(g->grid[tn].img, sd->orient);
- efl_orientation_flip_set(g->grid[tn].img, sd->flip);
evas_object_image_scale_hint_set
(g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
@@ -1323,7 +1322,6 @@ _orient_apply(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
}
efl_orientation_set(sd->img, sd->orient);
- efl_orientation_flip_set(sd->img, sd->flip);
evas_object_image_size_get(sd->img, &iw, &ih);
sd->size.imw = iw;
sd->size.imh = ih;
@@ -1348,21 +1346,6 @@ _efl_ui_image_zoomable_efl_orientation_orientation_get(const Eo *obj EINA_UNUSED
return sd->orient;
}
-EOLIAN static void
-_efl_ui_image_zoomable_efl_orientation_flip_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Efl_Flip flip)
-{
- if (sd->flip == flip) return;
-
- sd->flip = flip;
- _orient_apply(obj, sd);
-}
-
-EOLIAN static Efl_Flip
-_efl_ui_image_zoomable_efl_orientation_flip_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
-{
- return sd->flip;
-}
-
static void
_efl_ui_image_zoomable_bar_read_and_update(Eo *obj)
{
@@ -2074,7 +2057,6 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
sd->zoom = 0.0;
elm_photocam_zoom_set(obj, tz);
sd->orient = EFL_ORIENT_NONE;
- sd->flip = EFL_FLIP_NONE;
sd->orientation_changed = EINA_FALSE;
return 0;
@@ -2160,7 +2142,6 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret
sd->zoom = 0.0;
elm_photocam_zoom_set(obj, tz);
sd->orient = EFL_ORIENT_NONE;
- sd->flip = EFL_FLIP_NONE;
sd->orientation_changed = EINA_FALSE;
if (ret) *ret = evas_object_image_load_error_get(sd->img);
@@ -3191,95 +3172,54 @@ elm_photocam_add(Evas_Object *parent)
return elm_legacy_add(EFL_UI_IMAGE_ZOOMABLE_LEGACY_CLASS, parent);
}
-static inline void
-_evas_orient_to_eo_orient_flip(const Evas_Image_Orient evas_orient,
- Efl_Orient *orient, Efl_Flip *flip)
-{
- switch (evas_orient) {
- case EVAS_IMAGE_ORIENT_NONE:
- *orient = EFL_ORIENT_NONE;
- *flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_90:
- *orient = EFL_ORIENT_90;
- *flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_180:
- *orient = EFL_ORIENT_180;
- *flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_ORIENT_270:
- *orient = EFL_ORIENT_270;
- *flip = EFL_FLIP_NONE;
- break;
- case EVAS_IMAGE_FLIP_HORIZONTAL:
- *orient = EFL_ORIENT_NONE;
- *flip = EFL_FLIP_HORIZONTAL;
- break;
- case EVAS_IMAGE_FLIP_VERTICAL:
- *orient = EFL_ORIENT_NONE;
- *flip = EFL_FLIP_VERTICAL;
- break;
- case EVAS_IMAGE_FLIP_TRANSVERSE:
- *orient = EFL_ORIENT_270;
- *flip = EFL_FLIP_HORIZONTAL;
- break;
- case EVAS_IMAGE_FLIP_TRANSPOSE:
- *orient = EFL_ORIENT_270;
- *flip = EFL_FLIP_VERTICAL;
- break;
- default:
- *orient = EFL_ORIENT_NONE;
- *flip = EFL_FLIP_NONE;
- break;
- }
+static inline Efl_Orient
+_evas_orient_to_efl_orient(const Evas_Image_Orient evas_orient)
+{
+ // This array takes an Elm_Image_Orient and turns it into an Efl_Orient
+ static const Efl_Orient efl_orient[8] = {
+ EFL_ORIENT_NONE,
+ EFL_ORIENT_RIGHT,
+ EFL_ORIENT_DOWN,
+ EFL_ORIENT_LEFT,
+ EFL_ORIENT_FLIP_HORIZONTAL,
+ EFL_ORIENT_FLIP_VERTICAL,
+ EFL_ORIENT_LEFT | EFL_ORIENT_FLIP_VERTICAL,
+ EFL_ORIENT_RIGHT | EFL_ORIENT_FLIP_VERTICAL
+ };
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(evas_orient >= 0 && evas_orient < 8, EFL_ORIENT_NONE);
+ return efl_orient[evas_orient];
}
static inline Evas_Image_Orient
-_eo_orient_flip_to_evas_orient(Efl_Orient orient, Efl_Flip flip)
-{
- switch (flip)
- {
- default:
- case EFL_FLIP_NONE:
- switch (orient)
- {
- default:
- case EFL_ORIENT_0: return EVAS_IMAGE_ORIENT_0;
- case EFL_ORIENT_90: return EVAS_IMAGE_ORIENT_90;
- case EFL_ORIENT_180: return EVAS_IMAGE_ORIENT_180;
- case EFL_ORIENT_270: return EVAS_IMAGE_ORIENT_270;
- }
- case EFL_FLIP_HORIZONTAL:
- switch (orient)
- {
- default:
- case EFL_ORIENT_0: return EVAS_IMAGE_FLIP_HORIZONTAL;
- case EFL_ORIENT_90: return EVAS_IMAGE_FLIP_TRANSPOSE;
- case EFL_ORIENT_180: return EVAS_IMAGE_FLIP_VERTICAL;
- case EFL_ORIENT_270: return EVAS_IMAGE_FLIP_TRANSVERSE;
- }
- case EFL_FLIP_VERTICAL:
- switch (orient)
- {
- default:
- case EFL_ORIENT_0: return EVAS_IMAGE_FLIP_VERTICAL;
- case EFL_ORIENT_90: return EVAS_IMAGE_FLIP_TRANSVERSE;
- case EFL_ORIENT_180: return EVAS_IMAGE_FLIP_HORIZONTAL;
- case EFL_ORIENT_270: return EVAS_IMAGE_FLIP_TRANSPOSE;
- }
- }
+_efl_orient_to_evas_orient(Efl_Orient efl_orient)
+{
+ // This array takes an Efl_Orient and turns it into an Elm_Image_Orient
+ static const Evas_Image_Orient evas_orient[16] = {
+ EVAS_IMAGE_ORIENT_NONE, // EFL_ORIENT_NONE
+ EVAS_IMAGE_ORIENT_90, // EFL_ORIENT_RIGHT
+ EVAS_IMAGE_ORIENT_180, // EFL_ORIENT_DOWN
+ EVAS_IMAGE_ORIENT_270, // EFL_ORIENT_LEFT
+ EVAS_IMAGE_FLIP_HORIZONTAL, // EFL_ORIENT_NONE + FLIP_HOR
+ EVAS_IMAGE_FLIP_TRANSPOSE, // EFL_ORIENT_RIGHT + FLIP_HOR
+ EVAS_IMAGE_FLIP_VERTICAL, // EFL_ORIENT_DOWN + FLIP_HOR
+ EVAS_IMAGE_FLIP_TRANSVERSE, // EFL_ORIENT_LEFT + FLIP_HOR
+ EVAS_IMAGE_FLIP_VERTICAL, // EFL_ORIENT_NONE + FLIP_VER
+ EVAS_IMAGE_FLIP_TRANSVERSE, // EFL_ORIENT_RIGHT + FLIP_VER
+ EVAS_IMAGE_FLIP_HORIZONTAL, // EFL_ORIENT_DOWN + FLIP_VER
+ EVAS_IMAGE_FLIP_TRANSPOSE, // EFL_ORIENT_LEFT + FLIP_VER
+ EVAS_IMAGE_ORIENT_180, // EFL_ORIENT_NONE + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_270, // EFL_ORIENT_RIGHT + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_0, // EFL_ORIENT_DOWN + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_90 // EFL_ORIENT_LEFT + FLIP_HOR + FLIP_VER
+ };
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_orient >= 0 && efl_orient < 16, EVAS_IMAGE_ORIENT_NONE);
+ return evas_orient[efl_orient];
}
EAPI void
elm_photocam_image_orient_set(Eo *obj, Evas_Image_Orient evas_orient)
{
- Efl_Orient orient;
- Efl_Flip flip;
-
- _evas_orient_to_eo_orient_flip(evas_orient, &orient, &flip);
- efl_orientation_set(obj, orient);
- efl_orientation_flip_set(obj, flip);
+ efl_orientation_set(obj, _evas_orient_to_efl_orient(evas_orient));
}
EAPI Evas_Image_Orient
@@ -3287,7 +3227,7 @@ elm_photocam_image_orient_get(const Eo *obj)
{
ELM_PHOTOCAM_CHECK(obj) EVAS_IMAGE_ORIENT_NONE;
EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd);
- return _eo_orient_flip_to_evas_orient(sd->orient, sd->flip);
+ return _efl_orient_to_evas_orient(sd->orient);
}
EAPI Evas_Object*
diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo
index fccf57f21c..42cab4661b 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.eo
+++ b/src/lib/elementary/efl_ui_image_zoomable.eo
@@ -66,7 +66,6 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom,
Efl.File.load;
Efl.File.file { get; set; }
Efl.Orientation.orientation { get; set; }
- Efl.Orientation.flip { get; set; }
Efl.Layout.Group.group_size_min { get; }
Efl.Layout.Group.group_size_max { get; }
Efl.Layout.Signal.signal_callback_add;
diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h
index 7ccbf2553c..7787e30bbb 100644
--- a/src/lib/elementary/efl_ui_image_zoomable_private.h
+++ b/src/lib/elementary/efl_ui_image_zoomable_private.h
@@ -130,7 +130,6 @@ struct _Efl_Ui_Image_Zoomable_Data
Eina_List *grids;
Efl_Orient orient;
- Efl_Flip flip;
Eina_Bool main_load_pending : 1;
Eina_Bool longpressed : 1;
diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h
index 7a959d4cc6..38afc71f84 100644
--- a/src/lib/elementary/efl_ui_widget_image.h
+++ b/src/lib/elementary/efl_ui_widget_image.h
@@ -66,7 +66,6 @@ struct _Efl_Ui_Image_Data
Elm_Image_Orient image_orient; // to support EAPI
Efl_Orient orient;
- Efl_Flip flip;
struct {
Ecore_Thread *th;
diff --git a/src/lib/evas/canvas/efl_canvas_image_internal.eo b/src/lib/evas/canvas/efl_canvas_image_internal.eo
index c0b9093557..60d3b523d1 100644
--- a/src/lib/evas/canvas/efl_canvas_image_internal.eo
+++ b/src/lib/evas/canvas/efl_canvas_image_internal.eo
@@ -12,7 +12,6 @@ abstract @beta Efl.Canvas.Image_Internal extends Efl.Canvas.Object implements Ef
Efl.Object.debug_name_override;
Efl.File_Save.save;
Efl.Orientation.orientation { get; set; }
- Efl.Orientation.flip { get; set; }
Efl.Gfx.Image.smooth_scale { get; set; }
Efl.Gfx.Image.ratio { get; }
Efl.Gfx.Image.border { get; set; }
diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h
index 5a4f3771a2..36b5ce5d65 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -115,7 +115,6 @@ struct _Evas_Image_Data
Efl_Gfx_Image_Scale_Hint scale_hint;
Efl_Gfx_Image_Content_Hint content_hint;
- Efl_Flip flip_value;
Efl_Orient orient_value;
struct {
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index dd8041b35a..6bec504038 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -411,57 +411,32 @@ _evas_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Orient or
evas_object_change(eo_obj, obj);
}
-static Evas_Image_Orient
-_get_image_orient_from_orient_flip(Efl_Orient orient, Efl_Flip flip)
-{
- switch (orient)
- {
- case EFL_ORIENT_0:
- if (flip == EFL_FLIP_HORIZONTAL)
- return EVAS_IMAGE_FLIP_HORIZONTAL;
- else if (flip == EFL_FLIP_VERTICAL)
- return EVAS_IMAGE_FLIP_VERTICAL;
- else
- return EVAS_IMAGE_ORIENT_0;
-
- case EFL_ORIENT_90:
- if (flip == EFL_FLIP_HORIZONTAL)
- return EVAS_IMAGE_FLIP_TRANSPOSE;
- else if (flip == EFL_FLIP_VERTICAL)
- return EVAS_IMAGE_FLIP_TRANSVERSE;
- else
- return EVAS_IMAGE_ORIENT_90;
-
- case EFL_ORIENT_180:
- if (flip == EFL_FLIP_HORIZONTAL)
- return EVAS_IMAGE_FLIP_VERTICAL;
- else if (flip == EFL_FLIP_VERTICAL)
- return EVAS_IMAGE_FLIP_HORIZONTAL;
- else
- return EVAS_IMAGE_ORIENT_180;
-
- case EFL_ORIENT_270:
- if (flip == EFL_FLIP_HORIZONTAL)
- return EVAS_IMAGE_FLIP_TRANSVERSE;
- else if (flip == EFL_FLIP_VERTICAL)
- return EVAS_IMAGE_FLIP_TRANSPOSE;
- else
- return EVAS_IMAGE_ORIENT_270;
-
- default:
- return EVAS_IMAGE_ORIENT_NONE;
- }
-}
-
EOLIAN static void
-_efl_canvas_image_internal_efl_orientation_orientation_set(Eo *obj, Evas_Image_Data *o, Efl_Orient dir)
-{
- Evas_Image_Orient orient;
-
- o->orient_value = dir;
- orient = _get_image_orient_from_orient_flip(dir, o->flip_value);
+_efl_canvas_image_internal_efl_orientation_orientation_set(Eo *obj, Evas_Image_Data *o, Efl_Orient efl_orient)
+{
+ // This array takes an Efl_Orient and turns it into an Elm_Image_Orient
+ static const Evas_Image_Orient evas_orient[16] = {
+ EVAS_IMAGE_ORIENT_NONE, // EFL_ORIENT_NONE
+ EVAS_IMAGE_ORIENT_90, // EFL_ORIENT_RIGHT
+ EVAS_IMAGE_ORIENT_180, // EFL_ORIENT_DOWN
+ EVAS_IMAGE_ORIENT_270, // EFL_ORIENT_LEFT
+ EVAS_IMAGE_FLIP_HORIZONTAL, // EFL_ORIENT_NONE + FLIP_HOR
+ EVAS_IMAGE_FLIP_TRANSPOSE, // EFL_ORIENT_RIGHT + FLIP_HOR
+ EVAS_IMAGE_FLIP_VERTICAL, // EFL_ORIENT_DOWN + FLIP_HOR
+ EVAS_IMAGE_FLIP_TRANSVERSE, // EFL_ORIENT_LEFT + FLIP_HOR
+ EVAS_IMAGE_FLIP_VERTICAL, // EFL_ORIENT_NONE + FLIP_VER
+ EVAS_IMAGE_FLIP_TRANSVERSE, // EFL_ORIENT_RIGHT + FLIP_VER
+ EVAS_IMAGE_FLIP_HORIZONTAL, // EFL_ORIENT_DOWN + FLIP_VER
+ EVAS_IMAGE_FLIP_TRANSPOSE, // EFL_ORIENT_LEFT + FLIP_VER
+ EVAS_IMAGE_ORIENT_180, // EFL_ORIENT_NONE + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_270, // EFL_ORIENT_RIGHT + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_0, // EFL_ORIENT_DOWN + FLIP_HOR + FLIP_VER
+ EVAS_IMAGE_ORIENT_90 // EFL_ORIENT_LEFT + FLIP_HOR + FLIP_VER
+ };
+ EINA_SAFETY_ON_FALSE_RETURN(efl_orient >= 0 && efl_orient < 16);
- _evas_image_orientation_set(obj, o, orient);
+ o->orient_value = efl_orient;
+ _evas_image_orientation_set(obj, o, evas_orient[efl_orient]);
}
EOLIAN static Efl_Orient
@@ -471,23 +446,6 @@ _efl_canvas_image_internal_efl_orientation_orientation_get(const Eo *obj EINA_UN
}
EOLIAN static void
-_efl_canvas_image_internal_efl_orientation_flip_set(Eo *obj, Evas_Image_Data *o, Efl_Flip flip)
-{
- Evas_Image_Orient orient;
-
- o->flip_value = flip;
- orient = _get_image_orient_from_orient_flip(o->orient_value, flip);
-
- _evas_image_orientation_set(obj, o, orient);
-}
-
-EOLIAN static Efl_Flip
-_efl_canvas_image_internal_efl_orientation_flip_get(const Eo *obj EINA_UNUSED, Evas_Image_Data *o)
-{
- return o->flip_value;
-}
-
-EOLIAN static void
_efl_canvas_image_internal_efl_object_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Efl_Dbg_Info *root)
{
efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root);