[gnome-flashback] monitor: use transform helper when dealing with panel orientation



commit 91fc287e79f3611de44ac300047d6ccb6fce3ce3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Mar 12 22:04:02 2020 +0200

    monitor: use transform helper when dealing with panel orientation
    
    Based on mutter commit:
    https://gitlab.gnome.org/GNOME/mutter/-/commit/92f0eb9d1422adefc853

 backends/gf-monitor.c | 12 +++++-------
 backends/gf-output.c  | 11 ++---------
 2 files changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index b728f41..712e756 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -895,17 +895,15 @@ gf_monitor_crtc_to_logical_transform (GfMonitor          *monitor,
                                       GfMonitorTransform  transform)
 {
   GfOutput *output;
-  GfMonitorTransform new_transform;
+  GfMonitorTransform panel_orientation_transform;
+  GfMonitorTransform inverted_transform;
 
   output = gf_monitor_get_main_output (monitor);
-  new_transform = (transform + GF_MONITOR_TRANSFORM_FLIPPED -
-                   output->panel_orientation_transform) %
-                  GF_MONITOR_TRANSFORM_FLIPPED;
 
-  if (gf_monitor_transform_is_flipped (transform))
-    new_transform += GF_MONITOR_TRANSFORM_FLIPPED;
+  panel_orientation_transform = output->panel_orientation_transform;
+  inverted_transform = gf_monitor_transform_invert (panel_orientation_transform);
 
-  return new_transform;
+  return gf_monitor_transform_transform (transform, inverted_transform);
 }
 
 gboolean
diff --git a/backends/gf-output.c b/backends/gf-output.c
index d21b09d..3e767d5 100644
--- a/backends/gf-output.c
+++ b/backends/gf-output.c
@@ -212,13 +212,6 @@ GfMonitorTransform
 gf_output_logical_to_crtc_transform (GfOutput           *output,
                                      GfMonitorTransform  transform)
 {
-  GfMonitorTransform new_transform;
-
-  new_transform = (transform + output->panel_orientation_transform) %
-                  GF_MONITOR_TRANSFORM_FLIPPED;
-
-  if (gf_monitor_transform_is_flipped (transform))
-    new_transform += GF_MONITOR_TRANSFORM_FLIPPED;
-
-  return new_transform;
+  return gf_monitor_transform_transform (transform,
+                                         output->panel_orientation_transform);
 }


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