src/video/SDL_surface.c
changeset 11448 52dcef74bdc5
parent 11289 ca3c2c98f2e1
child 11496 3d1698bc2747
equal deleted inserted replaced
11447:f76299105635 11448:52dcef74bdc5
  1191         return;
  1191         return;
  1192     }
  1192     }
  1193     if (surface->flags & SDL_DONTFREE) {
  1193     if (surface->flags & SDL_DONTFREE) {
  1194         return;
  1194         return;
  1195     }
  1195     }
       
  1196     if (surface->map != NULL) {
       
  1197         SDL_FreeBlitMap(surface->map);
       
  1198         surface->map = NULL;
       
  1199     }
  1196     if (--surface->refcount > 0) {
  1200     if (--surface->refcount > 0) {
  1197         return;
  1201         return;
  1198     }
  1202     }
  1199     while (surface->locked > 0) {
  1203     while (surface->locked > 0) {
  1200         SDL_UnlockSurface(surface);
  1204         SDL_UnlockSurface(surface);
  1205     if (surface->format) {
  1209     if (surface->format) {
  1206         SDL_SetSurfacePalette(surface, NULL);
  1210         SDL_SetSurfacePalette(surface, NULL);
  1207         SDL_FreeFormat(surface->format);
  1211         SDL_FreeFormat(surface->format);
  1208         surface->format = NULL;
  1212         surface->format = NULL;
  1209     }
  1213     }
  1210     if (surface->map != NULL) {
       
  1211         SDL_FreeBlitMap(surface->map);
       
  1212         surface->map = NULL;
       
  1213     }
       
  1214     if (!(surface->flags & SDL_PREALLOC)) {
  1214     if (!(surface->flags & SDL_PREALLOC)) {
  1215         SDL_free(surface->pixels);
  1215         SDL_free(surface->pixels);
  1216     }
  1216     }
  1217     SDL_free(surface);
  1217     SDL_free(surface);
  1218 }
  1218 }