rootston: fix rotated subsurfaces
This commit is contained in:
parent
3b226ba81a
commit
1a775adbde
|
@ -102,8 +102,8 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
// Rotated coordinates
|
||||
double rx = cos(view->rotation)*ox - sin(view->rotation)*oy,
|
||||
ry = cos(view->rotation)*oy + sin(view->rotation)*ox;
|
||||
view_sx = (double)box.width/2 + rx;
|
||||
view_sy = (double)box.height/2 + ry;
|
||||
view_sx = rx + (double)box.width/2;
|
||||
view_sy = ry + (double)box.height/2;
|
||||
}
|
||||
|
||||
double sub_x, sub_y;
|
||||
|
|
|
@ -56,9 +56,24 @@ static void render_surface(struct wlr_surface *surface,
|
|||
|
||||
struct wlr_subsurface *subsurface;
|
||||
wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) {
|
||||
double sx = subsurface->surface->current->subsurface_position.x,
|
||||
sy = subsurface->surface->current->subsurface_position.y;
|
||||
double sw = subsurface->surface->current->buffer_width,
|
||||
sh = subsurface->surface->current->buffer_height;
|
||||
if (rotation != 0.0) {
|
||||
// Coordinates relative to the center of the subsurface
|
||||
double ox = sx - (double)width/2 + sw/2,
|
||||
oy = sy - (double)height/2 + sh/2;
|
||||
// Rotated coordinates
|
||||
double rx = cos(-rotation)*ox - sin(-rotation)*oy,
|
||||
ry = cos(-rotation)*oy + sin(-rotation)*ox;
|
||||
sx = rx + (double)width/2 - sw/2;
|
||||
sy = ry + (double)height/2 - sh/2;
|
||||
}
|
||||
|
||||
render_surface(subsurface->surface, desktop, wlr_output, when,
|
||||
lx + subsurface->surface->current->subsurface_position.x,
|
||||
ly + subsurface->surface->current->subsurface_position.y,
|
||||
lx + sx,
|
||||
ly + sy,
|
||||
rotation);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue