diff options
author | Bastien Dejean <nihilhill@gmail.com> | 2013-06-23 16:02:26 +0200 |
---|---|---|
committer | Bert Münnich <be.muennich@gmail.com> | 2013-08-10 15:33:14 +0200 |
commit | 7e51c35801f9921685c3acf0d1d17d9370ae4d59 (patch) | |
tree | 1af111dd3a1a64ed34d3398ae9029036fb50c15f /image.c | |
parent | 68ff9d71f1c9c2e27b2eabea22433f39b7cd98bb (diff) | |
download | nsxiv-7e51c35801f9921685c3acf0d1d17d9370ae4d59.tar.zst |
Handle 180 degrees image rotation
Diffstat (limited to 'image.c')
-rw-r--r-- | image.c | 25 |
1 files changed, 9 insertions, 16 deletions
@@ -663,29 +663,22 @@ void img_rotate(img_t *img, int d) oy = d == 3 ? img->y : win->h - img->y - img->h * img->zoom; imlib_context_set_image(img->im); + /* rotates by `90 * d` degrees in the clockwise direction */ imlib_image_orientate(d); - img->x = oy + (win->w - win->h) / 2; - img->y = ox + (win->h - win->w) / 2; + if (d == 1 || d == 3) { + img->x = oy + (win->w - win->h) / 2; + img->y = ox + (win->h - win->w) / 2; - tmp = img->w; - img->w = img->h; - img->h = tmp; + tmp = img->w; + img->w = img->h; + img->h = tmp; + img->checkpan = true; + } - img->checkpan = true; img->dirty = true; } -void img_rotate_left(img_t *img) -{ - img_rotate(img, 3); -} - -void img_rotate_right(img_t *img) -{ - img_rotate(img, 1); -} - void img_flip(img_t *img, flipdir_t d) { if (img == NULL || img->im == NULL) |