Krolyxon
Commit 48700aa

Branches

Refs →

nsxiv48700aa

Revert "Apply flip & rotation on all frames of a multi-frame image; fixes issue #121"

This reverts commit f795273b650a4df39dca693f30c3650ec1d3393f.
Author
Bert Münnich
Date
2014-01-09 20:24 +0100
Parent
f795273
Commit
48700aa6c8f4b9ef6dc162ea5aa98ac4f9cc0630

+11 −30

3 files changed

  1. M image.c +9 −23
  2. M image.h +0 −3
  3. M types.h +2 −4
M image.c View
@@ -337,8 +337,6 @@ bool img_load(img_t *img, const fileinfo_t *file)
337337
338338 img->w = imlib_image_get_width();
339339 img->h = imlib_image_get_height();
340− img->flip = FLIP_NONE;
341− img->rotation = DEGREE_0;
342340 img->scalemode = options->scalemode;
343341 img->re = false;
344342 img->checkpan = false;
@@ -691,14 +689,10 @@ bool img_pan_edge(img_t *img, direction_t dir)
691689 void img_rotate(img_t *img, degree_t d)
692690 {
693691 int ox, oy, tmp;
694− bool reapply = d == -1;
695692
696693 if (img == NULL || img->im == NULL || img->win == NULL)
697694 return;
698695
699− if (reapply)
700− d = img->rotation;
701−
702696 imlib_context_set_image(img->im);
703697 imlib_image_orientate(d);
704698
@@ -714,29 +708,25 @@ void img_rotate(img_t *img, degree_t d)
714708 img->h = tmp;
715709 img->checkpan = true;
716710 }
717− if (!reapply)
718− img->rotation = (img->rotation + d) % 4;
711+
719712 img->dirty = true;
720713 }
721714
722715 void img_flip(img_t *img, flipdir_t d)
723716 {
724− bool reapply = d == -1;
725−
726717 if (img == NULL || img->im == NULL)
727718 return;
728719
729− if (reapply)
730− d = img->flip;
731−
732720 imlib_context_set_image(img->im);
733721
734− if (d & FLIP_HORIZONTAL)
735− imlib_image_flip_horizontal();
736− if (d & FLIP_VERTICAL)
737− imlib_image_flip_vertical();
738− if (!reapply)
739− img->flip ^= d;
722+ switch (d) {
723+ case FLIP_HORIZONTAL:
724+ imlib_image_flip_horizontal();
725+ break;
726+ case FLIP_VERTICAL:
727+ imlib_image_flip_vertical();
728+ break;
729+ }
740730 img->dirty = true;
741731 }
742732
@@ -795,10 +785,6 @@ bool img_frame_goto(img_t *img, int n)
795785 img->checkpan = true;
796786 img->dirty = true;
797787
798− if (img->flip != FLIP_NONE)
799− img_flip(img, -1);
800− if (img->rotation != DEGREE_0)
801− img_rotate(img, -1);
802788 return true;
803789 }
804790
M image.h View
@@ -57,9 +57,6 @@ typedef struct {
5757 bool aa;
5858 bool alpha;
5959
60− flipdir_t flip;
61− degree_t rotation;
62−
6360 Imlib_Color_Modifier cmod;
6461 int gamma;
6562
M types.h View
@@ -39,16 +39,14 @@ typedef enum {
3939 } direction_t;
4040
4141 typedef enum {
42− DEGREE_0 = 0,
4342 DEGREE_90 = 1,
4443 DEGREE_180 = 2,
4544 DEGREE_270 = 3
4645 } degree_t;
4746
4847 typedef enum {
49− FLIP_NONE = 0,
50− FLIP_HORIZONTAL = 1,
51− FLIP_VERTICAL = 2
48+ FLIP_HORIZONTAL,
49+ FLIP_VERTICAL
5250 } flipdir_t;
5351
5452 typedef enum {