gsk: Add gsk_stroke_hash

Not currently used, just leaving this here for later use.
This commit is contained in:
Matthias Clasen
2020-12-15 19:06:20 -05:00
parent d980c8808d
commit d1bcd3cecb
2 changed files with 19 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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__ */