test/testvidinfo.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
child 1725 98a3207ddde8
--- a/test/testvidinfo.c	Mon May 29 03:53:21 2006 +0000
+++ b/test/testvidinfo.c	Mon May 29 04:04:35 2006 +0000
@@ -17,36 +17,36 @@
 
 #if 0
 void
-PrintFlags (Uint32 flags)
+PrintFlags(Uint32 flags)
 {
-    printf ("0x%8.8x", (flags & FLAG_MASK));
+    printf("0x%8.8x", (flags & FLAG_MASK));
     if (flags & SDL_HWSURFACE) {
-        printf (" SDL_HWSURFACE");
+        printf(" SDL_HWSURFACE");
     } else {
-        printf (" SDL_SWSURFACE");
+        printf(" SDL_SWSURFACE");
     }
     if (flags & SDL_FULLSCREEN) {
-        printf (" | SDL_FULLSCREEN");
+        printf(" | SDL_FULLSCREEN");
     }
     if (flags & SDL_DOUBLEBUF) {
-        printf (" | SDL_DOUBLEBUF");
+        printf(" | SDL_DOUBLEBUF");
     }
     if (flags & SDL_SRCCOLORKEY) {
-        printf (" | SDL_SRCCOLORKEY");
+        printf(" | SDL_SRCCOLORKEY");
     }
     if (flags & SDL_SRCALPHA) {
-        printf (" | SDL_SRCALPHA");
+        printf(" | SDL_SRCALPHA");
     }
     if (flags & SDL_RLEACCEL) {
-        printf (" | SDL_RLEACCEL");
+        printf(" | SDL_RLEACCEL");
     }
     if (flags & SDL_RLEACCELOK) {
-        printf (" | SDL_RLEACCELOK");
+        printf(" | SDL_RLEACCELOK");
     }
 }
 
 int
-RunBlitTests (SDL_Surface * screen, SDL_Surface * bmp, int blitcount)
+RunBlitTests(SDL_Surface * screen, SDL_Surface * bmp, int blitcount)
 {
     int i, j;
     int maxx;
@@ -58,27 +58,27 @@
     for (i = 0; i < NUM_UPDATES; ++i) {
         for (j = 0; j < blitcount; ++j) {
             if (maxx) {
-                dst.x = rand () % maxx;
+                dst.x = rand() % maxx;
             } else {
                 dst.x = 0;
             }
             if (maxy) {
-                dst.y = rand () % maxy;
+                dst.y = rand() % maxy;
             } else {
                 dst.y = 0;
             }
             dst.w = bmp->w;
             dst.h = bmp->h;
-            SDL_BlitSurface (bmp, NULL, screen, &dst);
+            SDL_BlitSurface(bmp, NULL, screen, &dst);
         }
-        SDL_Flip (screen);
+        SDL_Flip(screen);
     }
 
     return i;
 }
 
 int
-RunModeTests (SDL_Surface * screen)
+RunModeTests(SDL_Surface * screen)
 {
     Uint32 then, now;
     Uint32 frames;
@@ -88,212 +88,208 @@
     SDL_Surface *bmp, *bmpcc, *tmp;
     SDL_Event event;
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* First test fills and screen update speed */
-    printf ("Running color fill and fullscreen update test\n");
-    then = SDL_GetTicks ();
+    printf("Running color fill and fullscreen update test\n");
+    then = SDL_GetTicks();
     frames = 0;
     for (i = 0; i < 256; ++i) {
         r = i;
         g = 0;
         b = 0;
-        SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, r, g, b));
-        SDL_Flip (screen);
+        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
+        SDL_Flip(screen);
         ++frames;
     }
     for (i = 0; i < 256; ++i) {
         r = 0;
         g = i;
         b = 0;
-        SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, r, g, b));
-        SDL_Flip (screen);
+        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
+        SDL_Flip(screen);
         ++frames;
     }
     for (i = 0; i < 256; ++i) {
         r = 0;
         g = 0;
         b = i;
-        SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, r, g, b));
-        SDL_Flip (screen);
+        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
+        SDL_Flip(screen);
         ++frames;
     }
