src/video/SDL_video.c
changeset 944 cdea7cbc3e23
parent 916 46916168361d
child 989 475166d13b44
equal deleted inserted replaced
943:715c32d8f26c 944:cdea7cbc3e23
  1273 			return gotall;	/* video not yet initialized */
  1273 			return gotall;	/* video not yet initialized */
  1274 		if(!video->physpal && !(which & SDL_LOGPAL) ) {
  1274 		if(!video->physpal && !(which & SDL_LOGPAL) ) {
  1275 			/* Lazy physical palette allocation */
  1275 			/* Lazy physical palette allocation */
  1276 			int size;
  1276 			int size;
  1277 			SDL_Palette *pp = malloc(sizeof(*pp));
  1277 			SDL_Palette *pp = malloc(sizeof(*pp));
       
  1278 			if ( !pp ) {
       
  1279 				return 0;
       
  1280 			}
  1278 			current_video->physpal = pp;
  1281 			current_video->physpal = pp;
  1279 			pp->ncolors = pal->ncolors;
  1282 			pp->ncolors = pal->ncolors;
  1280 			size = pp->ncolors * sizeof(SDL_Color);
  1283 			size = pp->ncolors * sizeof(SDL_Color);
  1281 			pp->colors = malloc(size);
  1284 			pp->colors = malloc(size);
       
  1285 			if ( !pp->colors ) {
       
  1286 				return 0;
       
  1287 			}
  1282 			memcpy(pp->colors, pal->colors, size);
  1288 			memcpy(pp->colors, pal->colors, size);
  1283 		}
  1289 		}
  1284 		if ( ! SetPalette_physical(screen,
  1290 		if ( ! SetPalette_physical(screen,
  1285 		                           colors, firstcolor, ncolors) ) {
  1291 		                           colors, firstcolor, ncolors) ) {
  1286 			gotall = 0;
  1292 			gotall = 0;