mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
Gather all time unit conversion helpers in one place
We had time unit conversion helpers (e.g. us2ms(), ns2us(), etc) in multiple places. Clean that up by moving them all to a common file. That file is clutter-private.h, as it's accessible by both from clutter/ and src/. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
bb73038a27
commit
f086eafe57
@ -20,21 +20,10 @@
|
||||
#include "clutter/clutter-frame-clock.h"
|
||||
|
||||
#include "clutter/clutter-main.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-timeline-private.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
static inline uint64_t
|
||||
us (uint64_t us)
|
||||
{
|
||||
return us;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ms2us (uint64_t ms)
|
||||
{
|
||||
return us (ms * 1000);
|
||||
}
|
||||
|
||||
/* Wait 2ms after vblank before starting to draw next frame */
|
||||
#define SYNC_DELAY_US ms2us (2)
|
||||
|
||||
|
@ -316,6 +316,30 @@ gboolean _clutter_run_progress_function (GType gtype,
|
||||
|
||||
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
||||
|
||||
static inline uint64_t
|
||||
us (uint64_t us)
|
||||
{
|
||||
return us;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ms2us (uint64_t ms)
|
||||
{
|
||||
return us (ms * 1000);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
us2ms (uint64_t us)
|
||||
{
|
||||
return (uint32_t) (us / 1000);
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ns2us (uint64_t ns)
|
||||
{
|
||||
return us (ns / 1000);
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PRIVATE_H__ */
|
||||
|
@ -147,24 +147,6 @@ struct _MetaSeatNative
|
||||
G_DECLARE_FINAL_TYPE (MetaSeatNative, meta_seat_native,
|
||||
META, SEAT_NATIVE, ClutterSeat)
|
||||
|
||||
static inline uint64_t
|
||||
us (uint64_t us)
|
||||
{
|
||||
return us;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ms2us (uint64_t ms)
|
||||
{
|
||||
return us (ms * 1000);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
us2ms (uint64_t us)
|
||||
{
|
||||
return (uint32_t) (us / 1000);
|
||||
}
|
||||
|
||||
void meta_seat_native_notify_key (MetaSeatNative *seat,
|
||||
ClutterInputDevice *device,
|
||||
uint64_t time_us,
|
||||
|
@ -168,18 +168,6 @@ gboolean clutter_test_check_color_at_point (ClutterActor
|
||||
const ClutterColor *color,
|
||||
ClutterColor *result);
|
||||
|
||||
static inline uint64_t
|
||||
us (uint64_t us)
|
||||
{
|
||||
return us;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ms2us (uint64_t ms)
|
||||
{
|
||||
return us (ms * 1000);
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TEST_UTILS_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user