-    now = SDL_GetTicks ();
+    now = SDL_GetTicks();
     seconds = (float) (now - then) / 1000.0f;
     if (seconds > 0.0f) {
-        printf ("%d fills and flips in %2.2f seconds, %2.2f FPS\n", frames,
-                seconds, (float) frames / seconds);
+        printf("%d fills and flips in %2.2f seconds, %2.2f FPS\n", frames,
+               seconds, (float) frames / seconds);
     } else {
-        printf ("%d fills and flips in zero seconds!n", frames);
+        printf("%d fills and flips in zero seconds!n", frames);
     }
 
     /* clear the screen after fill test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the generic blit test */
-    bmp = SDL_LoadBMP ("sample.bmp");
+    bmp = SDL_LoadBMP("sample.bmp");
     if (!bmp) {
-        printf ("Couldn't load sample.bmp: %s\n", SDL_GetError ());
+        printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
         return 0;
     }
-    printf ("Running freshly loaded blit test: %dx%d at %d bpp, flags: ",
-            bmp->w, bmp->h, bmp->format->BitsPerPixel);
-    PrintFlags (bmp->flags);
-    printf ("\n");
-    then = SDL_GetTicks ();
-    frames = RunBlitTests (screen, bmp, NUM_BLITS);
-    now = SDL_GetTicks ();
+    printf("Running freshly loaded blit test: %dx%d at %d bpp, flags: ",
+           bmp->w, bmp->h, bmp->format->BitsPerPixel);
+    PrintFlags(bmp->flags);
+    printf("\n");
+    then = SDL_GetTicks();
+    frames = RunBlitTests(screen, bmp, NUM_BLITS);
+    now = SDL_GetTicks();
     seconds = (float) (now - then) / 1000.0f;
     if (seconds > 0.0f) {
-        printf ("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n",
-                NUM_BLITS * frames, frames, seconds,
-                (float) frames / seconds);
+        printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n",
+               NUM_BLITS * frames, frames, seconds, (float) frames / seconds);
     } else {
-        printf ("%d blits / %d updates in zero seconds!\n",
-                NUM_BLITS * frames, frames);
+        printf("%d blits / %d updates in zero seconds!\n",
+               NUM_BLITS * frames, frames);
     }
 
     /* clear the screen after blit test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the colorkeyed blit test */
-    bmpcc = SDL_LoadBMP ("sample.bmp");
+    bmpcc = SDL_LoadBMP("sample.bmp");
     if (!bmpcc) {
-        printf ("Couldn't load sample.bmp: %s\n", SDL_GetError ());
+        printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
         return 0;
     }
-    printf ("Running freshly loaded cc blit test: %dx%d at %d bpp, flags: ",
-            bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
-    SDL_SetColorKey (bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL,
-                     *(Uint8 *) bmpcc->pixels);
+    printf("Running freshly loaded cc blit test: %dx%d at %d bpp, flags: ",
+           bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
+    SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL,
+                    *(Uint8 *) bmpcc->pixels);
 
-    PrintFlags (bmpcc->flags);
-    printf ("\n");
-    then = SDL_GetTicks ();
-    frames = RunBlitTests (screen, bmpcc, NUM_BLITS);
-    now = SDL_GetTicks ();
+    PrintFlags(bmpcc->flags);
+    printf("\n");
+    then = SDL_GetTicks();
+    frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
+    now = SDL_GetTicks();
     seconds = (float) (now - then) / 1000.0f;
     if (seconds > 0.0f) {
-        printf ("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n",
-                NUM_BLITS * frames, frames, seconds,
-                (float) frames / seconds);
+        printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n",
+               NUM_BLITS * frames, frames, seconds, (float) frames / seconds);
     } else {
-        printf ("%d cc blits / %d updates in zero seconds!\n",
-                NUM_BLITS * frames, frames);
+        printf("%d cc blits / %d updates in zero seconds!\n",
+               NUM_BLITS * frames, frames);
     }
 
     /* clear the screen after cc blit test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the generic blit test */
     tmp = bmp;
