[mutter] boxes: Add 'round' rounding strategy



commit a11f9bd513bc02654fb167a75a0c5e1e4d822833
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Jan 15 19:27:54 2020 +0100

    boxes: Add 'round' rounding strategy
    
    It just calls roundf(), and is intended to be used when the graphene
    rectangle is approximately integer aligned.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/1042

 src/core/boxes-private.h | 1 +
 src/core/boxes.c         | 9 +++++++++
 2 files changed, 10 insertions(+)
---
diff --git a/src/core/boxes-private.h b/src/core/boxes-private.h
index e1a72d335..152be6e49 100644
--- a/src/core/boxes-private.h
+++ b/src/core/boxes-private.h
@@ -45,6 +45,7 @@ typedef enum _MetaRoundingStrategy
 {
   META_ROUNDING_STRATEGY_SHRINK,
   META_ROUNDING_STRATEGY_GROW,
+  META_ROUNDING_STRATEGY_ROUND,
 } MetaRoundingStrategy;
 
 /* Output functions -- note that the output buffer had better be big enough:
diff --git a/src/core/boxes.c b/src/core/boxes.c
index 6b7b0bbaf..d1f81975f 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -2151,6 +2151,15 @@ meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
         };
       }
       break;
+    case META_ROUNDING_STRATEGY_ROUND:
+      {
+        *dest = (MetaRectangle) {
+          .x = roundf (rect->origin.x),
+          .y = roundf (rect->origin.y),
+          .width = roundf (rect->size.width),
+          .height = roundf (rect->size.height),
+        };
+      }
     }
 }
 


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