test/testalpha.c
changeset 2806 938aa47f903a
parent 2799 bbf3aac2672a
child 2822 cf271ff76061
     1.1 --- a/test/testalpha.c	Sat Nov 29 10:43:50 2008 +0000
     1.2 +++ b/test/testalpha.c	Sat Nov 29 11:24:18 2008 +0000
     1.3 @@ -36,44 +36,43 @@
     1.4      }
     1.5      buffer = (Uint8 *) screen->pixels;
     1.6      switch (screen->format->BytesPerPixel) {
     1.7 -        case 1:
     1.8 -        case 3:
     1.9 -            for (i = 0; i < screen->h; ++i) {
    1.10 -                memset(buffer, (i * 255) / screen->h,
    1.11 -                       screen->w * screen->format->BytesPerPixel);
    1.12 -                buffer += screen->pitch;
    1.13 -            }
    1.14 -            break;
    1.15 -        case 2:
    1.16 -            for (i = 0; i < screen->h; ++i) {
    1.17 -                Uint16 *buffer16;
    1.18 -                Uint16 color;
    1.19 +    case 1:
    1.20 +    case 3:
    1.21 +        for (i = 0; i < screen->h; ++i) {
    1.22 +            memset(buffer, (i * 255) / screen->h,
    1.23 +                   screen->w * screen->format->BytesPerPixel);
    1.24 +            buffer += screen->pitch;
    1.25 +        }
    1.26 +        break;
    1.27 +    case 2:
    1.28 +        for (i = 0; i < screen->h; ++i) {
    1.29 +            Uint16 *buffer16;
    1.30 +            Uint16 color;
    1.31  
    1.32 -                gradient = ((i * 255) / screen->h);
    1.33 -                color = (Uint16) SDL_MapRGB(screen->format,
    1.34 -                                            gradient, gradient, gradient);
    1.35 -                buffer16 = (Uint16 *) buffer;
    1.36 -                for (k = 0; k < screen->w; k++) {
    1.37 -                    *buffer16++ = color;
    1.38 -                }
    1.39 -                buffer += screen->pitch;
    1.40 +            gradient = ((i * 255) / screen->h);
    1.41 +            color = (Uint16) SDL_MapRGB(screen->format,
    1.42 +                                        gradient, gradient, gradient);
    1.43 +            buffer16 = (Uint16 *) buffer;
    1.44 +            for (k = 0; k < screen->w; k++) {
    1.45 +                *buffer16++ = color;
    1.46              }
    1.47 -            break;
    1.48 -        case 4:
    1.49 -            for (i = 0; i < screen->h; ++i) {
    1.50 -                Uint32 *buffer32;
    1.51 -                Uint32 color;
    1.52 +            buffer += screen->pitch;
    1.53 +        }
    1.54 +        break;
    1.55 +    case 4:
    1.56 +        for (i = 0; i < screen->h; ++i) {
    1.57 +            Uint32 *buffer32;
    1.58 +            Uint32 color;
    1.59  
    1.60 -                gradient = ((i * 255) / screen->h);
    1.61 -                color = SDL_MapRGB(screen->format,
    1.62 -                                   gradient, gradient, gradient);
    1.63 -                buffer32 = (Uint32 *) buffer;
    1.64 -                for (k = 0; k < screen->w; k++) {
    1.65 -                    *buffer32++ = color;
    1.66 -                }
    1.67 -                buffer += screen->pitch;
    1.68 +            gradient = ((i * 255) / screen->h);
    1.69 +            color = SDL_MapRGB(screen->format, gradient, gradient, gradient);
    1.70 +            buffer32 = (Uint32 *) buffer;
    1.71 +            for (k = 0; k < screen->w; k++) {
    1.72 +                *buffer32++ = color;
    1.73              }
    1.74 -            break;
    1.75 +            buffer += screen->pitch;
    1.76 +        }
    1.77 +        break;
    1.78      }
    1.79  
    1.80      SDL_UnlockSurface(screen);
    1.81 @@ -523,7 +522,8 @@
    1.82                      area.y = event.button.y - 16;
    1.83                      area.w = 32;
    1.84                      area.h = 32;
    1.85 -                    SDL_FillRect(screen, &area, SDL_MapRGB(screen->format, 0, 0, 0));
    1.86 +                    SDL_FillRect(screen, &area,
    1.87 +                                 SDL_MapRGB(screen->format, 0, 0, 0));
    1.88                      SDL_UpdateRects(screen, 1, &area);
    1.89                  }
    1.90                  break;