commit d92900db6c39d4dbfa6bfbad833fe40750d8d637
parent e7197ec3564510aaa2181d5217c4336815adee54
Author: ukai <ukai>
Date: Mon, 24 Mar 2003 15:45:55 +0000
[w3m-dev 03829] w3mimgdisplay -anim
* w3mimgdisplay.c (maxAnim): added, default 100
(main): add --anim option, w_op->max_anim
* w3mimg/w3mimg.h (w3mimg_op): add max_anim
* w3mimg/fb/fb_gdkpixbuf.c (fb_image_load): add max_anim
* w3mimg/fb/fb_img.h (fb_image_load): add max_anim args
* w3mimg/fb/fb_imlib2.c (fb_image_load): add max_anim args
* w3mimg/fb/fb_w3mimg.c (w3mfb_load_image): pass max_anim
* w3mimg/x11/x11_w3mimg.c (x11_load_image): max_anim
From: Hiroyuki Ito <hito@crl.go.jp>
Diffstat:
8 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,15 @@
+2003-03-25 Hiroyuki Ito <hito@crl.go.jp>
+
+ * [w3m-dev 03829] w3mimgdisplay -anim
+ * w3mimgdisplay.c (maxAnim): added, default 100
+ (main): add --anim option, w_op->max_anim
+ * w3mimg/w3mimg.h (w3mimg_op): add max_anim
+ * w3mimg/fb/fb_gdkpixbuf.c (fb_image_load): add max_anim
+ * w3mimg/fb/fb_img.h (fb_image_load): add max_anim args
+ * w3mimg/fb/fb_imlib2.c (fb_image_load): add max_anim args
+ * w3mimg/fb/fb_w3mimg.c (w3mfb_load_image): pass max_anim
+ * w3mimg/x11/x11_w3mimg.c (x11_load_image): max_anim
+
2003-03-24 Daiki Ueno <ueno@unixuser.org>
* [w3m-dev 03828] possible typo in nextA
diff --git a/w3mimg/fb/fb_gdkpixbuf.c b/w3mimg/fb/fb_gdkpixbuf.c
@@ -27,7 +27,7 @@ get_image_size(char *filename, int *w, int *h)
}
FB_IMAGE **
-fb_image_load(char *filename, int w, int h)
+fb_image_load(char *filename, int w, int h, int max_anim)
{
GdkPixbufAnimation *animation;
GList *frames;
@@ -44,6 +44,9 @@ fb_image_load(char *filename, int w, int h)
fw = gdk_pixbuf_animation_get_width(animation);
fh = gdk_pixbuf_animation_get_height(animation);
n = gdk_pixbuf_animation_get_num_frames(animation);
+ if (max_anim > 0) {
+ n = (max_anim > n)? n : max_anim;
+ }
if (w < 1 || h < 1) {
w = fw;
h = fh;
diff --git a/w3mimg/fb/fb_img.h b/w3mimg/fb/fb_img.h
@@ -3,7 +3,7 @@
#define fb_img_header
#include "fb.h"
-FB_IMAGE **fb_image_load(char *filename, int w, int h);
+FB_IMAGE **fb_image_load(char *filename, int w, int h, int n);
void fb_image_set_bg(int r, int g, int b);
int get_image_size(char *filename, int *w, int *h);
diff --git a/w3mimg/fb/fb_imlib2.c b/w3mimg/fb/fb_imlib2.c
@@ -32,7 +32,7 @@ get_image_size(char *filename, int *w, int *h)
}
FB_IMAGE **
-fb_image_load(char *filename, int w, int h)
+fb_image_load(char *filename, int w, int h, int n)
{
Imlib_Image image;
FB_IMAGE **frame;
diff --git a/w3mimg/fb/fb_w3mimg.c b/w3mimg/fb/fb_w3mimg.c
@@ -67,7 +67,7 @@ w3mfb_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
if (self == NULL)
return 0;
- im = fb_image_load(fname, w, h);
+ im = fb_image_load(fname, w, h, self->max_anim);
if (!im)
return 0;
img->pixmap = im;
diff --git a/w3mimg/w3mimg.h b/w3mimg/w3mimg.h
@@ -16,6 +16,7 @@ typedef struct _w3mimg_op {
void *priv; /* driver specific data */
int width, height; /* window width, height */
int offset_x, offset_y; /* offset */
+ int max_anim;
int (*init) (struct _w3mimg_op * self);
int (*finish) (struct _w3mimg_op * self);
diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c
@@ -294,6 +294,10 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
iw = gdk_pixbuf_animation_get_width(animation);
ih = gdk_pixbuf_animation_get_height(animation);
+ if (self->max_anim > 0) {
+ n = (self->max_anim > n)? n : self->max_anim;
+ }
+
if (w < 1 || h < 1) {
w = iw;
h = ih;
diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c
@@ -17,7 +17,7 @@ static char *defined_size = NULL;
#define MAX_IMAGE 1000
static W3MImage *imageBuf = NULL;
-static int maxImage = 0;
+static int maxImage = 0, maxAnim = 100;
static void GetOption(int argc, char **argv);
static void DrawImage(char *buf, int redraw);
@@ -57,6 +57,7 @@ main(int argc, char **argv)
w_op->offset_x = offset_x;
if (defined_y)
w_op->offset_y = offset_y;
+ w_op->max_anim = maxAnim;
if (defined_test) {
printf("%d %d\n", w_op->width - w_op->offset_x,
@@ -177,6 +178,11 @@ GetOption(int argc, char **argv)
else if (!strcmp("-test", argv[i])) {
defined_test = 1;
}
+ else if (!strcmp("-anim", argv[i])) {
+ if (++i >= argc)
+ exit(1);
+ maxAnim = atoi(argv[i]);
+ }
else if (!strcmp("-size", argv[i])) {
if (++i >= argc)
exit(1);