|
|
@ -120,41 +120,3 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_box_rotated_bounds(struct wlr_box *dest, const struct wlr_box *box,
|
|
|
|
|
|
|
|
float rotation) {
|
|
|
|
|
|
|
|
if (rotation == 0) {
|
|
|
|
|
|
|
|
*dest = *box;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double ox = box->x + (double)box->width/2;
|
|
|
|
|
|
|
|
double oy = box->y + (double)box->height/2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double c = fabs(cos(rotation));
|
|
|
|
|
|
|
|
double s = fabs(sin(rotation));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double x1 = ox + (box->x - ox) * c + (box->y - oy) * s;
|
|
|
|
|
|
|
|
double x2 = ox +
|
|
|
|
|
|
|
|
(box->x + box->width - ox) * c +
|
|
|
|
|
|
|
|
(box->y + box->height - oy) * s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double y1 = oy + (box->x - ox) * s + (box->y - oy) * c;
|
|
|
|
|
|
|
|
double y2 = oy +
|
|
|
|
|
|
|
|
(box->x + box->width - ox) * s +
|
|
|
|
|
|
|
|
(box->y + box->height - oy) * c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dest->x = floor(fmin(x1, x2));
|
|
|
|
|
|
|
|
dest->width = ceil(fmax(x1, x2) - fmin(x1, x2));
|
|
|
|
|
|
|
|
dest->y = floor(fmin(y1, y2));
|
|
|
|
|
|
|
|
dest->height = ceil(fmax(y1, y2) - fmin(y1, y2));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_box_from_pixman_box32(struct wlr_box *dest, const pixman_box32_t box) {
|
|
|
|
|
|
|
|
*dest = (struct wlr_box){
|
|
|
|
|
|
|
|
.x = box.x1,
|
|
|
|
|
|
|
|
.y = box.y1,
|
|
|
|
|
|
|
|
.width = box.x2 - box.x1,
|
|
|
|
|
|
|
|
.height = box.y2 - box.y1,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|