test/testwin.c
changeset 2821 c4eccbd21d16
parent 1895 c121d94672cb
child 5535 96594ac5fd1a
equal deleted inserted replaced
2820:33ddad305f3d 2821:c4eccbd21d16
    71     if (!SDL_SetColors(screen, colors, 0, ncolors) &&
    71     if (!SDL_SetColors(screen, colors, 0, ncolors) &&
    72         (screen->format->palette != NULL)) {
    72         (screen->format->palette != NULL)) {
    73         fprintf(stderr,
    73         fprintf(stderr,
    74                 "Warning: Couldn't set all of the colors, but SDL will map the image\n"
    74                 "Warning: Couldn't set all of the colors, but SDL will map the image\n"
    75                 "         (colormap fading will suffer - try the -warp option)\n");
    75                 "         (colormap fading will suffer - try the -warp option)\n");
    76     }
       
    77 
       
    78     /* Set the screen to black (not really necessary) */
       
    79     if (SDL_LockSurface(screen) == 0) {
       
    80         Uint32 black;
       
    81         Uint8 *pixels;
       
    82 
       
    83         black = SDL_MapRGB(screen->format, 0, 0, 0);
       
    84         pixels = (Uint8 *) screen->pixels;
       
    85         for (i = 0; i < screen->h; ++i) {
       
    86             memset(pixels, black, screen->w * screen->format->BytesPerPixel);
       
    87             pixels += screen->pitch;
       
    88         }
       
    89         SDL_UnlockSurface(screen);
       
    90         SDL_UpdateRect(screen, 0, 0, 0, 0);
       
    91     }
    76     }
    92 
    77 
    93     /* Display the picture */
    78     /* Display the picture */
    94     if (speedy) {
    79     if (speedy) {
    95         SDL_Surface *displayfmt;
    80         SDL_Surface *displayfmt;