Merge Efl.Orient and Efl.Flip into the same enum
authorXavi Artigas <xavierartigas@yahoo.es>
Mon, 20 May 2019 15:51:56 +0000 (11:51 -0400)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 30 May 2019 08:17:52 +0000 (17:17 +0900)
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

src/examples/evas/evas-images5.c
src/lib/efl/interfaces/efl_orientation.eo
src/lib/elementary/efl_ui_image.c
src/lib/elementary/efl_ui_image.eo
src/lib/elementary/efl_ui_image_zoomable.c
src/lib/elementary/efl_ui_image_zoomable.eo
src/lib/elementary/efl_ui_image_zoomable_private.h
src/lib/elementary/efl_ui_widget_image.h
src/lib/evas/canvas/efl_canvas_image_internal.eo
src/lib/evas/canvas/evas_image_private.h
src/lib/evas/canvas/evas_object_image.c

index ed8a4e5..fa2794e 100644 (file)
@@ -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;
      }
 }
index e874dcf..be42be5 100644 (file)
@@ -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]]
-        }
-     }
    }
 }
index 4ff4a23..22e97f5 100644 (file)
@@ -824,7 +824,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)
@@ -1396,23 +1395,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.
  */
@@ -2150,57 +2132,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
index 5202850..d4e766e 100644 (file)
@@ -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;
index 7ff9f8f..afdc62f 100644 (file)
@@ -636,7 +636,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);
@@ -1336,7 +1335,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;
@@ -1361,21 +1359,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)
 {
@@ -2087,7 +2070,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;
@@ -2173,7 +2155,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);
@@ -3204,95 +3185,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
@@ -3300,7 +3240,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*
index fccf57f..42cab46 100644 (file)
@@ -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;
index 3054cfc..349e59b 100644 (file)
@@ -131,7 +131,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;
index 8a5beef..539204f 100644 (file)
@@ -67,7 +67,6 @@ struct _Efl_Ui_Image_Data
 
    Elm_Image_Orient      image_orient; // to support EAPI
    Efl_Orient            orient;
-   Efl_Flip              flip;
 
    struct {
       Ecore_Thread      *th;
index c0b9093..60d3b52 100644 (file)
@@ -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; }
index de2131b..f23965a 100755 (executable)
@@ -126,7 +126,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 {
index 4762663..2be0230 100755 (executable)
@@ -425,57 +425,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
@@ -485,23 +460,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);