rpms/xzgv/F-10 xzgv-0.9-fix-thumbnail-generation.patch, NONE, 1.1 xzgv-0.9-svn-r41.patch, NONE, 1.1 xzgv-0.9-thumbnail-load-gcc4.patch, NONE, 1.1 xzgv.spec, 1.7, 1.8
Hans de Goede
jwrdegoede at fedoraproject.org
Sat Jan 10 14:44:14 UTC 2009
Author: jwrdegoede
Update of /cvs/extras/rpms/xzgv/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1232
Modified Files:
xzgv.spec
Added Files:
xzgv-0.9-fix-thumbnail-generation.patch xzgv-0.9-svn-r41.patch
xzgv-0.9-thumbnail-load-gcc4.patch
Log Message:
* Sat Jan 10 2009 Hans de Goede <hdegoede at redhat.com> - 0.9-5
- Update to latest upstream svn (r41) fixing several crashes
- Add a patch fixing thumbnail loading
- Add a patch fixing thumbnail generation for pictures where
the width is not a multiple of 4
- Add a patch fixing thumbnail generation for pictures which have an alpha
channel
- Fix scriptlet error on uninstall (make it preun instead of postun)
xzgv-0.9-fix-thumbnail-generation.patch:
--- NEW FILE xzgv-0.9-fix-thumbnail-generation.patch ---
--- xzgv-0.9/src/backend.c 2007-09-09 02:37:14.000000000 +0200
+++ xzgv-0.9.new/src/backend.c 2009-01-09 17:26:29.000000000 +0100
@@ -91,6 +91,8 @@
image->rgb=gdk_pixbuf_get_pixels(BACKEND_IMAGE(image));
image->w=gdk_pixbuf_get_width(BACKEND_IMAGE(image));
image->h=gdk_pixbuf_get_height(BACKEND_IMAGE(image));
+image->stride=gdk_pixbuf_get_rowstride(BACKEND_IMAGE(image));
+image->has_alpha=gdk_pixbuf_get_has_alpha(BACKEND_IMAGE(image));
}
--- xzgv-0.9/src/backend.h 2007-09-09 02:49:12.000000000 +0200
+++ xzgv-0.9.new/src/backend.h 2009-01-09 17:25:47.000000000 +0100
@@ -8,6 +8,8 @@
{
unsigned char *rgb; /* raw RGB data */
int w,h; /* width/height */
+ int stride;
+ int has_alpha;
void *backend_image; /* backend's image type (opaque) */
void *backend_ext; /* any extra info needed by backend (opaque) */
};
--- xzgv-0.9/src/resizepic.c 2007-08-11 20:08:41.000000000 +0200
+++ xzgv-0.9.new/src/resizepic.c 2009-01-09 17:15:28.000000000 +0100
@@ -22,7 +22,7 @@
* which should then be reduced more nicely for the thumbnail.
*/
unsigned char *nasty_resizepic(unsigned char *theimage,
- int width,int height,int *sw_ask,int *sh_ask)
+ int width,int height,int stride, int *sw_ask,int *sh_ask)
{
int x,y,yp,yw,sw,sh,lastyp,scrnwide,scrnhigh;
unsigned char *rline,*outimage;
@@ -60,9 +60,9 @@
rline=outimage+yp*sw*3;
if(yp!=lastyp)
{
- yw=y*width;
- for(x=0;x<width;x++,yw++)
- memcpy(rline+(x*sw)/width*3,theimage+yw*3,3);
+ yw=y*stride;
+ for(x=0;x<width;x++,yw+=3)
+ memcpy(rline+(x*sw)/width*3,theimage+yw,3);
lastyp=yp;
}
}
@@ -80,10 +80,10 @@
* new width x height in put back in sw_ask and sh_ask
*/
unsigned char *resizepic(unsigned char *theimage,
- int width,int height,int *sw_ask,int *sh_ask,
+ int width,int height, int stride, int *sw_ask,int *sh_ask,
int allow_crunch)
{
-int a,b,x,y,yp,yw,sw,sh,lastyp;
+int a,b,x,y,yp,sw,sh,lastyp;
int c,pixwide,pixhigh;
int scrnwide,scrnhigh;
unsigned char *rline;
@@ -98,7 +98,7 @@
{
int our_sw_ask=TN_CRUNCH_WIDTH,our_sh_ask=TN_CRUNCH_HEIGHT;
- crunched=nasty_resizepic(theimage,width,height,&our_sw_ask,&our_sh_ask);
+ crunched=nasty_resizepic(theimage,width,height,stride,&our_sw_ask,&our_sh_ask);
/* if it worked, replace orig w/h with crunched pic's one, and
* set theimage to point to it.
@@ -106,6 +106,7 @@
if(crunched)
{
width=our_sw_ask;
+ stride=our_sw_ask*3;
height=our_sh_ask;
theimage=crunched;
}
@@ -142,15 +143,14 @@
yp=(y*sh)/height;
if(yp!=lastyp)
{
- yw=y*width;
/* we try to resample it a bit */
- for(x=0;x<width;x++,yw++)
+ for(x=0;x<width;x++)
{
tr=tg=tb=tn=0;
for(b=0;(b<pixhigh)&&(y+b<height);b++)
for(a=0;(a<pixwide)&&(x+a<width);a++)
{
- tmp2=(yw+a+b*width)*3;
+ tmp2=(y + b) * stride + (x + a) * 3;
tr+=theimage[tmp2 ];
tg+=theimage[tmp2+1];
tb+=theimage[tmp2+2];
@@ -173,7 +173,7 @@
for(y=0;y<height;y++)
for(x=0;x<width;x++)
{
- c=(y*width+x)*3;
+ c = y * stride + x * 3;
rline[3*(y*scrnwide+x) ]=theimage[c ];
rline[3*(y*scrnwide+x)+1]=theimage[c+1];
rline[3*(y*scrnwide+x)+2]=theimage[c+2];
--- xzgv-0.9/src/resizepic.h 2007-08-11 18:52:03.000000000 +0200
+++ xzgv-0.9.new/src/resizepic.h 2009-01-06 23:01:36.000000000 +0100
@@ -6,4 +6,4 @@
extern unsigned char *resizepic(unsigned char *theimage,
- int width,int height,int *sw_ask,int *sh_ask,int allow_crunch);
+ int width,int height, int stride, int *sw_ask,int *sh_ask,int allow_crunch);
--- xzgv-0.9/src/updatetn.c 2007-08-11 20:08:41.000000000 +0200
+++ xzgv-0.9.new/src/updatetn.c 2009-01-10 14:30:42.000000000 +0100
@@ -77,10 +77,9 @@
unsigned char **xvpic_data,int *wp,int *hp,int *written_ok_ptr)
{
FILE *out;
-int w,h,y;
+int w,h,x,y;
unsigned char *smallpic;
xzgv_image *origpic;
-int width,height;
int origw,origh;
int allow_crunch=1;
int written_ok=0;
@@ -95,10 +94,23 @@
if(origpic->w!=origw || origpic->h!=origh)
allow_crunch=0;
+if (origpic->has_alpha)
+ /* Bummer we've got RGBA pixel data but all the other code expects packed
+ RGB data, so convert it. */
+ for (y = 0; y < origh; y++)
+ for (x = 0; x < origw; x++)
+ {
+ origpic->rgb[y * origpic->stride + x * 3] =
+ origpic->rgb[y * origpic->stride + x * 4];
+ origpic->rgb[y * origpic->stride + x * 3 + 1] =
+ origpic->rgb[y * origpic->stride + x * 4 + 1];
+ origpic->rgb[y * origpic->stride + x * 3 + 2] =
+ origpic->rgb[y * origpic->stride + x * 4 + 2];
+ }
+
/* resize */
w=80; h=60;
-smallpic=resizepic(origpic->rgb,
- width=origpic->w,height=origpic->h,&w,&h,
+smallpic=resizepic(origpic->rgb, origw, origh, origpic->stride, &w,&h,
allow_crunch);
backend_image_destroy(origpic); /* finished with this */
xzgv-0.9-svn-r41.patch:
--- NEW FILE xzgv-0.9-svn-r41.patch ---
diff -up xzgv-0.9/Makefile.foo xzgv-0.9/Makefile
--- xzgv-0.9/Makefile.foo 2007-09-09 20:12:48.000000000 +0200
+++ xzgv-0.9/Makefile 2009-01-10 15:20:11.000000000 +0100
@@ -42,9 +42,9 @@ doc/xzgv.1: doc/xzgv.texi doc/makeman.aw
# Like in GNU stuff, info files aren't automatically remade,
# as I don't want to assume everyone has texinfo's `makeinfo' handy.
-info: doc/xzgv.gz
+info: doc/xzgv.info.gz
-doc/xzgv.gz: doc/xzgv.texi
+doc/xzgv.info.gz: doc/xzgv.texi
cd doc && $(MAKE) info
clean:
@@ -52,6 +52,11 @@ clean:
cd doc && $(MAKE) clean
$(RM) *~
+realclean:
+ cd src && $(MAKE) realclean
+ cd doc && $(MAKE) realclean
+ $(RM) *~
+
install: all
cd src && $(MAKE) install
cd doc && $(MAKE) install
diff -up xzgv-0.9/doc/Makefile.foo xzgv-0.9/doc/Makefile
--- xzgv-0.9/doc/Makefile.foo 2007-09-09 20:27:58.000000000 +0200
+++ xzgv-0.9/doc/Makefile 2009-01-10 15:20:11.000000000 +0100
@@ -10,12 +10,12 @@ include ../config.mk
all: info man
-info: xzgv.gz
+info: xzgv.info.gz
dvi: xzgv.dvi
-xzgv.gz: xzgv.texi
- makeinfo xzgv.texi
- gzip -f xzgv
+xzgv.info.gz: xzgv.texi
+ makeinfo --no-split xzgv.texi
+ gzip -9f xzgv.info
# `-c' removes the huge number of associated files created by TeX.
# This saves doing a `make clean' from hell. :-)
@@ -38,16 +38,20 @@ installdirs:
install: installdirs
install xzgv.1 $(MANDIR)
- install xzgv.gz $(INFODIR)
- install-info --infodir=$(INFODIR) xzgv.gz
+ install -m 644 xzgv.info.gz $(INFODIR)
+ install-info --infodir=$(INFODIR) xzgv.info.gz
uninstall:
$(RM) $(MANDIR)/xzgv.1
$(RM) $(INFODIR)/xzgv.gz
- install-info --remove xzgv
+ install-info --remove xzgv.info.gz
# This *doesn't* remove the Info files, which should stick around to
# be included in the distribution. Ditto for the man page, since
# building it requires gawk.
clean:
$(RM) *~ xzgv.dvi
+
+realclean: clean
+ $(RM) xzgv.1 xzgv.info.gz
+
diff -up xzgv-0.9/doc/xzgv.texi.foo xzgv-0.9/doc/xzgv.texi
--- xzgv-0.9/doc/xzgv.texi.foo 2007-09-09 20:27:28.000000000 +0200
+++ xzgv-0.9/doc/xzgv.texi 2009-01-10 15:20:11.000000000 +0100
@@ -1,6 +1,6 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
- at setfilename xzgv
+ at setfilename xzgv.info
@settitle The xzgv manual
@setchapternewpage odd
@c %**end of header
@@ -47,6 +47,7 @@ The xzgv manual, for version @value{VERS
@value{UPDATED}.
Copyright 1999-2001 Russell Marks.
+Copyright 2007 Reuben Thomas.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -74,12 +75,13 @@ approved by the Free Software Foundation
@title xzgv
@subtitle A picture viewer for X, with thumbnail-based file selector
@subtitle version @value{VERSION}
- at author Russell Marks
+ at author Russell Marks and Reuben Thomas
@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1999-2001 Russell Marks.
+Copyright @copyright{} 2007 Reuben Thomas.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -149,8 +151,7 @@ The thumbnails used (thumbnails being sm
pictures) are compatible with xv, zgv, and the Gimp. The kinds of
pictures xzgv allows to be viewed are raster-format pictures (sometimes
called `bitmaps' and/or `pixmaps'); things like GIF files, JPEG files,
-PNG files, and so on. (Details of file formats supported are given
-elsewhere. @xref{Supported File Formats}.)
+PNG files, and so on.
Most of the time, you will probably want to use xzgv's file selector
(@pxref{The File Selector}) to pick which file(s) to view. This is what
@@ -192,17 +193,11 @@ xzgv. xzgv can do a lot more; read on to
@c first, direct (or direct-ish :-)) xzgv contributions:
xzgv was primarily written by Russell Marks, also the author of this
-manual.
+manual. It is maintained by Reuben Thomas.
Costa Sapuntzakis contributed code for much faster JPEG thumbnail
generation (to zgv, which I adapted for xzgv).
- at c this isn't really `direct', but I think it belongs here.
- at code{install-info} is a (very) slightly modified version of the
-original (which is part of the @code{texinfo} package). This program is
-used during installation. I think it was mostly written by Karl Berry,
-but it's not terribly clear.
-
The directory/file icons used were loosely based on gmc's
@file{dir-close.xpm}. I think Tuomas Kuosmanen was responsible for
that, judging from the change log.
@@ -213,28 +208,12 @@ was written by Noah Friedman. (This is a
@c now libraries etc.:
Huge thanks go to the many people responsible for GTK+, without which
-xzgv would almost certainly not have happened. Thanks also to the
-Rasterman (Carsten Haiztler) for Imlib, without which xzgv would most
-likely have been a complete pain to write. (But no thanks for Electric
-Eyes, which was nearly nice enough for me not to bother with xzgv at
-all! :-))
-
-This program is based in part on the work of the Independent JPEG
-Group. (I don't think I actually need this line any more, but I like
-giving these guys a credit, it's a neat library. :-))
-
-xzgv uses (or rather it does if @code{INTERP_MMX} was defined when
-compiling, and if it's running on an MMX-capable CPU) MMX instructions
-for interpolation, with the help of libmmx, by Hank Dietz and Randy
-Fisher.
+xzgv would almost certainly not have happened. (But no thanks for
+Electric Eyes, which was nearly nice enough for me not to bother with
+xzgv at all! :-))
@file{getopt*.[ch]} are from the GNU libc.
-``The Graphics Interchange Format(c) is the Copyright property of
-CompuServe Incorporated. GIF(sm) is a Service Mark property of
-CompuServe Incorporated.''
-
-
@node Invoking xzgv, A Note on Notation, Acknowledgements, Top
@comment node-name, next, previous, up
@chapter Invoking xzgv
@@ -300,11 +279,6 @@ Here's what the options do:
Automatically hide selector when a picture is selected, allowing the
viewer to use the whole window.
- at c I would never have defaulted to the fast/sloppy method if given
- at c a choice, but Imlib1 did it without my knowing, such that when
- at c I started reading JPEGs natively, I `had' to do it this way
- at c around to avoid apparently gratuitous slowdown. :-(
- at c
@vindex careful-jpeg
@item --careful-jpeg
Enable libjpeg `fancy upsampling'. xzgv defaults to using the faster
@@ -322,10 +296,9 @@ override.)
@vindex dither-hicol
@item --dither-hicol
-Use dithering in 15/16-bit, whatever Imlib's default setting is.
+Use dithering in 15/16-bit, whatever the default setting is.
@xref{Viewer Options}, for a discussion of benefits/drawbacks. You can
-also use @code{--dither-hicol=off} to disable this if Imlib normally has
-it enabled.
+also use @code{--dither-hicol=off} to disable this.
@vindex exif-orient
@item --exif-orient
@@ -503,10 +476,7 @@ If started with @code{xzgv @var{files}},
and treats the file or files as if they were the sole contents of a
directory. (It also automatically loads the first file.) As such, you
can use the Next Image and Previous Image commands to navigate between
-the images, or do Exit to Selector and use the selector directly. (By
-the way, running like this also makes it possible to view files without
-the usual extensions such as @file{.gif}, etc. @xref{File Type
-Identification}.)
+the images, or do Exit to Selector and use the selector directly.
If started with @code{xzgv @var{start-dir}}, xzgv starts up as usual,
but with the selector starting on the directory specified (rather than
@@ -830,13 +800,13 @@ move around the list, but it reads them
The thumbnails used in xzgv require 256 colours to display. This can be
a problem if you're running X in 256 colours or less as, even if you're
running an 8-bit (256 colour) server, there will almost inevitably be
-fewer colours available. Currently, xzgv just uses whatever Imlib
+fewer colours available. Currently, xzgv just uses whatever gdk
reports as the closest match to each individual colour used in
thumbnails. This gives a tolerable result on 8-bit servers, assuming
-Imlib was able to allocate a large number of colours; however, it gives
+gdk was able to allocate a large number of colours; however, it gives
terrible results if it couldn't, or if running on 4-bit or 1-bit
servers. Sorry about this --- it should be fixed in future (either by
-using Imlib to draw the thumbnail pixmaps, or by dithering them `by
+using gdk to draw the thumbnail pixmaps, or by dithering them `by
hand' to suit the colours available).
@item
@@ -2548,14 +2518,13 @@ and see. (No keyboard shortcut --- see a
@cindex pictures, file formats used by
Picture files are stored in a variety of different forms, or `file
-formats'. xzgv, via Imlib, supports many.
+formats'. xzgv, via gdk, supports many.
@menu
* File Type Identification:: How xzgv identifies the type of a file.
-* Supported File Formats:: The file formats that xzgv supports.
@end menu
- at node File Type Identification, Supported File Formats, File Formats, File Formats
+ at node File Type Identification, , File Formats, File Formats
@comment node-name, next, previous, up
@section File Type Identification
@@ -2564,120 +2533,13 @@ formats'. xzgv, via Imlib, supports many
@cindex picture format, identification of
@cindex file format, identification of
-The format a file is in is identified in two different ways. The file
-selector picks filenames to display based on the `extension' --- for
-instance, if a filename ends in @file{.jpg} or @file{.jpeg}, xzgv assumes
-it is a JPEG. This way of working is not always right, but it's much
-faster than the alternative (reading part of every single file) and is
-usually sufficient.
-
-The file-reading code relies on Imlib to determine the file type and
-read the file correctly; generally this uses the format's `magic number'
-to determine file type --- e.g. a JPEG/JFIF file starts with the (hex)
-bytes @code{FF D8}. So if you start xzgv with @samp{xzgv foo}, and foo
-is in a format supported by Imlib (such as JPEG), the format will be
-figured out and the file loaded even though the `extension' is absent.
-
-One extension to this is xzgv's built-in support for my relatively
-obscure `mrf' format. :-) Since there's probably not much interest in
-supporting this in Imlib, and it's really quite a simple format, it's
-not unreasonable for xzgv to support this directly. But xzgv acts as if
-Imlib supported mrf, so this distinction can be largely ignored.
-
-In fact, xzgv is gradually moving towards reading several of the more
-popular formats natively, as part of an attempt to avoid being tied to a
-single image rendering/loading backend; at the time of writing, GIF,
-JPEG, PNG, and TIFF are also read in this way.
-
-
- at node Supported File Formats, , File Type Identification, File Formats
- at comment node-name, next, previous, up
- at section Supported File Formats
-
- at cindex supported file formats
- at cindex file formats, supported
- at cindex types of picture supported
- at cindex GIF
- at cindex JPEG
- at cindex PNG
- at cindex PBM
- at cindex PGM
- at cindex PPM
- at cindex PNM
- at cindex TGA
- at cindex Targa
- at cindex PCX
- at cindex mrf
- at cindex PRF
- at cindex XBM
- at cindex bitmaps, X
- at cindex XPM
- at cindex pixmaps, X
- at cindex TIFF
- at cindex TIM
- at cindex XWD
-
-xzgv supports the following file formats:
-
- at itemize @bullet
- at item
-GIF.
-
- at item
-JPEG.
-
- at item
-PNG.
-
- at item
-PBM/PGM/PPM, collectively known as `PNM'. This is a nice simple format
-used by pbmplus and netpbm.
-
- at item
-BMP.
-
- at item
-TGA (Targa).
-
- at item
-PCX.
-
- at item
-mrf. Mrf files can be converted to/from PBM with mrftopbm/pbmtomrf, and
-the format is documented in the @cite{mrf(5)} man page.
-
- at item
-PRF. PRF is an extension of mrf, similarly converted with
-prftopnm/pnmtoprf, and documented in the @cite{prf(5)} man page.
-
- at item
-XBM (X bitmap files).
-
- at item
-XPM.
-
- at item
-TIFF.
-
- at item
-TIM. This is an image format used (on the Sony PlayStation) by some
-games (e.g. Wipeout) for storing 2D images.
-
- at item
-XWD (X window dumps, as produced by xwd).
-
- at c [XXX xzgv doesn't support these as files yet (will need yet more
- at c Imlib-bypassing code, sigh), and doesn't treat them as their own
- at c thumbnails]
- at c Xv format thumbnail files. Normally you won't want to view these other
- at c than in the file selector, but xzgv lets you view them as normal picture
- at c files if you want. Note that in the file selector, thumbnail files are
- at c indistinguishable from the files they represent (other than the
- at c @file{.xvpics} in the directory's filename) --- they have the same
- at c filenames, and thumbnails are their own thumbnails. :-)
-
- at end itemize
-
+The format a file is in is identified by its content. The file-reading
+code relies on libgdk to determine the file type and read the file
+correctly; generally this uses the format's `magic number' to determine
+file type --- e.g. a JPEG/JFIF file starts with the (hex) bytes @code{FF
+D8}. So if you start xzgv with @samp{xzgv foo}, and foo is in a
+supported format (such as JPEG), the format will be figured out and the
+file loaded even though the `extension' is absent.
@node Configuring xzgv, Rationale, File Formats, Top
@comment node-name, next, previous, up
@@ -3037,8 +2899,8 @@ hiding/showing selector or resizing from
I kludged it :-)).
@item
-When scaling up and imlib is dithering, you end up with a crappy-looking
-picture if you drag the picture around slowly (since each exposed bit is
+When scaling up and dithering, you end up with a crappy-looking picture
+if you drag the picture around slowly (since each exposed bit is
dithered independently, with no regard given to matching up to any
previous error-diffusion).
@@ -3060,10 +2922,10 @@ window-splitting bit, but I'm not sure.
across scrollbar sliders and the paned window splitter handle.
@item
-It doesn't apply any tranparency mask returned by imlib. The practical
-result of this seems to be purple transparent bits in thumbnails and
-scaled-up images, and black transparent bits elsewhere. This doesn't
-affect PNG files, though.
+It doesn't apply any tranparency mask. The practical result of this
+seems to be purple transparent bits in thumbnails and scaled-up images,
+and black transparent bits elsewhere. This doesn't affect PNG files,
+though.
@item
If a GIF file is corrupted in such a way that the decompressed image
@@ -3089,13 +2951,7 @@ nature, see xzgv''. :-)
@itemize @minus
@item
Thumbnails are given an accurate width/height `IMGINFO' comment, but are
-always claimed to be "RGB", as Imlib doesn't provide any way to find out
-what type they are.
-
- at item
-xzgv should have an option to treat all files as images, since it
-currently applies a zgv-like file extension filter. This is a bit
-inflexible, given that Imlib supports `all' formats.
+always claimed to be "RGB".
@item
xzgv @emph{doesn't} duplicate zgv's behaviour of generating thumbnails
@@ -3115,9 +2971,6 @@ suboptimal, but as an incompatibility wi
@itemize @minus
@item
-GIF89a extension blocks are ignored.
-
- at item
Only the first image of a multiple-image GIF is used. (These days,
multiple-image GIFs are usually animations.)
@end itemize
@@ -3148,11 +3001,8 @@ Here are some details you should include
The version of xzgv you are running. @code{xzgv --version} reports this.
@item
-The versions of GTK+ and Imlib you are using. @code{xzgv --version-gtk}
-reports the GTK+ version being used by xzgv, but Imlib is a little more
-tricky --- @code{imlib-config --version} should work if you have a full
-Imlib installation, but failing that, try @code{ls -l
-/usr/lib/libImlib*} or @code{ls -l /usr/X11R6/lib/libImlib*}.
+The versions of GTK+ you are using. @code{xzgv --version-gtk} reports
+the GTK+ version being used by xzgv.
@item
The bitdepth your X server is running in (common depths are 8-bit (256
@@ -3162,7 +3012,7 @@ depth you're running in, try @code{xdpyi
@item
A description of the bug --- what effects it has, the circumstances it
occurs in, and so on. Does it only happen for certain types of file?
-Only when in 8-bit modes? Only when dithering is enabled in Imlib? Even
+Only when in 8-bit modes? Only when dithering is enabled? Even
`irrelevant' details can sometimes be useful.
@item
@@ -3173,7 +3023,7 @@ the patch using @code{diff -c} or (prefe
@end itemize
So, if you think you've found a bug in xzgv, report it by emailing me at
- at email{rus@@svgalib.org}.
+ at email{rrt@@sc3d.org}.
@node Reporting Documentation Bugs, , Reporting Bugs, Bugs and Restrictions
diff -up xzgv-0.9/src/Makefile.foo xzgv-0.9/src/Makefile
--- xzgv-0.9/src/Makefile.foo 2007-08-14 00:39:16.000000000 +0200
+++ xzgv-0.9/src/Makefile 2009-01-10 15:20:11.000000000 +0100
@@ -39,6 +39,7 @@ clean:
$(RM) *~ *.o xzgv
$(RM) rcfile_opt.h rcfile_var.h rcfile_short.h
+realclean: clean
# dependancies
backend.o: backend.c backend.h
diff -up xzgv-0.9/src/help.c.foo xzgv-0.9/src/help.c
--- xzgv-0.9/src/help.c.foo 2007-09-09 02:45:46.000000000 +0200
+++ xzgv-0.9/src/help.c 2009-01-10 15:20:11.000000000 +0100
@@ -46,7 +46,8 @@ gtk_window_set_modal(GTK_WINDOW(about_wi
label=gtk_label_new("xzgv " XZGV_VER " - picture viewer for X with file selector\n"
"Copyright (C) 1999-2005 Russell Marks\n"
- "Homepage - http://rus.members.beeb.net/xzgv.html");
+ "Copyright (C) 2007 Reuben Thomas\n"
+ "Homepage - http://sourceforge.net/projects/xzgv");
gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,2);
gtk_widget_show(label);
diff -up xzgv-0.9/src/main.c.foo xzgv-0.9/src/main.c
--- xzgv-0.9/src/main.c.foo 2007-09-09 02:36:21.000000000 +0200
+++ xzgv-0.9/src/main.c 2009-01-10 15:20:36.000000000 +0100
@@ -38,7 +38,8 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h> /* needed for iconify stuff */
-#include <X11/Xlib.h> /* ditto */
+#include <gdk/gdkrgb.h> /* http://bugs.debian.org/457252 */
+#include <X11/Xlib.h> /* needed for iconify stuff */
#include "backend.h"
#include "resizepic.h"
@@ -105,7 +106,7 @@ guint tn_id; /* `thumbnail' id for sta
GtkWidget *mainwin;
-gint xvpic_pal[256]; /* palette for thumbnails */
+guint8 xvpic_pal[256][3]; /* palette for thumbnails */
/* image & rendered pixmap for currently-loaded image */
xzgv_image *theimage=NULL;
@@ -1704,6 +1705,9 @@ void xy_scaling_double(int do_x,int do_y
static int in_routine=0;
int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
/* if recursed, don't bother */
if(in_routine) return;
in_routine=1;
@@ -1752,6 +1756,9 @@ void xy_scaling_add(int do_x,int do_y)
static int in_routine=0;
int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
/* if recursed, don't bother */
if(in_routine) return;
in_routine=1;
@@ -1800,6 +1807,9 @@ void xy_scaling_halve(int do_x,int do_y)
static int in_routine=0;
int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
/* if recursed, don't bother */
if(in_routine) return;
in_routine=1;
@@ -1851,6 +1861,9 @@ void xy_scaling_sub(int do_x,int do_y)
static int in_routine=0;
int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
/* if recursed, don't bother */
if(in_routine) return;
in_routine=1;
@@ -2101,6 +2114,7 @@ listen_to_toggles=1;
void cb_flip(void)
{
+if (!theimage) return;
RECURSE_PROTECT_START;
backend_flip_vert(theimage);
orient_current_state=orient_state_flip[orient_current_state];
@@ -2111,6 +2125,7 @@ RECURSE_PROTECT_END;
void cb_mirror(void)
{
+if (!theimage) return;
RECURSE_PROTECT_START;
backend_flip_horiz(theimage);
orient_current_state=orient_state_mirror[orient_current_state];
@@ -2121,6 +2136,7 @@ RECURSE_PROTECT_END;
void cb_rot_cw(void)
{
+if (!theimage) return;
RECURSE_PROTECT_START;
/* swap x and y scaling, since the effect if we don't do that
* is of the image mysteriously changing. :-)
@@ -2135,6 +2151,7 @@ RECURSE_PROTECT_END;
void cb_rot_acw(void)
{
+if (!theimage) return;
RECURSE_PROTECT_START;
backend_rotate_acw(theimage);
orient_current_state=orient_state_rot_acw[orient_current_state];
@@ -2146,6 +2163,7 @@ RECURSE_PROTECT_END;
void cb_normal_orient(void)
{
+if (!theimage) return;
RECURSE_PROTECT_START;
if(orient_current_state!=0)
{
@@ -2514,113 +2532,93 @@ return(1);
*/
void find_xvpic_cols(void)
{
-GdkColor col;
-int r,g,b;
-int n;
-
-for(n=0,r=0;r<8;r++)
- for(g=0;g<8;g++) /* colours are 3:3:2 */
- for(b=0;b<4;b++,n++)
- {
- col.red=r*0xffff/7; col.green=g*0xffff/7; col.blue=b*0xffff/3;
- backend_get_closest_colour(&col);
- xvpic_pal[n]=col.pixel;
- }
+ int r,g,b;
+ int n;
+
+ for(n=0,r=0;r<8;r++) {
+ for(g=0;g<8;g++) {/* colours are 3:3:2 */
+ for(b=0;b<4;b++,n++) {
+ xvpic_pal[n][0]=r*0xff/7;
+ xvpic_pal[n][1]=g*0xff/7;
+ xvpic_pal[n][2]=b*0xff/3;
+ }
+ }
+ }
}
GdkPixmap *xvpic2pixmap(unsigned char *xvpic,int w,int h,GdkPixmap **smallp)
{
GdkPixmap *pixmap,*small_pixmap;
-GdkImage *image;
+guint8 *buffer;
unsigned char *ptr=xvpic;
int x,y;
int small_w,small_h;
if(w==0 || h==0) return(NULL);
-/* we allocate pixmap and image, draw into image, copy to pixmap,
- * and ditch the image.
- */
-
-if((image=gdk_image_new(GDK_IMAGE_FASTEST,backend_get_visual(),w,h))==NULL)
- return(NULL);
-
-if((pixmap=gdk_pixmap_new(mainwin->window,w,h,
- gdk_visual_get_best_depth()))==NULL)
- {
- gdk_image_destroy(image);
- return(NULL);
- }
-
-for(y=0;y<h;y++)
- for(x=0;x<w;x++)
- gdk_image_put_pixel(image,x,y,xvpic_pal[*ptr++]);
-gdk_draw_image(pixmap,clist->style->white_gc,image,0,0,0,0,w,h);
-gdk_flush();
+if (NULL == (pixmap=gdk_pixmap_new(mainwin->window,w,h, -1))) {
+ return(NULL);
+}
-/* reuse image to draw scaled-down version for thin rows */
small_w=w/ROW_HEIGHT_DIV;
small_h=h/ROW_HEIGHT_DIV;
if(small_w==0) small_w=1;
if(small_h==0) small_h=1;
-if((small_pixmap=gdk_pixmap_new(mainwin->window,small_w,small_h,
- gdk_visual_get_best_depth()))==NULL)
- {
- gdk_pixmap_unref(pixmap);
- gdk_image_destroy(image);
- return(NULL);
+if((small_pixmap=gdk_pixmap_new(mainwin->window,small_w,small_h,-1))==NULL)
+{
+ gdk_pixmap_unref(pixmap);
+ return(NULL);
+}
+
+buffer = malloc (w * h * sizeof (guint8) * 3);
+
+if (NULL == buffer) {
+ /* malloc failed */
+ gdk_pixmap_unref(pixmap);
+ gdk_pixmap_unref(small_pixmap);
+ return NULL;
+}
+
+
+for(y=0;y<h;y++) {
+ for(x=0;x<w;x++) {
+ buffer[3*(y*w + x)+0] = xvpic_pal[*ptr][0]; /* red */
+ buffer[3*(y*w + x)+1] = xvpic_pal[*ptr][1]; /* green */
+ buffer[3*(y*w + x)+2] = xvpic_pal[*ptr][2]; /* blue */
+ ptr++;
}
+}
-for(y=0;y<small_h;y++)
- for(x=0;x<small_w;x++)
- gdk_image_put_pixel(image,x,y,
- xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]]);
+gdk_draw_rgb_image(pixmap,clist->style->white_gc,0,0,w,h,
+ GDK_RGB_DITHER_NORMAL,
+ (guchar*)buffer, w * 3);
+gdk_flush();
-gdk_draw_image(small_pixmap,clist->style->white_gc,image,
- 0,0,0,0,small_w,small_h);
+/* reuse image to draw scaled-down version for thin rows */
-gdk_image_destroy(image);
-*smallp=small_pixmap;
-return(pixmap);
+for(y=0;y<small_h;y++) {
+ for(x=0;x<small_w;x++) {
+ buffer[3*(y*w + x)+0] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][0];
+ buffer[3*(y*w + x)+1] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][1];
+ buffer[3*(y*w + x)+2] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][2];
+ }
}
+gdk_draw_rgb_image(small_pixmap,clist->style->white_gc,0,0,small_w, small_h,
+ GDK_RGB_DITHER_NORMAL,
+ (guchar*)buffer, small_w * 3);
-int is_picture(char *filename)
-{
-int l=strlen(filename);
+*smallp=small_pixmap;
-if(l<=4) return(0);
+if (NULL != buffer) {
+ free (buffer);
+}
-/* at time of writing, imlib1 supports PPM/PGM/TIFF/PNG/XPM/JPEG
- * natively, and uses ImageMagick's `convert' for others.
- * But we have our own GIF/PNG/mrf readers.
- */
-if((!strcasecmp(filename+l-4,".gif")) ||
- (!strcasecmp(filename+l-4,".jpg")) ||
- (!strcasecmp(filename+l-5,".jpeg")) ||
- (!strcasecmp(filename+l-4,".png")) ||
- (!strcasecmp(filename+l-4,".mrf")) ||
- (!strcasecmp(filename+l-4,".xbm")) ||
- (!strcasecmp(filename+l-5,".icon")) || /* presumably an XBM */
- (!strcasecmp(filename+l-4,".xpm")) ||
- (!strcasecmp(filename+l-4,".pbm")) ||
- (!strcasecmp(filename+l-4,".pgm")) ||
- (!strcasecmp(filename+l-4,".ppm")) ||
- (!strcasecmp(filename+l-4,".bmp")) ||
- (!strcasecmp(filename+l-4,".tga")) ||
- (!strcasecmp(filename+l-4,".pcx")) ||
- (!strcasecmp(filename+l-4,".tif")) ||
- (!strcasecmp(filename+l-5,".tiff")) ||
- (!strcasecmp(filename+l-4,".prf")) ||
- (!strcasecmp(filename+l-4,".tim")) ||
- (!strcasecmp(filename+l-4,".xwd")))
- return(1);
-else
- return(0);
+return(pixmap);
}
@@ -2993,9 +2991,6 @@ while((dent=readdir(dirfile))!=NULL)
}
isdir=S_ISDIR(sbuf.st_mode);
- if(!isdir && !is_picture(dent->d_name))
- continue;
-
if(clist_add_new_row(dent->d_name,&sbuf))
numrows++;
}
@@ -3687,7 +3682,11 @@ static GtkItemFactoryEntry viewer_menu_i
};
+gtk_widget_push_visual(gdk_rgb_get_visual());
+gtk_widget_push_colormap(gdk_rgb_get_cmap());
mainwin=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+gtk_widget_pop_visual();
+gtk_widget_pop_colormap();
GTK_WIDGET_UNSET_FLAGS(mainwin,GTK_CAN_FOCUS);
gtk_signal_connect(GTK_OBJECT(mainwin),"destroy",
GTK_SIGNAL_FUNC(cb_quit),NULL);
xzgv-0.9-thumbnail-load-gcc4.patch:
--- NEW FILE xzgv-0.9-thumbnail-load-gcc4.patch ---
--- xzgv-0.9/src/main.c 2009-01-06 21:41:26.000000000 +0100
+++ xzgv-0.9.new/src/main.c 2009-01-06 21:43:42.000000000 +0100
@@ -201,7 +201,7 @@
/* required prototypes */
void render_pixmap(int reset_pos);
void cb_nextprev_tagged_image(int next,int view);
-void idle_xvpic_load(int *entryp);
+gboolean idle_xvpic_load(gpointer data);
gint pic_win_resized(GtkWidget *widget,GdkEventConfigure *event);
void cb_scaling_double(void);
void cb_xscaling_double(void);
@@ -2179,8 +2179,7 @@
idle_xvpic_lastadjval=gtk_clist_get_vadjustment(GTK_CLIST(clist))->value;
idle_xvpic_jumped=0;
entry=0;
-tn_idle_tag=gtk_idle_add((GtkFunction)idle_xvpic_load,&entry);
-
+tn_idle_tag=gtk_idle_add(idle_xvpic_load, &entry);
/* the "" is a crappy way to disable it, but it's hairy otherwise */
gtk_statusbar_push(GTK_STATUSBAR(statusbar),tn_id,
tn_msgs?"Reading thumbnails...":"");
@@ -2605,7 +2604,7 @@
}
-void idle_xvpic_load(int *entryp)
+gint idle_xvpic_load(gpointer data)
{
static char buf[1024];
struct clist_data_tag *datptr;
@@ -2616,12 +2615,13 @@
static unsigned char xvpic_data[80*60]; /* max thumbnail size */
float adjval;
static int prev_scanpos=0; /* if jumped, saved pos in top-to-bot scan */
+int *entryp = data;
idle_xvpic_called=1;
/* don't do it if it would be a bad time */
if(idle_xvpic_blocked)
- return;
+ return TRUE;
/* freeze/thaw actually *cause* flickering for this, rather than
* preventing it (!), so I've not used those here.
@@ -2729,6 +2729,8 @@
*entryp=-1;
}
}
+
+ return TRUE;
}
Index: xzgv.spec
===================================================================
RCS file: /cvs/extras/rpms/xzgv/F-10/xzgv.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- xzgv.spec 9 Feb 2008 16:01:09 -0000 1.7
+++ xzgv.spec 10 Jan 2009 14:43:43 -0000 1.8
@@ -1,12 +1,14 @@
Summary: Picture viewer
Name: xzgv
Version: 0.9
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPLv2+
Group: Applications/Multimedia
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
-Patch: xzgv-0.9-svn-r35.patch
+Patch: xzgv-0.9-svn-r41.patch
Patch1: xzgv-0.9-fix-doc-install.patch
+Patch2: xzgv-0.9-thumbnail-load-gcc4.patch
+Patch3: xzgv-0.9-fix-thumbnail-generation.patch
URL: http://sourceforge.net/projects/xzgv/
Requires: xterm gnome-icon-theme
Requires(post): /sbin/install-info
@@ -23,6 +25,8 @@
%setup -q
%patch -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%{__sed} -i 's|^CFLAGS.*|CFLAGS=%{optflags}|' config.mk
@@ -57,7 +61,7 @@
%post
/sbin/install-info %{_infodir}/xzgv.info.gz %{_infodir}/dir || :
-%postun
+%preun
if [ "$1" = "0" ]; then
/sbin/install-info --delete %{_infodir}/xzgv.info.gz %{_infodir}/dir || :
fi
@@ -74,6 +78,15 @@
%{_datadir}/applications/fedora-%{name}.desktop
%changelog
+* Sat Jan 10 2009 Hans de Goede <hdegoede at redhat.com> - 0.9-5
+- Update to latest upstream svn (r41) fixing several crashes
+- Add a patch fixing thumbnail loading
+- Add a patch fixing thumbnail generation for pictures where
+ the width is not a multiple of 4
+- Add a patch fixing thumbnail generation for pictures which have an alpha
+ channel
+- Fix scriptlet error on uninstall (make it preun instead of postun)
+
* Sat Feb 9 2008 Terje Rosten <terjeros at phys.ntnu.no> - 0.9-4
- rebuild
More information about the scm-commits
mailing list