This commit is contained in:
Sebastian Ramacher 2023-12-08 23:27:34 +01:00
parent eb2d8ea769
commit dbdcba3453

View file

@ -100,34 +100,29 @@ void document_index_build(GtkTreeModel* model, GtkTreeIter* parent, girara_tree_
} }
} }
zathura_rectangle_t zathura_rectangle_t rotate_rectangle(zathura_rectangle_t rectangle, unsigned int degree, double height, double width) {
rotate_rectangle(zathura_rectangle_t rectangle, unsigned int degree, double height, double width)
{
zathura_rectangle_t tmp; zathura_rectangle_t tmp;
switch (degree) { switch (degree) {
case 90: case 90:
tmp.x1 = height - rectangle.y2; tmp.x1 = height - rectangle.y2;
tmp.x2 = height - rectangle.y1; tmp.x2 = height - rectangle.y1;
tmp.y1 = rectangle.x1; tmp.y1 = rectangle.x1;
tmp.y2 = rectangle.x2; tmp.y2 = rectangle.x2;
break; break;
case 180: case 180:
tmp.x1 = width - rectangle.x2; tmp.x1 = width - rectangle.x2;
tmp.x2 = width - rectangle.x1; tmp.x2 = width - rectangle.x1;
tmp.y1 = height - rectangle.y2; tmp.y1 = height - rectangle.y2;
tmp.y2 = height - rectangle.y1; tmp.y2 = height - rectangle.y1;
break; break;
case 270: case 270:
tmp.x1 = rectangle.y1; tmp.x1 = rectangle.y1;
tmp.x2 = rectangle.y2; tmp.x2 = rectangle.y2;
tmp.y1 = width - rectangle.x2; tmp.y1 = width - rectangle.x2;
tmp.y2 = width - rectangle.x1; tmp.y2 = width - rectangle.x1;
break; break;
default: default:
tmp.x1 = rectangle.x1; return rectangle;
tmp.x2 = rectangle.x2;
tmp.y1 = rectangle.y1;
tmp.y2 = rectangle.y2;
} }
return tmp; return tmp;