Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] loading compressed XPM files
Home

[Freeciv-Dev] loading compressed XPM files

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] loading compressed XPM files
From: Benoit Hudson <bh@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Sep 2001 18:22:24 -0400

Compressing the XPM files in the rulesets using gzip reduces the size of
the freeciv-1.12.0 share directory by about 75% (1.6 rather than 6.4 Mb).
This patch, applied to the gui-gtk client (client/gui-gtk/graphics.c) from
the released 1.12.0, lets the GTK client read gzipped XPM files.  Apply the
patch, install as usual, then go to share/freeciv and:
        gzip -9 `find . -name \*.xpm`

Ideally, the makefile would do that automagically.

The patch checks for HAVE_LIBZ ; if you don't have it, this patch only has
the effect of copying and freeing an additional string (because gdk takes a
char*, and I'm paranoid about passing const char* in where char* is
required).  Obviously, if you don't have it, you also can't read
compressed xmp.

The patch hooks into the mechanism that already existed to first try one
filetype, and if it doesn't work, try another.  So if there's no compressed
xpm file, we use a non-compressed one.

TODO 1: have the makefile automatically gzip the xpm files
TODO 2: extend this to work with all clients
TODO 3: extend this to have all the share files be gzipped.  The marginal
        benefit of that is much less, but we still save 40% (600 Kb).

        -- Benoît


[Prev in Thread] Current Thread [Next in Thread]