mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-23 04:54:04 +02:00
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.
This commit is contained in:
parent
36260e999d
commit
2394a075d7
@ -81,6 +81,11 @@ Surface::Surface(SDL_Surface *raw_, bool freeWhenDone_)
|
|||||||
|
|
||||||
Surface::Surface(Surface *s) {
|
Surface::Surface(Surface *s) {
|
||||||
raw = SDL_ConvertSurface(s->raw, s->raw->format, SDL_SWSURFACE);
|
raw = SDL_ConvertSurface(s->raw, s->raw->format, SDL_SWSURFACE);
|
||||||
|
// Note: 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.
|
||||||
|
raw->format->alpha = s->raw->format->alpha;
|
||||||
freeWhenDone = true;
|
freeWhenDone = true;
|
||||||
halfW = raw->w/2;
|
halfW = raw->w/2;
|
||||||
halfH = raw->h/2;
|
halfH = raw->h/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user