test/testblitspeed.c
changeset 2267 c785543d1843
parent 1895 c121d94672cb
child 2669 e27bdcc80744
equal deleted inserted replaced
2266:e61ad15a205f 2267:c785543d1843
    89         printf("  width      : %d\n", surface->w);
    89         printf("  width      : %d\n", surface->w);
    90         printf("  height     : %d\n", surface->h);
    90         printf("  height     : %d\n", surface->h);
    91         printf("  depth      : %d bits per pixel\n",
    91         printf("  depth      : %d bits per pixel\n",
    92                surface->format->BitsPerPixel);
    92                surface->format->BitsPerPixel);
    93         printf("  pitch      : %d\n", (int) surface->pitch);
    93         printf("  pitch      : %d\n", (int) surface->pitch);
    94         printf("  alpha      : %d\n", (int) surface->format->alpha);
       
    95         printf("  colorkey   : 0x%X\n",
       
    96                (unsigned int) surface->format->colorkey);
       
    97 
    94 
    98         printf("  red bits   : 0x%08X mask, %d shift, %d loss\n",
    95         printf("  red bits   : 0x%08X mask, %d shift, %d loss\n",
    99                (int) surface->format->Rmask,
    96                (int) surface->format->Rmask,
   100                (int) surface->format->Rshift, (int) surface->format->Rloss);
    97                (int) surface->format->Rshift, (int) surface->format->Rloss);
   101         printf("  green bits : 0x%08X mask, %d shift, %d loss\n",
    98         printf("  green bits : 0x%08X mask, %d shift, %d loss\n",
   214     int srch = 480;
   211     int srch = 480;
   215     Uint32 origsrcalphaflags = 0;
   212     Uint32 origsrcalphaflags = 0;
   216     Uint32 origdstalphaflags = 0;
   213     Uint32 origdstalphaflags = 0;
   217     Uint32 srcalphaflags = 0;
   214     Uint32 srcalphaflags = 0;
   218     Uint32 dstalphaflags = 0;
   215     Uint32 dstalphaflags = 0;
   219     int srcalpha = 255;
   216     Uint8 origsrcalpha = 255;
   220     int dstalpha = 255;
   217     Uint8 origdstalpha = 255;
       
   218     Uint8 srcalpha = 255;
       
   219     Uint8 dstalpha = 255;
   221     int screenSurface = 0;
   220     int screenSurface = 0;
   222     int i = 0;
   221     int i = 0;
   223 
   222 
   224     for (i = 1; i < argc; i++) {
   223     for (i = 1; i < argc; i++) {
   225         const char *arg = argv[i];
   224         const char *arg = argv[i];
   311     srcalphaflags = (src->flags & SDL_SRCALPHA) | (src->flags & SDL_RLEACCEL);
   310     srcalphaflags = (src->flags & SDL_SRCALPHA) | (src->flags & SDL_RLEACCEL);
   312     dstalphaflags =
   311     dstalphaflags =
   313         (dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
   312         (dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
   314     origsrcalphaflags = srcalphaflags;
   313     origsrcalphaflags = srcalphaflags;
   315     origdstalphaflags = dstalphaflags;
   314     origdstalphaflags = dstalphaflags;
   316     srcalpha = src->format->alpha;
   315     SDL_GetSurfaceAlphaMod(src, &srcalpha);
   317     dstalpha = dest->format->alpha;
   316     SDL_GetSurfaceAlphaMod(dest, &dstalpha);
       
   317     origsrcalpha = srcalpha;
       
   318     origdstalpha = dstalpha;
   318     for (i = 1; i < argc; i++) {
   319     for (i = 1; i < argc; i++) {
   319         const char *arg = argv[i];
   320         const char *arg = argv[i];
   320 
   321 
   321         if (strcmp(arg, "--srcalpha") == 0)
   322         if (strcmp(arg, "--srcalpha") == 0)
   322             srcalpha = atoi(argv[++i]);
   323             srcalpha = atoi(argv[++i]);
   337         else if (strcmp(arg, "--dstrleaccel") == 0)
   338         else if (strcmp(arg, "--dstrleaccel") == 0)
   338             dstalphaflags |= SDL_RLEACCEL;
   339             dstalphaflags |= SDL_RLEACCEL;
   339         else if (strcmp(arg, "--dstnorleaccel") == 0)
   340         else if (strcmp(arg, "--dstnorleaccel") == 0)
   340             dstalphaflags &= ~SDL_RLEACCEL;
   341             dstalphaflags &= ~SDL_RLEACCEL;
   341     }
   342     }
   342     if ((dstalphaflags != origdstalphaflags)
   343     if ((dstalphaflags != origdstalphaflags) || (origdstalpha != dstalpha))
   343         || (dstalpha != dest->format->alpha))
   344         SDL_SetAlpha(dest, dstalphaflags, dstalpha);
   344         SDL_SetAlpha(dest, dstalphaflags, (Uint8) dstalpha);
   345     if ((srcalphaflags != origsrcalphaflags) || (origsrcalpha != srcalpha))
   345     if ((srcalphaflags != origsrcalphaflags)
   346         SDL_SetAlpha(src, srcalphaflags, srcalpha);
   346         || (srcalpha != src->format->alpha))
       
   347         SDL_SetAlpha(src, srcalphaflags, (Uint8) srcalpha);
       
   348 
   347 
   349     /* set some sane defaults so we can see if the blit code is broken... */
   348     /* set some sane defaults so we can see if the blit code is broken... */
   350     SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));
   349     SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));
   351     SDL_FillRect(src, NULL, SDL_MapRGB(src->format, 0, 0, 0));
   350     SDL_FillRect(src, NULL, SDL_MapRGB(src->format, 0, 0, 0));
   352 
   351