瀏覽代碼

Merge dwminer/framerate

master
Bert Münnich 8 年之前
父節點
當前提交
c1ba841783
共有 6 個文件被更改,包括 22 次插入4 次删除
  1. +1
    -1
      Makefile
  2. +2
    -0
      image.c
  3. +1
    -0
      image.h
  4. +11
    -3
      options.c
  5. +1
    -0
      options.h
  6. +6
    -0
      sxiv.1

+ 1
- 1
Makefile 查看文件

@@ -1,4 +1,4 @@
VERSION := git-20161030
VERSION := git-20161128

PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man


+ 2
- 0
image.c 查看文件

@@ -68,6 +68,7 @@ void img_init(img_t *img, win_t *win)
img->alpha = ALPHA_LAYER;
img->multi.cap = img->multi.cnt = 0;
img->multi.animate = options->animate;
img->multi.framedelay = options->framerate > 0 ? 1000 / options->framerate : 0;
img->multi.length = 0;

img->cmod = imlib_create_color_modifier();
@@ -263,6 +264,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
img->multi.cap * sizeof(img_frame_t));
}
img->multi.frames[img->multi.cnt].im = im;
delay = img->multi.framedelay > 0 ? img->multi.framedelay : delay;
img->multi.frames[img->multi.cnt].delay = delay > 0 ? delay : DEF_GIF_DELAY;
img->multi.length += img->multi.frames[img->multi.cnt].delay;
img->multi.cnt++;


+ 1
- 0
image.h 查看文件

@@ -35,6 +35,7 @@ typedef struct {
int cnt;
int sel;
bool animate;
int framedelay;
int length;
} multi_img_t;



+ 11
- 3
options.c 查看文件

@@ -32,8 +32,9 @@ const options_t *options = (const options_t*) &_options;

void print_usage(void)
{
printf("usage: sxiv [-abcfhioqrtvZ] [-e WID] [-G GAMMA] [-g GEOMETRY] "
"[-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
printf("usage: sxiv [-abcfhioqrtvZ] [-A FRAMERATE] [-e WID] [-G GAMMA] "
"[-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] "
"FILES...\n");
}

void print_version(void)
@@ -60,6 +61,7 @@ void parse_options(int argc, char **argv)
_options.animate = false;
_options.gamma = 0;
_options.slideshow = 0;
_options.framerate = 0;

_options.fullscreen = false;
_options.embed = 0;
@@ -71,11 +73,17 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = false;
_options.clean_cache = false;

while ((opt = getopt(argc, argv, "abce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
while ((opt = getopt(argc, argv, "A:abce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
exit(EXIT_FAILURE);
case 'A':
n = strtol(optarg, &end, 0);
if (*end != '\0' || n <= 0)
error(EXIT_FAILURE, 0, "Invalid argument for option -A: %s", optarg);
_options.framerate = n;
/* fall through */
case 'a':
_options.animate = true;
break;


+ 1
- 0
options.h 查看文件

@@ -37,6 +37,7 @@ typedef struct {
bool animate;
int gamma;
int slideshow;
int framerate;

/* window: */
bool fullscreen;


+ 6
- 0
sxiv.1 查看文件

@@ -4,6 +4,8 @@ sxiv \- Simple X Image Viewer
.SH SYNOPSIS
.B sxiv
.RB [ \-abcfhioqrtvZ ]
.RB [ \-A
.IR FRAMERATE ]
.RB [ \-e
.IR WID ]
.RB [ \-G
@@ -33,6 +35,10 @@ Please note, that the fullscreen mode requires an EWMH/NetWM compliant window
manager.
.SH OPTIONS
.TP
.BI "\-A " FRAMERATE
Play animations with a constant frame rate set to
.IR FRAMERATE .
.TP
.B \-a
Play animations of multi-frame images.
.TP


Loading…
取消
儲存