-    bmp = SDL_DisplayFormat (bmp);
-    SDL_FreeSurface (tmp);
+    bmp = SDL_DisplayFormat(bmp);
+    SDL_FreeSurface(tmp);
     if (!bmp) {
-        printf ("Couldn't convert sample.bmp: %s\n", SDL_GetError ());
+        printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
         return 0;
     }
-    printf ("Running display format blit test: %dx%d at %d bpp, flags: ",
-            bmp->w, bmp->h, bmp->format->BitsPerPixel);
-    PrintFlags (bmp->flags);
-    printf ("\n");
-    then = SDL_GetTicks ();
-    frames = RunBlitTests (screen, bmp, NUM_BLITS);
-    now = SDL_GetTicks ();
+    printf("Running display format blit test: %dx%d at %d bpp, flags: ",
+           bmp->w, bmp->h, bmp->format->BitsPerPixel);
+    PrintFlags(bmp->flags);
+    printf("\n");
+    then = SDL_GetTicks();
+    frames = RunBlitTests(screen, bmp, NUM_BLITS);
+    now = SDL_GetTicks();
     seconds = (float) (now - then) / 1000.0f;
     if (seconds > 0.0f) {
-        printf ("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n",
-                NUM_BLITS * frames, frames, seconds,
-                (float) frames / seconds);
+        printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n",
+               NUM_BLITS * frames, frames, seconds, (float) frames / seconds);
     } else {
-        printf ("%d blits / %d updates in zero seconds!\n",
-                NUM_BLITS * frames, frames);
+        printf("%d blits / %d updates in zero seconds!\n",
+               NUM_BLITS * frames, frames);
     }
 
     /* clear the screen after blit test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the colorkeyed blit test */
     tmp = bmpcc;
-    bmpcc = SDL_DisplayFormat (bmpcc);
-    SDL_FreeSurface (tmp);
+    bmpcc = SDL_DisplayFormat(bmpcc);
+    SDL_FreeSurface(tmp);
     if (!bmpcc) {
-        printf ("Couldn't convert sample.bmp: %s\n", SDL_GetError ());
+        printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
         return 0;
     }
-    printf ("Running display format cc blit test: %dx%d at %d bpp, flags: ",
-            bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
-    PrintFlags (bmpcc->flags);
-    printf ("\n");
-    then = SDL_GetTicks ();
-    frames = RunBlitTests (screen, bmpcc, NUM_BLITS);
-    now = SDL_GetTicks ();
+    printf("Running display format cc blit test: %dx%d at %d bpp, flags: ",
+           bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
+    PrintFlags(bmpcc->flags);
+    printf("\n");
+    then = SDL_GetTicks();
+    frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
+    now = SDL_GetTicks();
     seconds = (float) (now - then) / 1000.0f;
     if (seconds > 0.0f) {
-        printf ("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n",
-                NUM_BLITS * frames, frames, seconds,
-                (float) frames / seconds);
+        printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n",
+               NUM_BLITS * frames, frames, seconds, (float) frames / seconds);
     } else {
-        printf ("%d cc blits / %d updates in zero seconds!\n",
-                NUM_BLITS * frames, frames);
+        printf("%d cc blits / %d updates in zero seconds!\n",
+               NUM_BLITS * frames, frames);
     }
 
     /* clear the screen after cc blit test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the alpha blit test only if screen bpp>8 */
     if (bmp->format->BitsPerPixel > 8) {
-        SDL_FreeSurface (bmp);
-        bmp = SDL_LoadBMP ("sample.bmp");
-        SDL_SetAlpha (bmp, SDL_SRCALPHA, 85);   /* 85 - 33% alpha */
+        SDL_FreeSurface(bmp);
+        bmp = SDL_LoadBMP("sample.bmp");
+        SDL_SetAlpha(bmp, SDL_SRCALPHA, 85);    /* 85 - 33% alpha */
         tmp = bmp;
-        bmp = SDL_DisplayFormat (bmp);
-        SDL_FreeSurface (tmp);
+        bmp = SDL_DisplayFormat(bmp);
+        SDL_FreeSurface(tmp);
         if (!bmp) {
-            printf ("Couldn't convert sample.bmp: %s\n", SDL_GetError ());
+            printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
             return 0;
         }
         printf
             ("Running display format alpha blit test: %dx%d at %d bpp, flags: ",
              bmp->w, bmp->h, bmp->format->BitsPerPixel);
-        PrintFlags (bmp->flags);
-        printf ("\n");
-        then = SDL_GetTicks ();
-        frames = RunBlitTests (screen, bmp, NUM_BLITS);
-        now = SDL_GetTicks ();
+        PrintFlags(bmp->flags);
+        printf("\n");
+        then = SDL_GetTicks();
+        frames = RunBlitTests(screen, bmp, NUM_BLITS);
+        now = SDL_GetTicks();
         seconds = (float) (now - then) / 1000.0f;
         if (seconds > 0.0f) {
             printf
@@ -301,42 +297,42 @@
                  NUM_BLITS * frames, frames, seconds,
                  (float) frames / seconds);
         } else {
-            printf ("%d alpha blits / %d updates in zero seconds!\n",
-                    NUM_BLITS * frames, frames);
+            printf("%d alpha blits / %d updates in zero seconds!\n",
+                   NUM_BLITS * frames, frames);
         }
     }
 
     /* clear the screen after alpha blit test */
