From ece8a016aaafbb54380e6c12cd7fdde972202740 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 8 Feb 2012 15:23:15 +0200 Subject: [PATCH] compositor: move surface_to_global_float() definition Move surface_to_global_float() definition earlier in the file. No code changes. Signed-off-by: Pekka Paalanen --- src/compositor.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 556aad4..f631e23 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -231,6 +231,32 @@ weston_surface_set_color(struct weston_surface *surface, } static void +surface_to_global_float(struct weston_surface *surface, + int32_t sx, int32_t sy, GLfloat *x, GLfloat *y) +{ + if (surface->transform.enabled) { + struct weston_vector v = { { sx, sy, 0.0f, 1.0f } }; + + weston_matrix_transform(&surface->transform.matrix, &v); + + if (fabsf(v.f[3]) < 1e-6) { + fprintf(stderr, "warning: numerical instability in " + "weston_surface_to_global(), divisor = %g\n", + v.f[3]); + *x = 0; + *y = 0; + return; + } + + *x = v.f[0] / v.f[3]; + *y = v.f[1] / v.f[3]; + } else { + *x = sx + surface->geometry.x; + *y = sy + surface->geometry.y; + } +} + +static void weston_surface_damage_below_noupdate(struct weston_surface *surface) { struct weston_surface *below; @@ -344,32 +370,6 @@ weston_surface_update_transform(struct weston_surface *surface) } } -static void -surface_to_global_float(struct weston_surface *surface, - int32_t sx, int32_t sy, GLfloat *x, GLfloat *y) -{ - if (surface->transform.enabled) { - struct weston_vector v = { { sx, sy, 0.0f, 1.0f } }; - - weston_matrix_transform(&surface->transform.matrix, &v); - - if (fabsf(v.f[3]) < 1e-6) { - fprintf(stderr, "warning: numerical instability in " - "weston_surface_to_global(), divisor = %g\n", - v.f[3]); - *x = 0; - *y = 0; - return; - } - - *x = v.f[0] / v.f[3]; - *y = v.f[1] / v.f[3]; - } else { - *x = sx + surface->geometry.x; - *y = sy + surface->geometry.y; - } -} - WL_EXPORT void weston_surface_to_global(struct weston_surface *surface, int32_t sx, int32_t sy, int32_t *x, int32_t *y) -- 2.7.4