summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBastien Dejean <nihilhill@gmail.com>2013-06-23 16:02:26 +0200
committerBert Münnich <be.muennich@gmail.com>2013-08-10 15:33:14 +0200
commit7e51c35801f9921685c3acf0d1d17d9370ae4d59 (patch)
tree1af111dd3a1a64ed34d3398ae9029036fb50c15f /image.c
parent68ff9d71f1c9c2e27b2eabea22433f39b7cd98bb (diff)
downloadnsxiv-7e51c35801f9921685c3acf0d1d17d9370ae4d59.tar.zst
Handle 180 degrees image rotation
Diffstat (limited to 'image.c')
-rw-r--r--image.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/image.c b/image.c
index 3230880..b2ac293 100644
--- a/image.c
+++ b/image.c
@@ -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)