From 4c40cc24bc6b3e11fc9e6cf337ddb035fa750eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sun, 6 May 2012 13:02:34 +0200 Subject: Slightly refactored flipping --- image.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'image.c') diff --git a/image.c b/image.c index 2267204..cb71efa 100644 --- a/image.c +++ b/image.c @@ -642,24 +642,21 @@ void img_rotate_right(img_t *img) { img_rotate(img, 1); } -void img_flip(img_t *img, int f) { - if (img == NULL || img->im == NULL || img->win == NULL) +void img_flip(img_t *img, flipdir_t d) { + if (img == NULL || img->im == NULL) return; imlib_context_set_image(img->im); - if (f == 0) - imlib_image_flip_horizontal(); - else - imlib_image_flip_vertical(); - img->dirty = true; -} - -void img_flip_horizontal(img_t *img) { - img_flip(img, 0); -} -void img_flip_vertical(img_t *img) { - img_flip(img, 1); + switch (d) { + case FLIP_HORIZONTAL: + imlib_image_flip_horizontal(); + break; + case FLIP_VERTICAL: + imlib_image_flip_vertical(); + break; + } + img->dirty = true; } void img_toggle_antialias(img_t *img) { -- cgit v1.2.3