[mutter] monitor: Use transform helper when dealing with panel orientation



commit 92f0eb9d1422adefc853bbc5b6f148dac7004587
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Feb 18 11:30:38 2020 +0100

    monitor: Use transform helper when dealing with panel orientation
    
    Replace the open coded monitor transform math with the new helper.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/1064

 src/backends/meta-monitor.c | 13 +++++--------
 src/backends/meta-output.c  | 11 ++++-------
 2 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 908675c44..768b787ac 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -467,15 +467,12 @@ meta_monitor_crtc_to_logical_transform (MetaMonitor          *monitor,
                                         MetaMonitorTransform  transform)
 {
   MetaOutput *output = meta_monitor_get_main_output (monitor);
-  MetaMonitorTransform new_transform;
+  MetaMonitorTransform inverted_paniel_orientation_transform;
 
-  new_transform = (transform + META_MONITOR_TRANSFORM_FLIPPED -
-                   output->panel_orientation_transform) %
-                  META_MONITOR_TRANSFORM_FLIPPED;
-  if (meta_monitor_transform_is_flipped (transform))
-    new_transform += META_MONITOR_TRANSFORM_FLIPPED;
-
-  return new_transform;
+  inverted_paniel_orientation_transform =
+    meta_monitor_transform_invert (output->panel_orientation_transform);
+  return meta_monitor_transform_transform (transform,
+                                           inverted_paniel_orientation_transform);
 }
 
 static void
diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c
index 2e8a787db..761435b59 100644
--- a/src/backends/meta-output.c
+++ b/src/backends/meta-output.c
@@ -66,14 +66,11 @@ MetaMonitorTransform
 meta_output_logical_to_crtc_transform (MetaOutput           *output,
                                        MetaMonitorTransform  transform)
 {
-  MetaMonitorTransform new_transform;
+  MetaMonitorTransform panel_orientation_transform;
 
-  new_transform = (transform + output->panel_orientation_transform) %
-                  META_MONITOR_TRANSFORM_FLIPPED;
-  if (meta_monitor_transform_is_flipped (transform))
-    new_transform += META_MONITOR_TRANSFORM_FLIPPED;
-
-  return new_transform;
+  panel_orientation_transform = output->panel_orientation_transform;
+  return meta_monitor_transform_transform (transform,
+                                           panel_orientation_transform);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]