[gtk/mask-nodes: 35/39] gsk: Add gsk_stroke_hash
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/mask-nodes: 35/39] gsk: Add gsk_stroke_hash
- Date: Wed, 23 Dec 2020 04:51:19 +0000 (UTC)
commit d1bcd3cecb09a211ca35fd9a7f68ca1a41f2e3a8
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 15 19:06:20 2020 -0500
gsk: Add gsk_stroke_hash
Not currently used, just leaving this here for later use.
gsk/gskstroke.c | 17 +++++++++++++++++
gsk/gskstrokeprivate.h | 2 ++
2 files changed, 19 insertions(+)
---
diff --git a/gsk/gskstroke.c b/gsk/gskstroke.c
index 514d58c279..ea9f228cf5 100644
--- a/gsk/gskstroke.c
+++ b/gsk/gskstroke.c
@@ -465,3 +465,20 @@ gsk_stroke_get_dash_offset (const GskStroke *self)
return self->dash_offset;
}
+
+guint
+gsk_stroke_hash (const GskStroke *stroke)
+{
+ guint32 h = 5381;
+
+ h = (h << 5) + h + (guint) (stroke->line_width * 100);
+ h = (h << 5) + h + stroke->line_cap;
+ h = (h << 5) + h + stroke->line_join;
+ h = (h << 5) + h + (guint) (stroke->miter_limit * 100);
+ h = (h << 5) + h + stroke->n_dash;
+ for (int i = 0; i < stroke->n_dash; i++)
+ h = (h << 5) + h + (guint) (stroke->dash[i] * 100);
+ h = (h << 5) + h + (guint) (stroke->dash_offset * 100);
+
+ return h;
+}
diff --git a/gsk/gskstrokeprivate.h b/gsk/gskstrokeprivate.h
index 9b5445094b..91694fee95 100644
--- a/gsk/gskstrokeprivate.h
+++ b/gsk/gskstrokeprivate.h
@@ -54,6 +54,8 @@ gsk_stroke_clear (GskStroke *stroke)
stroke->n_dash = 0; /* better safe than sorry */
}
+guint gsk_stroke_hash (const GskStroke *stroke);
+
G_END_DECLS
#endif /* __GSK_STROKE_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]