Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 2807:365fe1a2aad5
The SDL_RLEACCEL flag is respected in SDL_ConvertSurface(), per the docs.
Fixed saving BMP files of surfaces with an alpha channel.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 29 Nov 2008 11:26:01 +0000 |
parents | 8fe261aae1bb |
children | 16fe3b867887 |
comparison
equal
deleted
inserted
replaced
2806:938aa47f903a | 2807:365fe1a2aad5 |
---|---|
612 } | 612 } |
613 | 613 |
614 SDL_Surface * | 614 SDL_Surface * |
615 SDL_DisplayFormat(SDL_Surface * surface) | 615 SDL_DisplayFormat(SDL_Surface * surface) |
616 { | 616 { |
617 SDL_Surface *converted; | 617 SDL_PixelFormat *format; |
618 | 618 |
619 if (!SDL_PublicSurface) { | 619 if (!SDL_PublicSurface) { |
620 SDL_SetError("No video mode has been set"); | 620 SDL_SetError("No video mode has been set"); |
621 return NULL; | 621 return NULL; |
622 } | 622 } |
623 format = SDL_PublicSurface->format; | |
623 | 624 |
624 /* Set the flags appropriate for copying to display surface */ | 625 /* Set the flags appropriate for copying to display surface */ |
625 converted = SDL_ConvertSurface(surface, SDL_PublicSurface->format, 0); | 626 return SDL_ConvertSurface(surface, format, SDL_RLEACCEL); |
626 SDL_SetSurfaceRLE(converted, 1); | |
627 return converted; | |
628 } | 627 } |
629 | 628 |
630 SDL_Surface * | 629 SDL_Surface * |
631 SDL_DisplayFormatAlpha(SDL_Surface * surface) | 630 SDL_DisplayFormatAlpha(SDL_Surface * surface) |
632 { | 631 { |
671 /* We have no other optimised formats right now. When/if a new | 670 /* We have no other optimised formats right now. When/if a new |
672 optimised alpha format is written, add the converter here */ | 671 optimised alpha format is written, add the converter here */ |
673 break; | 672 break; |
674 } | 673 } |
675 format = SDL_AllocFormat(32, rmask, gmask, bmask, amask); | 674 format = SDL_AllocFormat(32, rmask, gmask, bmask, amask); |
676 converted = SDL_ConvertSurface(surface, format, 0); | 675 converted = SDL_ConvertSurface(surface, format, SDL_RLEACCEL); |
677 SDL_SetSurfaceRLE(converted, 1); | |
678 SDL_FreeFormat(format); | 676 SDL_FreeFormat(format); |
679 return converted; | 677 return converted; |
680 } | 678 } |
681 | 679 |
682 int | 680 int |