There was a lot of gp2x-specific code which was built for
all platform. For instance, the code was compiled for all
the platforms with the constant "TARGET_GP2X" defined.
This obviously had to be fixed.
This reverts commit 439d25c292.
Refusing to load files of the Default skin for a different one is a bad idea; it requires
that skin to provide every single PNG file needed by gmenu2x.
It ensures that GMenu2X can restart after a SDL program segfaulted or crashed.
It also allow GMenu2X to exit without clearing the screen, so that the "loading" screen appears
until the launched binary starts using the framebuffer.
writeSkinConfig() had a very naughty bug when RGBA values were written
to config file unpadded. This lead to a problem that, for example,
0x00000080 was written as 0x00080 in config file (Somehow gmenu2x
reads and re-saves config on selection). This, in turn, led
to problem when reading skin config file in strtorgba function,
because it parses the color string in token of two symbols
(substr(0,2) and etc).
This eliminates the build-time dependency on SDL_image and the run-time
dependencies on all libraries used by SDL_image except SDL and libpng.
In addition we now let libpng convert to ARGB format while decoding the
image, rather than letting SDL convert the surface afterwards.
A bug in SDL_ConvertSurface() leaves the per-surface alpha undefined when
converting from RGBA to RGBA. This can cause problems if the surface is
later converted to a format without an alpha channel, such as the display
format.
Instead of having the copy constructor convert to display format, the new
copy constructor preserves the pixel format and a separate method was
introduced to convert surfaces to display format.
The code was made more robust as well: it should no longer crash if the
wallpaper cannot be loaded.
I cheated a bit by declaring ASFont as friend, but all other outside
access now happens via methods.
I removed the "saveScreenshot" method since the code calling it is
commented out and I never heard anyone complain about missing this
feature.
If loading fails, the factory method returns NULL, while previously the
constructor would create a Surface object with a NULL "raw" field.
However, since most of the methods dereference "raw" without checking,
such a Surface would likely crash the application when used.