-    SDL_FillRect (screen, NULL, SDL_MapRGB (screen->format, 0, 0, 0));
-    SDL_Flip (screen);
+    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+    SDL_Flip(screen);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
 
     /* run the cc+alpha blit test only if screen bpp>8 */
     if (bmp->format->BitsPerPixel > 8) {
-        SDL_FreeSurface (bmpcc);
-        bmpcc = SDL_LoadBMP ("sample.bmp");
-        SDL_SetAlpha (bmpcc, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
-        SDL_SetColorKey (bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL,
-                         *(Uint8 *) bmpcc->pixels);
+        SDL_FreeSurface(bmpcc);
+        bmpcc = SDL_LoadBMP("sample.bmp");
+        SDL_SetAlpha(bmpcc, SDL_SRCALPHA, 85);  /* 85 - 33% alpha */
+        SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL,
+                        *(Uint8 *) bmpcc->pixels);
         tmp = bmpcc;
-        bmpcc = SDL_DisplayFormat (bmpcc);
-        SDL_FreeSurface (tmp);
+        bmpcc = SDL_DisplayFormat(bmpcc);
+        SDL_FreeSurface(tmp);
         if (!bmpcc) {
-            printf ("Couldn't convert sample.bmp: %s\n", SDL_GetError ());
+            printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
             return 0;
         }
         printf
             ("Running display format cc+alpha blit test: %dx%d at %d bpp, flags: ",
              bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
-        PrintFlags (bmpcc->flags);
-        printf ("\n");
-        then = SDL_GetTicks ();
-        frames = RunBlitTests (screen, bmpcc, NUM_BLITS);
-        now = SDL_GetTicks ();
+        PrintFlags(bmpcc->flags);
+        printf("\n");
+        then = SDL_GetTicks();
+        frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
+        now = SDL_GetTicks();
         seconds = (float) (now - then) / 1000.0f;
         if (seconds > 0.0f) {
             printf
@@ -344,15 +340,15 @@
                  NUM_BLITS * frames, frames, seconds,
                  (float) frames / seconds);
         } else {
-            printf ("%d cc+alpha blits / %d updates in zero seconds!\n",
-                    NUM_BLITS * frames, frames);
+            printf("%d cc+alpha blits / %d updates in zero seconds!\n",
+                   NUM_BLITS * frames, frames);
         }
     }
 
-    SDL_FreeSurface (bmpcc);
-    SDL_FreeSurface (bmp);
+    SDL_FreeSurface(bmpcc);
+    SDL_FreeSurface(bmp);
 
-    while (SDL_PollEvent (&event)) {
+    while (SDL_PollEvent(&event)) {
         if (event.type == SDL_KEYDOWN)
             return 0;
     }
@@ -360,7 +356,7 @@
 }
 
 void
