libweston: always use the transform matrix for coordinate conversion
We always set it up correctly, even if transforms are disabled. The code is simpler if we always use the matrix instead of having two cases. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
2dc8680d71
commit
8bf90010dd
@ -649,11 +649,10 @@ WL_EXPORT void
|
||||
weston_view_to_global_float(struct weston_view *view,
|
||||
float sx, float sy, float *x, float *y)
|
||||
{
|
||||
assert(!view->transform.dirty);
|
||||
|
||||
if (view->transform.enabled) {
|
||||
struct weston_vector v = { { sx, sy, 0.0f, 1.0f } };
|
||||
|
||||
assert(!view->transform.dirty);
|
||||
|
||||
weston_matrix_transform(&view->transform.matrix, &v);
|
||||
|
||||
if (fabsf(v.f[3]) < 1e-6) {
|
||||
@ -667,10 +666,6 @@ weston_view_to_global_float(struct weston_view *view,
|
||||
|
||||
*x = v.f[0] / v.f[3];
|
||||
*y = v.f[1] / v.f[3];
|
||||
} else {
|
||||
*x = sx + view->geometry.x;
|
||||
*y = sy + view->geometry.y;
|
||||
}
|
||||
}
|
||||
|
||||
WL_EXPORT pixman_box32_t
|
||||
@ -1467,11 +1462,10 @@ WL_EXPORT void
|
||||
weston_view_from_global_float(struct weston_view *view,
|
||||
float x, float y, float *vx, float *vy)
|
||||
{
|
||||
assert(!view->transform.dirty);
|
||||
|
||||
if (view->transform.enabled) {
|
||||
struct weston_vector v = { { x, y, 0.0f, 1.0f } };
|
||||
|
||||
assert(!view->transform.dirty);
|
||||
|
||||
weston_matrix_transform(&view->transform.inverse, &v);
|
||||
|
||||
if (fabsf(v.f[3]) < 1e-6) {
|
||||
@ -1485,10 +1479,6 @@ weston_view_from_global_float(struct weston_view *view,
|
||||
|
||||
*vx = v.f[0] / v.f[3];
|
||||
*vy = v.f[1] / v.f[3];
|
||||
} else {
|
||||
*vx = x - view->geometry.x;
|
||||
*vy = y - view->geometry.y;
|
||||
}
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
Loading…
Reference in New Issue
Block a user