Compare commits

...

1 Commits

Author SHA1 Message Date
Руслан Ижбулатов
d2b509fb23 Fix some alignment issues
* Use GRAPHENE_ALIGN16 to ensure that GtkSnapshotState size
  is a multiple of 16
* Use G_STATIC_ASSERT instead of g_return_val_if_fail to make
  the wrong size (if it turns out to be wrong) be a compile-time
  erorr instead of a runtime one
2018-06-11 12:43:14 +00:00
2 changed files with 3 additions and 2 deletions

View File

@@ -67,8 +67,6 @@ gtk_snapshot_state_array_new (void)
{
GtkRealSnapshotStateArray *array;
g_return_val_if_fail (sizeof (GtkSnapshotState) % 16 == 0, NULL);
array = g_slice_new (GtkRealSnapshotStateArray);
array->data = NULL;

View File

@@ -40,6 +40,7 @@ typedef GskRenderNode * (* GtkSnapshotCollectFunc) (GtkSnapshot *snapshot,
GskRenderNode **nodes,
guint n_nodes);
GRAPHENE_ALIGN16
struct _GtkSnapshotState {
guint start_node_index;
guint n_nodes;
@@ -91,6 +92,8 @@ struct _GtkSnapshotState {
} data;
};
G_STATIC_ASSERT (sizeof (GtkSnapshotState) % 16 == 0);
/* This is a nasty little hack. We typedef GtkSnapshot to the fake object GdkSnapshot
* so that we don't need to typecast between them.
* After all, the GdkSnapshot only exist so poor language bindings don't trip. Hardcore