[pango/pango2: 1/168] Add pango_matrix_equal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 1/168] Add pango_matrix_equal
- Date: Wed, 8 Jun 2022 10:22:13 +0000 (UTC)
commit d03b2348c680a19bd4af49b7be38b780b8959bb1
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 3bc0ff16..90d1df3a 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 cb53a422..e47afd1c 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]