In commit 950518f3 I changed the component type of RGBAColor from
16-bit to 8-bit integers. Unfortunately, in C++ 8-bit integers are
identical to characters, so this broke the writing of colors to
output streams.
I want to remove the dependency on SDL_gfx, since only two functions
from that library are actually used. Also this new blend implementation
is more optimized, especially the 32bpp case, which is the one most
platforms are using.
This is the opposite of the old situation, when the structs were
unraveled.
The definitions for the alternative styles were moved to the header,
so the compiler has more opportunities for optimizing the conversions.
These issues are fixed:
* loadPNG gave RGBA surfaces unconditionally. Now it gives RGB surfaces if
its second parameter, defaulting to true, is false. This fixes adding per-
surface alpha values, because an RGBA surface ignores its per-surface value.
* Surface::loadImage is updated to receive a third parameter, defaulting to
true, to determine whether alpha is loaded.
* SurfaceCollection::defaultAlpha was never used.
* SurfaceCollection::defaultAlpha defaulted to false, so even if it were used,
it would have loaded images without alpha.
Originally the font implementation was based on SFont, but it was
recently replaced by an SDL_ttf based implementation, so the name
no longer made sense.
Use unsigned ints for width and height, like SDL does.
We're using the SDL typedefs there after all.
Include argument names in header when type name does tell everything.
Use whitespace in argument lists.
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.
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.
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.