1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-17 01:11:53 +02:00
Commit Graph

630 Commits

Author SHA1 Message Date
Maarten ter Huurne
2394a075d7 Surface: Work around bug in SDL that loses per-surface alpha.
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.
2011-06-05 05:27:28 +02:00
Maarten ter Huurne
36260e999d PNG: Only add alpha channel on surface if loaded image has an alpha channel.
This fixes a bug where a loaded image could have an alpha of 0.
Also it avoids expensive alpha blending where it is unnecessary.
2011-06-03 12:47:49 +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
0c867aabbf Surface: Fixed memory leak in previous commit.
I forgot to initialize freeWhenDone in two of the three constructors.
2011-06-02 18:07:17 +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
Ayla
ef4b012026 Merge branch 'master' of projects.qi-hardware.com:gmenu2x into install_locations
Conflicts:
	data/platform/nanonote/sections/terminals/ash
	src/gmenu2x.cpp
	src/surface.cpp
2011-06-02 12:16:26 +02:00
Maarten ter Huurne
5b6d922f11 Fixed bug: wallpaper does not use alpha channel.
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.
2011-06-02 07:13:59 +02:00
Maarten ter Huurne
8b17e2ef62 PNG: Make loadPNG() responsible for creating an RGBA surface.
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.
2011-06-02 06:19:21 +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
44ca4e3460 SurfaceCollection: Removed alpha flag.
In the existing code the alpha flag is always true, so there is no point
in passing it around.
2011-06-02 05:52:47 +02:00
Maarten ter Huurne
af3ed78496 Merge branch 'master' of projects.qi-hardware.com:gmenu2x 2011-06-02 05:46:25 +02:00
Sergey Kukunin
240286df11 Add powersaver class 2011-06-02 06:32:39 +03: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
b2896d6bac ASFont: Refactored string drawing methods.
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.
2011-06-02 04:29:19 +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
Ayla
b646c33080 The ./configure will now accept the --enable-platform switch.
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).
2011-06-01 01:07:00 +02:00
Ayla
34af938ce1 Moved the pandora's "input.conf" file lying in the top directory to the pandora/data directory, replacing the previous (obsolete) one. 2011-06-01 01:05:14 +02:00
Ayla
47a4e5c3ab Moved all the data files (translations, skins...) to the "data" folder.
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").
2011-06-01 00:59:01 +02:00
Xiangfu Liu
b068aa04d4 nanonote: using color font 2011-05-31 09:01:16 +08:00
Xiangfu Liu
6087e23d4d nanonote: fix setfont path 2011-05-30 09:53:59 +08:00
Xiangfu Liu
e0831be4a3 add color ash shell, add the method to gmenu2x.sh as comment 2011-05-27 21:41:35 +08:00
Maarten ter Huurne
a382a425a9 ASFont: access font pixels efficiently.
Previous commit ensures that the font surface is always 32 bpp.
Therefore we can read font pixels directly through a pointer.
2011-05-12 02:10:40 +02:00
Maarten ter Huurne
41e6e4693e ASFont: only convert font surface if it is not already in a 32bpp format. 2011-05-12 01:20:26 +02:00
Maarten ter Huurne
db5ebff16f Fixed debug print.
GCC 4.5.1 has stricter checking of format strings and refused to compile this.
2011-05-11 02:31:41 +02:00
Maarten ter Huurne
8592038f95 Merge branch 'master' of projects.qi-hardware.com:gmenu2x 2011-05-11 01:37:57 +02:00
Maarten ter Huurne
bff04d2418 ASFont: removed duplication of horizontal alignment code. 2011-05-10 02:43:15 +02:00
Maarten ter Huurne
b4f3cde526 ASFont: merged SFontPlus class into ASFont class. 2011-05-10 02:37:10 +02:00
Maarten ter Huurne
1bc55392cd ASFont: cleanups in text write methods. 2011-05-10 02:23:13 +02:00
Maarten ter Huurne
ff546cdcb0 ASFont: have a single routine for computing text width that also handles newlines.
This way the text has to be scanned only once and no copying is needed.
2011-05-10 02:08:14 +02:00
Maarten ter Huurne
e4b71138b9 ASFont: removed precalculation of half heights.
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.
2011-05-10 00:31:45 +02:00
Ayla
3998e19e49 The log.txt file will now be saved on the user-specific directory. 2011-05-09 19:21:14 +02:00
Maarten ter Huurne
492a36b9df ASFont: simplified object initialization and cleanup.
Do initialization and cleanup in constructor and destructor respectively.
Removed constructors that are not used by gmenu2x.
2011-05-09 14:54:11 +02:00
Maarten ter Huurne
ec5d426d83 ASFont: moved SFontPlus code into ASFont source files.
This is in preparation of merging the classes.
2011-05-09 14:25:16 +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
c54dec90f5 Minor cleanups in SFontPlus and ASFont.
Removed unused includes.
Avoid importing classes into default namespace in headers.
Don't use a type alias if it does not add value.
2011-05-09 04:29:59 +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
Ayla
38a83dd385 On the skin menu, the ALTLEFT/ALTRIGHT buttons will now respectively decrease/increase the ARGB values by 10. 2011-04-14 19:35:50 +02:00
Ayla
6cb7ce1c0b Fixed the renameSection() and deleteSection() functions to use the new directories. The sections can now be renamed and deleted. 2011-04-14 12:08:10 +02:00
Ayla
d0a24ac5ce Merge branch 'install_locations' of projects.qi-hardware.com:gmenu2x into install_locations 2011-04-14 11:26:24 +02:00
Ayla
6c97139113 The FileLister won't list a file if a previous one has the same file name (without path).
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.
2011-04-14 11:16:16 +02:00
Maarten ter Huurne
c22cc4d663 Cleaned up link flags.
Use the flags found by "configure" and nothing more.
The hardcoded "-lpng12" broke linking with libpng 1.4.
2011-04-13 03:40:36 +02:00
Maarten ter Huurne
23042f3122 Cleaned up link flags.
Use the flags found by "configure" and nothing more.
The hardcoded "-lpng12" broke linking with libpng 1.4.
2011-04-13 03:36:47 +02:00
Maarten ter Huurne
f9db1fbd53 Merge remote branch 'origin/master' 2011-04-13 03:14:45 +02:00
Maarten ter Huurne
34a3d55d10 Added missing #include.
Fixes compile error when compiling with GCC 4.5.1.
2011-04-13 03:14:10 +02:00
Maarten ter Huurne
8995a3c196 Added missing #include.
Fixes compile error when compiling with GCC 4.5.1.
2011-04-13 01:51:23 +02:00
Ayla
f10bb60717 Merge branch 'master' into install_locations 2011-04-12 13:25:00 +02:00