test/testoverlay2.c
changeset 5264 7ace5f8f432f
parent 5252 ec30f9d4c2a8
child 5274 07559b6cb64f
     1.1 --- a/test/testoverlay2.c	Fri Feb 11 23:02:35 2011 -0800
     1.2 +++ b/test/testoverlay2.c	Sat Feb 12 00:25:02 2011 -0800
     1.3 @@ -360,7 +360,7 @@
     1.4      int fps = 12;
     1.5      int fpsdelay;
     1.6      int nodelay = 0;
     1.7 -    int overlay_format = SDL_YUY2_OVERLAY;
     1.8 +    Uint32 pixel_format = SDL_PIXELFORMAT_YV12;
     1.9      int scale = 5;
    1.10      SDL_bool done = SDL_FALSE;
    1.11  
    1.12 @@ -397,15 +397,15 @@
    1.13          } else if (strcmp(argv[1], "-format") == 0) {
    1.14              if (argv[2]) {
    1.15                  if (!strcmp(argv[2], "YV12"))
    1.16 -                    overlay_format = SDL_YV12_OVERLAY;
    1.17 +                    pixel_format = SDL_PIXELFORMAT_YV12;
    1.18                  else if (!strcmp(argv[2], "IYUV"))
    1.19 -                    overlay_format = SDL_IYUV_OVERLAY;
    1.20 +                    pixel_format = SDL_PIXELFORMAT_IYUV;
    1.21                  else if (!strcmp(argv[2], "YUY2"))
    1.22 -                    overlay_format = SDL_YUY2_OVERLAY;
    1.23 +                    pixel_format = SDL_PIXELFORMAT_YUY2;
    1.24                  else if (!strcmp(argv[2], "UYVY"))
    1.25 -                    overlay_format = SDL_UYVY_OVERLAY;
    1.26 +                    pixel_format = SDL_PIXELFORMAT_UYVY;
    1.27                  else if (!strcmp(argv[2], "YVYU"))
    1.28 -                    overlay_format = SDL_YVYU_OVERLAY;
    1.29 +                    pixel_format = SDL_PIXELFORMAT_YVYU;
    1.30                  else {
    1.31                      fprintf(stderr,
    1.32                              "The -format option %s is not recognized, see help for info.\n",
    1.33 @@ -490,7 +490,7 @@
    1.34          quit(4);
    1.35      }
    1.36  
    1.37 -    MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
    1.38 +    MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
    1.39      if (!MooseTexture) {
    1.40          fprintf(stderr, "Couldn't set create texture: %s\n", SDL_GetError());
    1.41          free(RawMooseData);
    1.42 @@ -569,7 +569,7 @@
    1.43          if (!paused) {
    1.44              i = (i + 1) % MOOSEFRAMES_COUNT;
    1.45  
    1.46 -            SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*2);
    1.47 +            SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format));
    1.48          }
    1.49          SDL_RenderClear(renderer);
    1.50          SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);