[mutter/gnome-3-38] shaped-texture: Use G_APPROX_VALUE to compare viewport source rects



commit afd78ada09cea81bd211928e82b4ef5a5b42aa00
Author: Robert Mader <robert mader posteo de>
Date:   Tue Mar 23 10:03:15 2021 +0100

    shaped-texture: Use G_APPROX_VALUE to compare viewport source rects
    
    
    (cherry picked from commit 50ba52b1b576f03e8a78b1b2f2af42a22033a1f5)
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1808>

 src/compositor/meta-shaped-texture.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index c37ebe8f31..90e9a4c033 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -1260,10 +1260,14 @@ meta_shaped_texture_set_viewport_src_rect (MetaShapedTexture *stex,
                                            graphene_rect_t   *src_rect)
 {
   if (!stex->has_viewport_src_rect ||
-      stex->viewport_src_rect.origin.x != src_rect->origin.x ||
-      stex->viewport_src_rect.origin.y != src_rect->origin.y ||
-      stex->viewport_src_rect.size.width != src_rect->size.width ||
-      stex->viewport_src_rect.size.height != src_rect->size.height)
+      !G_APPROX_VALUE (stex->viewport_src_rect.origin.x,
+                       src_rect->origin.x, FLT_EPSILON) ||
+      !G_APPROX_VALUE (stex->viewport_src_rect.origin.y,
+                       src_rect->origin.y, FLT_EPSILON) ||
+      !G_APPROX_VALUE (stex->viewport_src_rect.size.width,
+                       src_rect->size.width, FLT_EPSILON) ||
+      !G_APPROX_VALUE (stex->viewport_src_rect.size.height,
+                       src_rect->size.height, FLT_EPSILON))
     {
       stex->has_viewport_src_rect = TRUE;
       stex->viewport_src_rect = *src_rect;


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