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 <ppaalanen@gmail.com>
This commit is contained in:
Pekka Paalanen 2012-02-08 15:23:15 +02:00
parent 80fb08dc66
commit ece8a016aa

View File

@ -230,6 +230,32 @@ weston_surface_set_color(struct weston_surface *surface,
surface->shader = &surface->compositor->solid_shader;
}
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)
{
@ -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)