[w3m-dev 03330] Re: hang up when seeing web page that contains xbm file
* w3mimg/x11/x11_w3mimg.c (x11_load_image): scaling From: Yuji Abe <cbo46560@pop12.odn.ne.jp>
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2002-10-01 Yuji Abe <cbo46560@pop12.odn.ne.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03330] Re: hang up when seeing web page that contains xbm file
|
||||||
|
* w3mimg/x11/x11_w3mimg.c (x11_load_image): scaling
|
||||||
|
|
||||||
2002-09-30 Yuji Abe <cbo46560@pop12.odn.ne.jp>
|
2002-09-30 Yuji Abe <cbo46560@pop12.odn.ne.jp>
|
||||||
|
|
||||||
* [w3m-dev 03327] gdk-pixbuf support for w3m-img/x11
|
* [w3m-dev 03327] gdk-pixbuf support for w3m-img/x11
|
||||||
@@ -3861,4 +3866,4 @@
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.434 2002/09/29 15:29:12 ukai Exp $
|
$Id: ChangeLog,v 1.435 2002/09/30 17:44:30 ukai Exp $
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: x11_w3mimg.c,v 1.7 2002/09/29 15:29:12 ukai Exp $ */
|
/* $Id: x11_w3mimg.c,v 1.8 2002/09/30 17:44:30 ukai Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -153,6 +153,7 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
ImlibImage *im;
|
ImlibImage *im;
|
||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
int iw, ih;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
@@ -173,10 +174,12 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
pixbuf = gdk_pixbuf_new_from_file(fname);
|
pixbuf = gdk_pixbuf_new_from_file(fname);
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
return 0;
|
return 0;
|
||||||
|
iw = gdk_pixbuf_get_width(pixbuf);
|
||||||
|
ih = gdk_pixbuf_get_height(pixbuf);
|
||||||
if (w <= 0)
|
if (w <= 0)
|
||||||
w = gdk_pixbuf_get_width(pixbuf);
|
w = iw;
|
||||||
if (h <= 0)
|
if (h <= 0)
|
||||||
h = gdk_pixbuf_get_height(pixbuf);
|
h = ih;
|
||||||
#endif
|
#endif
|
||||||
img->pixmap = (void *)XCreatePixmap(xi->display, xi->parent, w, h,
|
img->pixmap = (void *)XCreatePixmap(xi->display, xi->parent, w, h,
|
||||||
DefaultDepth(xi->display, 0));
|
DefaultDepth(xi->display, 0));
|
||||||
@@ -188,9 +191,18 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
Imlib_paste_image(xi->id, im, (Pixmap) img->pixmap, 0, 0, w, h);
|
Imlib_paste_image(xi->id, im, (Pixmap) img->pixmap, 0, 0, w, h);
|
||||||
Imlib_kill_image(xi->id, im);
|
Imlib_kill_image(xi->id, im);
|
||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
gdk_pixbuf_xlib_render_to_drawable(pixbuf, (Drawable) img->pixmap,
|
if (w != iw || h != ih) {
|
||||||
xi->imageGC, 0, 0, 0, 0, w, h,
|
GdkPixbuf *newpixbuf;
|
||||||
XLIB_RGB_DITHER_NORMAL, 0, 0);
|
newpixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, GDK_INTERP_BILINEAR);
|
||||||
|
gdk_pixbuf_xlib_render_to_drawable(newpixbuf, (Drawable) img->pixmap,
|
||||||
|
xi->imageGC, 0, 0, 0, 0, w, h,
|
||||||
|
XLIB_RGB_DITHER_NORMAL, 0, 0);
|
||||||
|
gdk_pixbuf_finalize(newpixbuf);
|
||||||
|
} else {
|
||||||
|
gdk_pixbuf_xlib_render_to_drawable(pixbuf, (Drawable) img->pixmap,
|
||||||
|
xi->imageGC, 0, 0, 0, 0, w, h,
|
||||||
|
XLIB_RGB_DITHER_NORMAL, 0, 0);
|
||||||
|
}
|
||||||
gdk_pixbuf_unref(pixbuf);
|
gdk_pixbuf_unref(pixbuf);
|
||||||
#endif
|
#endif
|
||||||
img->width = w;
|
img->width = w;
|
||||||
|
|||||||
Reference in New Issue
Block a user