1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 21:28:54 +03:00
Commit Graph

33 Commits

Author SHA1 Message Date
Maarten ter Huurne
02384c8e72 Removed skin lookup feature from OffscreenSurface::loadImage
Instead, make the caller perform the lookup. This simplifies the
interface of loadImage and it removes the dependency from
OffscreenSurface on SurfaceCollection.
2014-08-15 01:34:35 +02:00
Maarten ter Huurne
60183e539d Removed most uses of naked Surface pointers
However, SurfaceCollection remains a very important user.
2014-08-10 14:21:14 +02:00
Maarten ter Huurne
4bd1c799bd Created separate subclasses for output and off-screen surfaces
There are a few exclusive operations for each type. Also we no longer
need the freeWhenDone flag since the class now determines whether the
surface should be freed or not.
2014-08-10 13:25:54 +02:00
Maarten ter Huurne
aff5f53f7d Don't pass around naked Surface pointers when drawing
Use references instead.
2014-08-10 04:26:59 +02:00
Maarten ter Huurne
5a281cf661 Implement the standard set of copy and move operations for Surface 2014-08-10 03:18:32 +02:00
Maarten ter Huurne
614f74a63d Removed halfW/H caching in Surface
This is a very cheap computation, no need to cache it.
2014-08-10 02:55:52 +02:00
Maarten ter Huurne
902145b698 Removed Surface::write method
All it did was redirect to Font::write, so it's better to call that
method directly.
2014-07-31 23:16:51 +02:00
Maarten ter Huurne
79dcc8a146 Implemented stream output for RGBAColor
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.
2014-07-19 12:06:09 +02:00
Maarten ter Huurne
0dd027fcf4 Use our own alpha blended rectangle fill instead of SDL_gfx
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.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
9df565b73c Made rect+color the preferred argument style for (filled) rectangle drawing
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.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
dd27cb2e07 Add constructors for RGBAColor 2014-07-19 00:43:06 +02:00
Maarten ter Huurne
5f454a8569 Made strtorgba into a factory method of RGBAColor
The method is RGBAColor::fromString.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
950518f3a7 Made RGBAColor components 8 bits wide
The values are all in the range 0..255, so storing more than 8 bits
is wasteful.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
2a4b519282 Removed return code from surface drawing methods
Not a single caller actually checked the return codes.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
86ee9955d6 Removed dedicated horizontal line routine
Just draw a 1-pixel-high box instead.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
7284104fd1 Fix issues with loading images with alpha disabled.
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.
2014-07-17 01:25:41 +02:00
Maarten ter Huurne
b0d1d9e55f Declare Surface methods that don't change the surface as "const"
This allows source surfaces (such as icons) to be passed around as
const references.
2013-08-09 17:47:34 +02:00
Maarten ter Huurne
724aefe482 Renamed ASFont class to just Font
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.
2013-08-03 22:30:12 +02:00
Maarten ter Huurne
b248aaf808 Surface cleanup.
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.
2012-04-10 22:33:43 +02:00
Maarten ter Huurne
a01d892eb6 More header cleanups.
This time the focus was on removing namespace imports from headers.
2011-10-23 16:43:56 +02:00
Maarten ter Huurne
8a81837c04 Surface: Make pixel format conversion explicit.
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.
2011-06-03 11:46:36 +02:00
Maarten ter Huurne
7861e07eb0 Surface: Made "raw" field private.
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.
2011-06-02 22:44:04 +02:00
Maarten ter Huurne
25e8e62622 Surface: Minor cleanups.
Removed unused "locked" field.
Inlined format() private method: since "raw" can no longer be NULL, the method became trivial.
2011-06-02 22:32:08 +02:00
Maarten ter Huurne
52f4686e4a Surface: Load image with factory method instead of constructor.
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.
2011-06-02 22:09:03 +02:00
Maarten ter Huurne
0a9229ff3f Surface: Use the destructor as intended.
There is no reason to have an explicit free() method instead of just
destructing the Surface object and doing cleanup in the destructor.
2011-06-02 18:15:15 +02:00
Maarten ter Huurne
7dac306c16 Surface: Removed fake double buffering.
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.
2011-06-02 17:59:26 +02:00
Maarten ter Huurne
7877fee3fa Surface: Remove alpha flag.
As for SurfaceCollection, the alpha flag passed to the Surface constructor
was also always true. Therefore there is no need to have the flag.
2011-06-02 06:02:45 +02:00
Maarten ter Huurne
52c89d6005 Surface: Removed duplicate constructor.
There were two constructors that took an image path, skin name and alpha flag
as their arguments, but in different orders. We need only one of them.
2011-06-02 04:57:21 +02:00
Maarten ter Huurne
b6a5d89bc8 Surface: Removed unused code and restricted access.
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.
2011-06-02 03:39:34 +02:00
Maarten ter Huurne
a35a7e2c35 Introduced enums for text alignment in the ASFont class. 2011-05-09 05:17:25 +02:00
Maarten ter Huurne
e6be835038 Isolate all PNG loading in a separate source/header.
This is in preparation of replacing SDL_image with direct use of libpng.
2011-05-09 03:56:57 +02:00
Lars-Peter Clausen
40a26e1a9c pass strings by reference where possible 2010-05-02 14:38:16 +02:00
Mirko Lindner
cddcd72e33 initial commit - needs clean-up
Signed-off-by: Mirko Lindner <mirko@sharism.cc>
2010-02-04 12:33:47 +01:00