mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
clutter/util: Generalize ROUND_TO_256THS
It'll be reused in other bits of the Clutter codebase. Move it to an inline function in clutter-private.h https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1489
This commit is contained in:
parent
5a58ccbece
commit
8809ee9e26
@ -268,6 +268,12 @@ gboolean _clutter_run_progress_function (GType gtype,
|
|||||||
|
|
||||||
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
clutter_round_to_256ths (float *f)
|
||||||
|
{
|
||||||
|
*f = roundf ((*f) * 256) / 256;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int64_t
|
static inline int64_t
|
||||||
us (int64_t us)
|
us (int64_t us)
|
||||||
{
|
{
|
||||||
|
@ -47,8 +47,6 @@
|
|||||||
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
|
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
|
||||||
#define MTX_GL_SCALE_Z(z,w,v1,v2) (MTX_GL_SCALE_X ((z), (w), (v1), (v2)))
|
#define MTX_GL_SCALE_Z(z,w,v1,v2) (MTX_GL_SCALE_X ((z), (w), (v1), (v2)))
|
||||||
|
|
||||||
#define ROUND_TO_256THS(x) (roundf ((x) * 256) / 256)
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
@ -108,14 +106,16 @@ _clutter_util_fully_transform_vertices (const graphene_matrix_t *modelview,
|
|||||||
ClutterVertex4 vertex_tmp = vertices_tmp[i];
|
ClutterVertex4 vertex_tmp = vertices_tmp[i];
|
||||||
graphene_point3d_t *vertex_out = &vertices_out[i];
|
graphene_point3d_t *vertex_out = &vertices_out[i];
|
||||||
/* Finally translate from OpenGL coords to window coords */
|
/* Finally translate from OpenGL coords to window coords */
|
||||||
vertex_out->x = ROUND_TO_256THS (MTX_GL_SCALE_X (vertex_tmp.x,
|
vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x,
|
||||||
vertex_tmp.w,
|
vertex_tmp.w,
|
||||||
viewport[2],
|
viewport[2],
|
||||||
viewport[0]));
|
viewport[0]);
|
||||||
vertex_out->y = ROUND_TO_256THS (MTX_GL_SCALE_Y (vertex_tmp.y,
|
vertex_out->y = MTX_GL_SCALE_Y (vertex_tmp.y,
|
||||||
vertex_tmp.w,
|
vertex_tmp.w,
|
||||||
viewport[3],
|
viewport[3],
|
||||||
viewport[1]));
|
viewport[1]);
|
||||||
|
clutter_round_to_256ths (&vertex_out->x);
|
||||||
|
clutter_round_to_256ths (&vertex_out->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user