mirror of
https://github.com/brl/mutter.git
synced 2025-02-19 22:54:08 +00:00
kms/update: Add init helper macros for fixed 16 rects
META_FIXED_16_INIT(), taking MetaFixed16's, and META_FIXED_16_INIT_INT() taking integers, converting them to MetaFixed16. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
This commit is contained in:
parent
acd51a7e69
commit
de06d5d9e7
@ -191,6 +191,15 @@ meta_fixed_16_rectangle_to_rectangle (MetaFixed16Rectangle fixed_rect)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define META_FIXED_16_RECTANGLE_INIT(_x,_y,_w,_h) \
|
||||||
|
(MetaFixed16Rectangle) { .x = (_x), .y = (_y), .width = (_w), .height = (_h) }
|
||||||
|
|
||||||
|
#define META_FIXED_16_RECTANGLE_INIT_INT(_x,_y,_w,_h) \
|
||||||
|
META_FIXED_16_RECTANGLE_INIT (meta_fixed_16_from_int (_x), \
|
||||||
|
meta_fixed_16_from_int (_y), \
|
||||||
|
meta_fixed_16_from_int (_w), \
|
||||||
|
meta_fixed_16_from_int (_h))
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsFeedback, meta_kms_feedback_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsFeedback, meta_kms_feedback_free)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsUpdate, meta_kms_update_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsUpdate, meta_kms_update_free)
|
||||||
|
|
||||||
|
@ -83,11 +83,30 @@ meta_test_kms_update_sanity (void)
|
|||||||
meta_kms_update_free (update);
|
meta_kms_update_free (update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_test_kms_update_fixed16 (void)
|
||||||
|
{
|
||||||
|
MetaFixed16Rectangle rect16;
|
||||||
|
|
||||||
|
g_assert_cmpint (meta_fixed_16_from_int (12345), ==, 809041920);
|
||||||
|
g_assert_cmpint (meta_fixed_16_to_int (809041920), ==, 12345);
|
||||||
|
g_assert_cmpint (meta_fixed_16_from_int (-12345), ==, -809041920);
|
||||||
|
g_assert_cmpint (meta_fixed_16_to_int (-809041920), ==, -12345);
|
||||||
|
|
||||||
|
rect16 = META_FIXED_16_RECTANGLE_INIT_INT (100, 200, 300, 400);
|
||||||
|
g_assert_cmpint (rect16.x, ==, 6553600);
|
||||||
|
g_assert_cmpint (rect16.y, ==, 13107200);
|
||||||
|
g_assert_cmpint (rect16.width, ==, 19660800);
|
||||||
|
g_assert_cmpint (rect16.height, ==, 26214400);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_tests (void)
|
init_tests (void)
|
||||||
{
|
{
|
||||||
g_test_add_func ("/backends/native/kms/update/sanity",
|
g_test_add_func ("/backends/native/kms/update/sanity",
|
||||||
meta_test_kms_update_sanity);
|
meta_test_kms_update_sanity);
|
||||||
|
g_test_add_func ("/backends/native/kms/update/fixed16",
|
||||||
|
meta_test_kms_update_fixed16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user