-RunVideoTests ()
+RunVideoTests()
 {
     static const struct
     {
@@ -387,29 +383,29 @@
     SDL_Surface *screen;
 
     /* Test out several different video mode combinations */
-    SDL_WM_SetCaption ("SDL Video Benchmark", "vidtest");
-    SDL_ShowCursor (0);
-    for (i = 0; i < SDL_TABLESIZE (mode_list); ++i) {
-        for (j = 0; j < SDL_TABLESIZE (flags); ++j) {
-            printf ("===================================\n");
-            printf ("Setting video mode: %dx%d at %d bpp, flags: ",
-                    mode_list[i].w, mode_list[i].h, mode_list[i].bpp);
-            PrintFlags (flags[j]);
-            printf ("\n");
-            screen = SDL_SetVideoMode (mode_list[i].w,
-                                       mode_list[i].h,
-                                       mode_list[i].bpp, flags[j]);
+    SDL_WM_SetCaption("SDL Video Benchmark", "vidtest");
+    SDL_ShowCursor(0);
+    for (i = 0; i < SDL_TABLESIZE(mode_list); ++i) {
+        for (j = 0; j < SDL_TABLESIZE(flags); ++j) {
+            printf("===================================\n");
+            printf("Setting video mode: %dx%d at %d bpp, flags: ",
+                   mode_list[i].w, mode_list[i].h, mode_list[i].bpp);
+            PrintFlags(flags[j]);
+            printf("\n");
+            screen = SDL_SetVideoMode(mode_list[i].w,
+                                      mode_list[i].h,
+                                      mode_list[i].bpp, flags[j]);
             if (!screen) {
-                printf ("Setting video mode failed: %s\n", SDL_GetError ());
+                printf("Setting video mode failed: %s\n", SDL_GetError());
                 continue;
             }
             if ((screen->flags & FLAG_MASK) != flags[j]) {
-                printf ("Flags didn't match: ");
-                PrintFlags (screen->flags);
-                printf ("\n");
+                printf("Flags didn't match: ");
+                PrintFlags(screen->flags);
+                printf("\n");
                 continue;
             }
-            if (!RunModeTests (screen)) {
+            if (!RunModeTests(screen)) {
                 return;
             }
         }
@@ -418,7 +414,7 @@
 #endif
 
 int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
 {
     const SDL_VideoInfo *info;
     int i, n;
@@ -429,78 +425,78 @@
     int nmodes;
 
     /* Print available video drivers */
-    n = SDL_GetNumVideoDrivers ();
+    n = SDL_GetNumVideoDrivers();
     if (n == 0) {
-        printf ("No built-in video drivers\n");
+        printf("No built-in video drivers\n");
     } else {
-        printf ("Built-in video drivers:");
+        printf("Built-in video drivers:");
         for (i = 0; i < n; ++i) {
             if (i > 0) {
-                printf (",");
+                printf(",");
             }
-            printf (" %s", SDL_GetVideoDriver (i));
+            printf(" %s", SDL_GetVideoDriver(i));
         }
-        printf ("\n");
+        printf("\n");
     }
 
-    if (SDL_Init (SDL_INIT_VIDEO) < 0) {
-        fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ());
-        exit (1);
+    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
+        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        exit(1);
     }
-    driver = SDL_GetCurrentVideoDriver ();
+    driver = SDL_GetCurrentVideoDriver();
     if (driver) {
-        printf ("Video driver: %s\n", driver);
+        printf("Video driver: %s\n", driver);
     }
-    printf ("Number of displays: %d\n", SDL_GetNumVideoDisplays ());
-    mode = SDL_GetDesktopDisplayMode ();
-    SDL_PixelFormatEnumToMasks (mode->format, &bpp, &Rmask, &Gmask, &Bmask,
-                                &Amask);
-    printf ("Current display: %dx%d@%dHz, %d bits-per-pixel\n", mode->w,
-            mode->h, mode->refresh_rate, bpp);
+    printf("Number of displays: %d\n", SDL_GetNumVideoDisplays());
+    mode = SDL_GetDesktopDisplayMode();
+    SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask,
+                               &Amask);
+    printf("Current display: %dx%d@%dHz, %d bits-per-pixel\n", mode->w,
+           mode->h, mode->refresh_rate, bpp);
     if (Rmask || Gmask || Bmask) {
-        printf ("	Red Mask = 0x%.8x\n", Rmask);
-        printf ("	Green Mask = 0x%.8x\n", Gmask);
-        printf ("	Blue Mask = 0x%.8x\n", Bmask);
+        printf("	Red Mask = 0x%.8x\n", Rmask);
+        printf("	Green Mask = 0x%.8x\n", Gmask);
+        printf("	Blue Mask = 0x%.8x\n", Bmask);
         if (Amask)
-            printf ("	Alpha Mask = 0x%.8x\n", Amask);
+            printf("	Alpha Mask = 0x%.8x\n", Amask);
     }
     /* Print available fullscreen video modes */
-    nmodes = SDL_GetNumDisplayModes ();
+    nmodes = SDL_GetNumDisplayModes();
     if (nmodes == 0) {
-        printf ("No available fullscreen video modes\n");
+        printf("No available fullscreen video modes\n");
     } else {
-        printf ("Fullscreen video modes:\n");
+        printf("Fullscreen video modes:\n");
         for (i = 0; i < nmodes; ++i) {
-            mode = SDL_GetDisplayMode (i);
-            SDL_PixelFormatEnumToMasks (mode->format, &bpp, &Rmask,
-                                        &Gmask, &Bmask, &Amask);
-            printf ("Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
-                    mode->w, mode->h, mode->refresh_rate, bpp);
+            mode = SDL_GetDisplayMode(i);
+            SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask,
+                                       &Gmask, &Bmask, &Amask);
+            printf("Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i,
+                   mode->w, mode->h, mode->refresh_rate, bpp);
             if (Rmask || Gmask || Bmask) {
-                printf ("	Red Mask = 0x%.8x\n", Rmask);
-                printf ("	Green Mask = 0x%.8x\n", Gmask);
-                printf ("	Blue Mask = 0x%.8x\n", Bmask);
+                printf("	Red Mask = 0x%.8x\n", Rmask);
+                printf("	Green Mask = 0x%.8x\n", Gmask);
+                printf("	Blue Mask = 0x%.8x\n", Bmask);
                 if (Amask)
-                    printf ("	Alpha Mask = 0x%.8x\n", Amask);
+                    printf("	Alpha Mask = 0x%.8x\n", Amask);
             }
         }
     }
-    info = SDL_GetVideoInfo ();
+    info = SDL_GetVideoInfo();
     if (info->wm_available) {
-        printf ("A window manager is available\n");
+        printf("A window manager is available\n");
     }
     if (info->hw_available) {
-        printf ("Hardware surfaces are available (%dK video memory)\n",
-                info->video_mem);
+        printf("Hardware surfaces are available (%dK video memory)\n",
+               info->video_mem);
     }
     if (info->blit_hw) {
-        printf ("Copy blits between hardware surfaces are accelerated\n");
+        printf("Copy blits between hardware surfaces are accelerated\n");
     }
     if (info->blit_hw_CC) {
-        printf ("Colorkey blits between hardware surfaces are accelerated\n");
+        printf("Colorkey blits between hardware surfaces are accelerated\n");
     }
     if (info->blit_hw_A) {
-        printf ("Alpha blits between hardware surfaces are accelerated\n");
+        printf("Alpha blits between hardware surfaces are accelerated\n");
     }
     if (info->blit_sw) {
         printf
@@ -515,14 +511,14 @@
             ("Alpha blits from software surfaces to hardware surfaces are accelerated\n");
     }
     if (info->blit_fill) {
-        printf ("Color fills on hardware surfaces are accelerated\n");
+        printf("Color fills on hardware surfaces are accelerated\n");
     }
 #if 0
-    if (argv[1] && (strcmp (argv[1], "-benchmark") == 0)) {
-        RunVideoTests ();
+    if (argv[1] && (strcmp(argv[1], "-benchmark") == 0)) {
+        RunVideoTests();
     }
 #endif
 
-    SDL_Quit ();
+    SDL_Quit();
     return (0);
 }