compositor: Group matrix and inverse in struct wlsc_transform
This commit is contained in:
parent
3a53efe26e
commit
0bc0e24968
@ -194,7 +194,6 @@ wlsc_surface_create(struct wlsc_compositor *compositor,
|
||||
surface->height = height;
|
||||
|
||||
surface->transform = NULL;
|
||||
surface->transform_inv = NULL;
|
||||
|
||||
return surface;
|
||||
}
|
||||
@ -486,7 +485,7 @@ transform_vertex(struct wlsc_surface *surface,
|
||||
t.f[2] = 0.0;
|
||||
t.f[3] = 1.0;
|
||||
|
||||
wlsc_matrix_transform(surface->transform, &t);
|
||||
wlsc_matrix_transform(&surface->transform->matrix, &t);
|
||||
|
||||
r[ 0] = t.f[0];
|
||||
r[ 1] = t.f[1];
|
||||
|
@ -45,6 +45,11 @@ void
|
||||
wlsc_matrix_translate(struct wlsc_matrix *matrix,
|
||||
GLfloat x, GLfloat y, GLfloat z);
|
||||
|
||||
struct wlsc_transform {
|
||||
struct wlsc_matrix matrix;
|
||||
struct wlsc_matrix inverse;
|
||||
};
|
||||
|
||||
struct wlsc_surface;
|
||||
|
||||
struct wlsc_output {
|
||||
@ -219,8 +224,7 @@ struct wlsc_surface {
|
||||
int32_t saved_x, saved_y;
|
||||
struct wl_list link;
|
||||
struct wl_list buffer_link;
|
||||
struct wlsc_matrix *transform;
|
||||
struct wlsc_matrix *transform_inv;
|
||||
struct wlsc_transform *transform;
|
||||
struct wl_visual *visual;
|
||||
struct wlsc_output *output;
|
||||
enum wlsc_surface_map_type map_type;
|
||||
|
@ -78,8 +78,7 @@ struct meego_tablet_zoom {
|
||||
struct wlsc_surface *surface;
|
||||
struct wlsc_animation animation;
|
||||
struct wlsc_tweener tweener;
|
||||
struct wlsc_matrix transform;
|
||||
struct wlsc_matrix transform_inv;
|
||||
struct wlsc_transform transform;
|
||||
};
|
||||
|
||||
static int
|
||||
@ -111,21 +110,20 @@ meego_tablet_zoom_frame(struct wlsc_animation *animation,
|
||||
wl_list_remove(&animation->link);
|
||||
fprintf(stderr, "animation done\n");
|
||||
es->transform = NULL;
|
||||
es->transform_inv = NULL;
|
||||
free(zoom);
|
||||
}
|
||||
|
||||
scale = zoom->tweener.current;
|
||||
wlsc_matrix_init(&zoom->transform);
|
||||
wlsc_matrix_translate(&zoom->transform,
|
||||
wlsc_matrix_init(&zoom->transform.matrix);
|
||||
wlsc_matrix_translate(&zoom->transform.matrix,
|
||||
-es->width / 2.0, -es->height / 2.0, 0);
|
||||
wlsc_matrix_scale(&zoom->transform, scale, scale, scale);
|
||||
wlsc_matrix_translate(&zoom->transform,
|
||||
wlsc_matrix_scale(&zoom->transform.matrix, scale, scale, scale);
|
||||
wlsc_matrix_translate(&zoom->transform.matrix,
|
||||
es->width / 2.0, es->height / 2.0, 0);
|
||||
|
||||
scale = 1.0 / zoom->tweener.current;
|
||||
wlsc_matrix_init(&zoom->transform_inv);
|
||||
wlsc_matrix_scale(&zoom->transform_inv, scale, scale, scale);
|
||||
wlsc_matrix_init(&zoom->transform.inverse);
|
||||
wlsc_matrix_scale(&zoom->transform.inverse, scale, scale, scale);
|
||||
|
||||
wlsc_surface_damage(es);
|
||||
}
|
||||
@ -145,23 +143,15 @@ meego_tablet_zoom_run(struct meego_tablet_shell *shell,
|
||||
|
||||
zoom->surface = surface;
|
||||
surface->transform = &zoom->transform;
|
||||
surface->transform_inv = &zoom->transform_inv;
|
||||
scale = 0.3;
|
||||
wlsc_tweener_init(&zoom->tweener, 100.0, scale, 1.0);
|
||||
zoom->tweener.timestamp = wlsc_compositor_get_time();
|
||||
zoom->animation.frame = meego_tablet_zoom_frame;
|
||||
meego_tablet_zoom_frame(&zoom->animation, NULL,
|
||||
zoom->tweener.timestamp);
|
||||
|
||||
wl_list_insert(shell->compositor->animation_list.prev,
|
||||
&zoom->animation.link);
|
||||
|
||||
wlsc_matrix_init(&zoom->transform);
|
||||
wlsc_matrix_translate(&zoom->transform,
|
||||
-surface->width / 2.0,
|
||||
-surface->height / 2.0, 0);
|
||||
wlsc_matrix_scale(&zoom->transform, scale, scale, scale);
|
||||
|
||||
scale = 1.0 / scale;
|
||||
wlsc_matrix_init(&zoom->transform_inv);
|
||||
wlsc_matrix_scale(&zoom->transform_inv, scale, scale, scale);
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
Loading…
x
Reference in New Issue
Block a user