test/testblitspeed.c
changeset 2267 c785543d1843
parent 1895 c121d94672cb
child 2669 e27bdcc80744
     1.1 --- a/test/testblitspeed.c	Sat Aug 18 01:44:21 2007 +0000
     1.2 +++ b/test/testblitspeed.c	Sat Aug 18 05:39:09 2007 +0000
     1.3 @@ -91,9 +91,6 @@
     1.4          printf("  depth      : %d bits per pixel\n",
     1.5                 surface->format->BitsPerPixel);
     1.6          printf("  pitch      : %d\n", (int) surface->pitch);
     1.7 -        printf("  alpha      : %d\n", (int) surface->format->alpha);
     1.8 -        printf("  colorkey   : 0x%X\n",
     1.9 -               (unsigned int) surface->format->colorkey);
    1.10  
    1.11          printf("  red bits   : 0x%08X mask, %d shift, %d loss\n",
    1.12                 (int) surface->format->Rmask,
    1.13 @@ -216,8 +213,10 @@
    1.14      Uint32 origdstalphaflags = 0;
    1.15      Uint32 srcalphaflags = 0;
    1.16      Uint32 dstalphaflags = 0;
    1.17 -    int srcalpha = 255;
    1.18 -    int dstalpha = 255;
    1.19 +    Uint8 origsrcalpha = 255;
    1.20 +    Uint8 origdstalpha = 255;
    1.21 +    Uint8 srcalpha = 255;
    1.22 +    Uint8 dstalpha = 255;
    1.23      int screenSurface = 0;
    1.24      int i = 0;
    1.25  
    1.26 @@ -313,8 +312,10 @@
    1.27          (dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
    1.28      origsrcalphaflags = srcalphaflags;
    1.29      origdstalphaflags = dstalphaflags;
    1.30 -    srcalpha = src->format->alpha;
    1.31 -    dstalpha = dest->format->alpha;
    1.32 +    SDL_GetSurfaceAlphaMod(src, &srcalpha);
    1.33 +    SDL_GetSurfaceAlphaMod(dest, &dstalpha);
    1.34 +    origsrcalpha = srcalpha;
    1.35 +    origdstalpha = dstalpha;
    1.36      for (i = 1; i < argc; i++) {
    1.37          const char *arg = argv[i];
    1.38  
    1.39 @@ -339,12 +340,10 @@
    1.40          else if (strcmp(arg, "--dstnorleaccel") == 0)
    1.41              dstalphaflags &= ~SDL_RLEACCEL;
    1.42      }
    1.43 -    if ((dstalphaflags != origdstalphaflags)
    1.44 -        || (dstalpha != dest->format->alpha))
    1.45 -        SDL_SetAlpha(dest, dstalphaflags, (Uint8) dstalpha);
    1.46 -    if ((srcalphaflags != origsrcalphaflags)
    1.47 -        || (srcalpha != src->format->alpha))
    1.48 -        SDL_SetAlpha(src, srcalphaflags, (Uint8) srcalpha);
    1.49 +    if ((dstalphaflags != origdstalphaflags) || (origdstalpha != dstalpha))
    1.50 +        SDL_SetAlpha(dest, dstalphaflags, dstalpha);
    1.51 +    if ((srcalphaflags != origsrcalphaflags) || (origsrcalpha != srcalpha))
    1.52 +        SDL_SetAlpha(src, srcalphaflags, srcalpha);
    1.53  
    1.54      /* set some sane defaults so we can see if the blit code is broken... */
    1.55      SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));