1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-06-30 20:34:11 +03:00
Commit Graph

11 Commits

Author SHA1 Message Date
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
9e113d88c7 Fixed compilation with GCC 4.9 2014-05-18 21:19:03 +02:00
Paul Cercueil
c58b3a535e Update GMenu2X to use the latest libopk v1.0 API 2013-05-26 19:06:53 -04:00
Maarten ter Huurne
bcbedc8f40 Updated code calling opk_extract_file().
I changed the return type from char* to void* in libopk, now updating
the gmenu2x code to match.
2013-02-05 19:05:44 +01:00
Paul Cercueil
8d96f3c261 Update to use the latest libopk API, and simplify loadPNG 2012-11-05 18:48:48 -03:00
Paul Cercueil
909fef2f3a Update to use the latest libopk API. 2012-10-08 08:19:59 +02:00
Paul Cercueil
0cbb5ee09a Make loadPNG() able to read files from OPK packages.
The filename passed to it should contain the filename of the squashfs
image, the character '#', and the filename of the .png file contained
inside the package.

E.g.:
/tmp/package.opk#icon.png
2012-10-07 20:04:30 +02:00
Maarten ter Huurne
7aeb7a4f0a PNG: Use libpng directly instead of via SDL_image.
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.
2011-06-05 05:58:47 +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
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
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