Refactored remote changes
This commit is contained in:
parent
078136d217
commit
ab28c9a8b9
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
VERSION = git-20131213
|
VERSION = git-20131231
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
MANPREFIX = $(PREFIX)/share/man
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
@ -43,7 +43,7 @@ static const float zoom_levels[] = {
|
|||||||
enum {
|
enum {
|
||||||
GIF_DELAY = 100, /* delay time (in ms) */
|
GIF_DELAY = 100, /* delay time (in ms) */
|
||||||
GIF_AUTOPLAY = 1, /* autoplay when loaded [0/1] */
|
GIF_AUTOPLAY = 1, /* autoplay when loaded [0/1] */
|
||||||
GIF_LOOP = -1 /* endless loop [0 / 1 / -1=as specified in file] */
|
GIF_LOOP = 0 /* loop? [0: no, 1: endless, -1: as specified in file] */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* gamma correction: the user-visible ranges [-GAMMA_RANGE, 0] and
|
/* gamma correction: the user-visible ranges [-GAMMA_RANGE, 0] and
|
||||||
|
31
image.c
31
image.c
@ -83,8 +83,7 @@ void img_init(img_t *img, win_t *win)
|
|||||||
img->alpha = !RENDER_WHITE_ALPHA;
|
img->alpha = !RENDER_WHITE_ALPHA;
|
||||||
img->multi.cap = img->multi.cnt = 0;
|
img->multi.cap = img->multi.cnt = 0;
|
||||||
img->multi.animate = false;
|
img->multi.animate = false;
|
||||||
img->multi.anim_repeats = -1;
|
img->multi.repeat = 0;
|
||||||
img->multi.repeats_currently_left = 0;
|
|
||||||
|
|
||||||
img->cmod = imlib_create_color_modifier();
|
img->cmod = imlib_create_color_modifier();
|
||||||
img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
|
img->gamma = MIN(MAX(options->gamma, -GAMMA_RANGE), GAMMA_RANGE);
|
||||||
@ -146,8 +145,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
|
|||||||
}
|
}
|
||||||
img->multi.cnt = 0;
|
img->multi.cnt = 0;
|
||||||
img->multi.sel = 0;
|
img->multi.sel = 0;
|
||||||
img->multi.anim_repeats = -1;
|
img->multi.repeat = 0;
|
||||||
img->multi.repeats_currently_left = 0;
|
|
||||||
|
|
||||||
#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
|
#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
|
||||||
gif = DGifOpenFileName(file->path, NULL);
|
gif = DGifOpenFileName(file->path, NULL);
|
||||||
@ -174,7 +172,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
|
|||||||
|
|
||||||
DGifGetExtension(gif, &ext_code, &ext);
|
DGifGetExtension(gif, &ext_code, &ext);
|
||||||
while (ext) {
|
while (ext) {
|
||||||
if (ext_code == 0xf9) { /*Graphics Control Extension*/
|
if (ext_code == GRAPHICS_EXT_FUNC_CODE) {
|
||||||
if (ext[1] & 1)
|
if (ext[1] & 1)
|
||||||
transp = (int) ext[4];
|
transp = (int) ext[4];
|
||||||
else
|
else
|
||||||
@ -185,15 +183,11 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
|
|||||||
delay = MAX(delay, MIN_GIF_DELAY);
|
delay = MAX(delay, MIN_GIF_DELAY);
|
||||||
|
|
||||||
disposal = (unsigned int) ext[1] >> 2 & 0x7;
|
disposal = (unsigned int) ext[1] >> 2 & 0x7;
|
||||||
} else if (ext_code == 0xff) { /*Application Extension*/
|
} else if (ext_code == APPLICATION_EXT_FUNC_CODE) {
|
||||||
if(ext[0] == 11 && memcmp(ext+1, "NETSCAPE2.0", 11) == 0) {
|
if (ext[0] == 11 && memcmp(ext+1, "NETSCAPE2.0", 11) == 0) {
|
||||||
DGifGetExtensionNext(gif, &ext);
|
DGifGetExtensionNext(gif, &ext);
|
||||||
|
if (ext && ext[0] == 3 && ext[1] == 1)
|
||||||
if(ext && ext[0] == 3 && ext[1] == 1) {
|
img->multi.repeat = ((int) ext[3] << 8 | (int) ext[2]) - 1;
|
||||||
img->multi.repeats_currently_left =
|
|
||||||
img->multi.anim_repeats =
|
|
||||||
((unsigned int) ext[3] << 8 | (unsigned int) ext[2]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext = NULL;
|
ext = NULL;
|
||||||
@ -811,15 +805,12 @@ bool img_frame_animate(img_t *img, bool restart)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (img->multi.sel + 1 >= img->multi.cnt) {
|
if (img->multi.sel + 1 >= img->multi.cnt) {
|
||||||
if (GIF_LOOP == 1 || (GIF_LOOP == -1 && img->multi.anim_repeats == 0) ) {
|
if (restart || GIF_LOOP == 1) {
|
||||||
img_frame_goto(img, 0);
|
img_frame_goto(img, 0);
|
||||||
} else if(restart) {
|
} else if (GIF_LOOP == -1 && img->multi.repeat != 0) {
|
||||||
|
if (img->multi.repeat > 0)
|
||||||
|
img->multi.repeat--;
|
||||||
img_frame_goto(img, 0);
|
img_frame_goto(img, 0);
|
||||||
img->multi.repeats_currently_left =
|
|
||||||
(img->multi.anim_repeats != -1 ? img->multi.anim_repeats : 0);
|
|
||||||
} else if(GIF_LOOP == -1 && img->multi.repeats_currently_left != 0) {
|
|
||||||
img_frame_goto(img, 0);
|
|
||||||
--img->multi.repeats_currently_left;
|
|
||||||
} else {
|
} else {
|
||||||
img->multi.animate = false;
|
img->multi.animate = false;
|
||||||
return false;
|
return false;
|
||||||
|
3
image.h
3
image.h
@ -35,8 +35,7 @@ typedef struct {
|
|||||||
int cnt;
|
int cnt;
|
||||||
int sel;
|
int sel;
|
||||||
bool animate;
|
bool animate;
|
||||||
int anim_repeats; // -1=don't repeat, 0=repeat infinitely, N=repeat N times
|
int repeat;
|
||||||
unsigned int repeats_currently_left;
|
|
||||||
} multi_img_t;
|
} multi_img_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user