src/video/SDL_video.c
changeset 3169 f294338ca6eb
parent 3166 3a63a5824557
child 3178 72edc980789b
     1.1 --- a/src/video/SDL_video.c	Sun Jun 07 02:44:46 2009 +0000
     1.2 +++ b/src/video/SDL_video.c	Sun Jun 07 02:45:55 2009 +0000
     1.3 @@ -1635,17 +1635,18 @@
     1.4              int apfmt;
     1.5  
     1.6              /* Pixel formats with alpha, sorted by best first */
     1.7 -            static const Uint32 sdl_alpha_pformats[]={
     1.8 -               SDL_PIXELFORMAT_ARGB8888,
     1.9 -               SDL_PIXELFORMAT_RGBA8888,
    1.10 -               SDL_PIXELFORMAT_ABGR8888,
    1.11 -               SDL_PIXELFORMAT_BGRA8888,
    1.12 -               SDL_PIXELFORMAT_ARGB1555,
    1.13 -               SDL_PIXELFORMAT_ABGR1555,
    1.14 -               SDL_PIXELFORMAT_ARGB4444,
    1.15 -               SDL_PIXELFORMAT_ABGR4444,
    1.16 -               SDL_PIXELFORMAT_ARGB2101010,
    1.17 -               SDL_PIXELFORMAT_UNKNOWN};
    1.18 +            static const Uint32 sdl_alpha_pformats[] = {
    1.19 +                SDL_PIXELFORMAT_ARGB8888,
    1.20 +                SDL_PIXELFORMAT_RGBA8888,
    1.21 +                SDL_PIXELFORMAT_ABGR8888,
    1.22 +                SDL_PIXELFORMAT_BGRA8888,
    1.23 +                SDL_PIXELFORMAT_ARGB1555,
    1.24 +                SDL_PIXELFORMAT_ABGR1555,
    1.25 +                SDL_PIXELFORMAT_ARGB4444,
    1.26 +                SDL_PIXELFORMAT_ABGR4444,
    1.27 +                SDL_PIXELFORMAT_ARGB2101010,
    1.28 +                SDL_PIXELFORMAT_UNKNOWN
    1.29 +            };
    1.30  
    1.31              bpp = 32;
    1.32              Rmask = 0x00FF0000;
    1.33 @@ -1653,7 +1654,8 @@
    1.34              Bmask = 0x000000FF;
    1.35              Amask = 0xFF000000;
    1.36  
    1.37 -            format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
    1.38 +            format =
    1.39 +                SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
    1.40              if (!format) {
    1.41                  SDL_SetError("Unknown pixel format");
    1.42                  return 0;
    1.43 @@ -1661,53 +1663,46 @@
    1.44  
    1.45              /* Search this format in the supported texture formats */
    1.46              /* by current renderer                                 */
    1.47 -            for (it=0; it<renderer->info.num_texture_formats; it++)
    1.48 -            {
    1.49 -                if (renderer->info.texture_formats[it]==format)
    1.50 -                {
    1.51 -                   break;
    1.52 +            for (it = 0; it < renderer->info.num_texture_formats; it++) {
    1.53 +                if (renderer->info.texture_formats[it] == format) {
    1.54 +                    break;
    1.55                  }
    1.56              }
    1.57  
    1.58              /* If this format can't be found, search any best       */
    1.59              /* compatible format with alpha which renderer provides */
    1.60 -            if (it==renderer->info.num_texture_formats)
    1.61 -            {
    1.62 -                apfmt=0;
    1.63 -                for (;;)
    1.64 -                {
    1.65 -                    if (sdl_alpha_pformats[apfmt]==SDL_PIXELFORMAT_UNKNOWN)
    1.66 -                    {
    1.67 +            if (it == renderer->info.num_texture_formats) {
    1.68 +                apfmt = 0;
    1.69 +                for (;;) {
    1.70 +                    if (sdl_alpha_pformats[apfmt] == SDL_PIXELFORMAT_UNKNOWN) {
    1.71                          break;
    1.72                      }
    1.73  
    1.74 -                    for (it=0; it<renderer->info.num_texture_formats; it++)
    1.75 -                    {
    1.76 -                       if (renderer->info.texture_formats[it]==sdl_alpha_pformats[apfmt])
    1.77 -                       {
    1.78 -                          break;
    1.79 -                       }
    1.80 +                    for (it = 0; it < renderer->info.num_texture_formats;
    1.81 +                         it++) {
    1.82 +                        if (renderer->info.texture_formats[it] ==
    1.83 +                            sdl_alpha_pformats[apfmt]) {
    1.84 +                            break;
    1.85 +                        }
    1.86                      }
    1.87  
    1.88 -                    if (it!=renderer->info.num_texture_formats)
    1.89 -                    {
    1.90 -                       /* Compatible format has been found */
    1.91 -                       break;
    1.92 +                    if (it != renderer->info.num_texture_formats) {
    1.93 +                        /* Compatible format has been found */
    1.94 +                        break;
    1.95                      }
    1.96                      apfmt++;
    1.97                  }
    1.98  
    1.99                  /* If compatible format can't be found, then return an error */
   1.100 -                if (it==renderer->info.num_texture_formats)
   1.101 -                {
   1.102 +                if (it == renderer->info.num_texture_formats) {
   1.103                      SDL_SetError("Compatible pixel format can't be found");
   1.104                      return 0;
   1.105                  }
   1.106  
   1.107                  /* Convert found pixel format back to color masks */
   1.108 -                if (SDL_PixelFormatEnumToMasks(renderer->info.texture_formats[it],
   1.109 -                       &bpp, &Rmask, &Gmask, &Bmask, &Amask)!=SDL_TRUE)
   1.110 -                {
   1.111 +                if (SDL_PixelFormatEnumToMasks
   1.112 +                    (renderer->info.texture_formats[it], &bpp, &Rmask, &Gmask,
   1.113 +                     &Bmask, &Amask) != SDL_TRUE) {
   1.114                      SDL_SetError("Unknown pixel format");
   1.115                      return 0;
   1.116                  }