comparison src/video/SDL_RLEaccel.c @ 1683:396a35389351 SDL-1.3

Finished palettized display handling. Added support for surface palette sharing.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Jun 2006 06:45:14 +0000
parents 4da1ee79c9af
children
comparison
equal deleted inserted replaced
1682:7ae8018b2e5d 1683:396a35389351
1616 1616
1617 #undef ADD_OPAQUE_COUNTS 1617 #undef ADD_OPAQUE_COUNTS
1618 #undef ADD_TRANSL_COUNTS 1618 #undef ADD_TRANSL_COUNTS
1619 1619
1620 /* Now that we have it encoded, release the original pixels */ 1620 /* Now that we have it encoded, release the original pixels */
1621 if ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC 1621 if (!(surface->flags & SDL_PREALLOC) && !(surface->flags & SDL_HWSURFACE)) {
1622 && (surface->flags & SDL_HWSURFACE) != SDL_HWSURFACE) {
1623 SDL_free(surface->pixels); 1622 SDL_free(surface->pixels);
1624 surface->pixels = NULL; 1623 surface->pixels = NULL;
1625 } 1624 }
1626 1625
1627 /* realloc the buffer to release unused memory */ 1626 /* realloc the buffer to release unused memory */
1782 ADD_COUNTS(0, 0); 1781 ADD_COUNTS(0, 0);
1783 1782
1784 #undef ADD_COUNTS 1783 #undef ADD_COUNTS
1785 1784
1786 /* Now that we have it encoded, release the original pixels */ 1785 /* Now that we have it encoded, release the original pixels */
1787 if ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC 1786 if (!(surface->flags & SDL_PREALLOC) && !(surface->flags & SDL_HWSURFACE)) {
1788 && (surface->flags & SDL_HWSURFACE) != SDL_HWSURFACE) {
1789 SDL_free(surface->pixels); 1787 SDL_free(surface->pixels);
1790 surface->pixels = NULL; 1788 surface->pixels = NULL;
1791 } 1789 }
1792 1790
1793 /* realloc the buffer to release unused memory */ 1791 /* realloc the buffer to release unused memory */
1934 SDL_UnRLESurface(SDL_Surface * surface, int recode) 1932 SDL_UnRLESurface(SDL_Surface * surface, int recode)
1935 { 1933 {
1936 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { 1934 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
1937 surface->flags &= ~SDL_RLEACCEL; 1935 surface->flags &= ~SDL_RLEACCEL;
1938 1936
1939 if (recode && (surface->flags & SDL_PREALLOC) != SDL_PREALLOC 1937 if (recode && !(surface->flags & SDL_PREALLOC)
1940 && (surface->flags & SDL_HWSURFACE) != SDL_HWSURFACE) { 1938 && !(surface->flags & SDL_HWSURFACE)) {
1941 if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) { 1939 if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
1942 SDL_Rect full; 1940 SDL_Rect full;
1943 unsigned alpha_flag; 1941 unsigned alpha_flag;
1944 1942
1945 /* re-create the original surface */ 1943 /* re-create the original surface */