[pango/pango2: 7/301] Add pango_matrix_equal




commit f789f9849e05af536ebaafbd5be95db3e65ea2c8
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 6 09:37:12 2022 -0400

    Add pango_matrix_equal
    
    This is better than an memcmp, since it will
    ignore differences between 0.0 and -0.0.

 pango/pango-matrix.c | 9 +++++++++
 pango/pango-matrix.h | 4 ++++
 2 files changed, 13 insertions(+)
---
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index 3bc0ff164..90d1df3a2 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -513,3 +513,12 @@ pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
   rect->width  = ceil (max_x - rect->x);
   rect->height = ceil (max_y - rect->y);
 }
+
+gboolean
+pango_matrix_equal (const PangoMatrix *m1,
+                    const PangoMatrix *m2)
+{
+  return m1->xx == m2->xx && m1->xy == m2->xy &&
+         m1->yx == m2->yx && m1->yy == m2->yy &&
+         m1->x0 == m2->x0 && m1->y0 == m2->y0;
+}
diff --git a/pango/pango-matrix.h b/pango/pango-matrix.h
index cb53a422d..e47afd1cd 100644
--- a/pango/pango-matrix.h
+++ b/pango/pango-matrix.h
@@ -88,6 +88,10 @@ PangoMatrix *pango_matrix_copy   (const PangoMatrix *matrix);
 PANGO_AVAILABLE_IN_1_6
 void         pango_matrix_free   (PangoMatrix *matrix);
 
+PANGO_AVAILABLE_IN_ALL
+gboolean     pango_matrix_equal (const PangoMatrix *m1,
+                                 const PangoMatrix *m2);
+
 PANGO_AVAILABLE_IN_1_6
 void pango_matrix_translate (PangoMatrix *matrix,
                             double       tx,


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