Use real double buffering instead.
I checked the SDL code and if the hardware cannot provide double buffering
it will use a shadow surface to ensure that a frame is not displayed until
it has been fully painted.
Also disable mouse cursor before opening the output surface. The reason it
was disabled after the surface was opened is that SDL on GP2X has a bug.
However, this means the cursor is visible for a short time during startup
which looks ugly.
The unnecessary alpha channel might harm performance but is not a big deal.
However, the fact that the alpha flag (bool) is somehow automatically
converted by C++ into a skin name (string) causes the entire screen to
stay black.
The black screen was fixed by removing the alpha flag.
For optimum blitting performance, the wallpaper surface is then converted
to the pixel format of the frame buffer.
Bug was introduced in 52c89d6005.
Before this commit loadPNG() could return any surface format and the caller
was responsible for converting it to the desired format. However, in practice
all callers want a surface with an alpha channel and SDL only supports that
with 32bpp surfaces, so RGBA or a permutation thereof. So I changed the
contract for loadPNG() so it is required to return an RGBA surface, and
removed the conversion code in the callers.
The next step is to replace IMG_Load() by a function that calls libpng
directly and loads a fixed 32bpp pixel format. That way, we can drop the
SDL_image dependency and avoid unnecessary pixel format conversions.
Renamed methods that draw a single line from write() to writeLine().
There is now only one write() method left: the public method.
Pass surface to draw on as wrapped Surface instead of SDL_Surface.
At the end of the call chain we still use SDL directly though.
Removed all methods that are never called.
Made methods that are only called by Surface itself private.
One ugly thing remaining is outside access to the "raw" field.
It takes as its parameter the name of the targeted platform.
Currently, those are nanonote, dingux, pandora, gp2x and pc.
The makefiles will install the data accordingly to the platform specs
(e.g. install the 800x480 skins for the pandora platform).
On the "platform" sub-folder are located one folder for each platform gmenu2x supports.
The "translations" folder is now the same for all platforms.
The "skins" sub-folder contains directories which names defines the screen resolution of the contained skins (e.g. "320x240").
There is no point in precalculating something so cheap to recalculate.
Also, the majority of uses was to compensate for passing the wrong alignment argument.
This is useful when the files/directories lists are not cleared; then it is possible to define priorities between the files.
For instance, the skin "Default" will be shown only once, even if the directory "Default" exists both in the system and the user directories.
As the skin and translation loading functions does check both directories, there is no problem in doing that.