From dbdcba3453f7e428f9d41d41613b39757ec40f9a Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 8 Dec 2023 23:27:34 +0100 Subject: [PATCH] Refactor --- zathura/utils.c | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/zathura/utils.c b/zathura/utils.c index 7067392..802757f 100644 --- a/zathura/utils.c +++ b/zathura/utils.c @@ -100,34 +100,29 @@ void document_index_build(GtkTreeModel* model, GtkTreeIter* parent, girara_tree_ } } -zathura_rectangle_t -rotate_rectangle(zathura_rectangle_t rectangle, unsigned int degree, double height, double width) -{ +zathura_rectangle_t rotate_rectangle(zathura_rectangle_t rectangle, unsigned int degree, double height, double width) { zathura_rectangle_t tmp; switch (degree) { - case 90: - tmp.x1 = height - rectangle.y2; - tmp.x2 = height - rectangle.y1; - tmp.y1 = rectangle.x1; - tmp.y2 = rectangle.x2; - break; - case 180: - tmp.x1 = width - rectangle.x2; - tmp.x2 = width - rectangle.x1; - tmp.y1 = height - rectangle.y2; - tmp.y2 = height - rectangle.y1; - break; - case 270: - tmp.x1 = rectangle.y1; - tmp.x2 = rectangle.y2; - tmp.y1 = width - rectangle.x2; - tmp.y2 = width - rectangle.x1; - break; - default: - tmp.x1 = rectangle.x1; - tmp.x2 = rectangle.x2; - tmp.y1 = rectangle.y1; - tmp.y2 = rectangle.y2; + case 90: + tmp.x1 = height - rectangle.y2; + tmp.x2 = height - rectangle.y1; + tmp.y1 = rectangle.x1; + tmp.y2 = rectangle.x2; + break; + case 180: + tmp.x1 = width - rectangle.x2; + tmp.x2 = width - rectangle.x1; + tmp.y1 = height - rectangle.y2; + tmp.y2 = height - rectangle.y1; + break; + case 270: + tmp.x1 = rectangle.y1; + tmp.x2 = rectangle.y2; + tmp.y1 = width - rectangle.x2; + tmp.y2 = width - rectangle.x1; + break; + default: + return rectangle; } return tmp;