예제 #1
0
static void __append_sdl_surface_flag(SDL_Surface *_surface, char *str,
                                      size_t strsize, Uint32 flag,
                                      const char *flagstr)
{
    if (_surface->flags & flag)
        copy_trunc_str(str, strsize, flagstr);
}
예제 #2
0
static void
output_surface_details(const char *name, SDL_Surface * surface)
{
    printf("Details for %s:\n", name);

    if (surface == NULL) {
        printf("-WARNING- You've got a NULL surface!");
    } else {
        char f[256];
        printf("  width      : %d\n", surface->w);
        printf("  height     : %d\n", surface->h);
        printf("  depth      : %d bits per pixel\n",
               surface->format->BitsPerPixel);
        printf("  pitch      : %d\n", (int) surface->pitch);

        printf("  red bits   : 0x%08X mask, %d shift, %d loss\n",
               (int) surface->format->Rmask,
               (int) surface->format->Rshift, (int) surface->format->Rloss);
        printf("  green bits : 0x%08X mask, %d shift, %d loss\n",
               (int) surface->format->Gmask,
               (int) surface->format->Gshift, (int) surface->format->Gloss);
        printf("  blue bits  : 0x%08X mask, %d shift, %d loss\n",
               (int) surface->format->Bmask,
               (int) surface->format->Bshift, (int) surface->format->Bloss);
        printf("  alpha bits : 0x%08X mask, %d shift, %d loss\n",
               (int) surface->format->Amask,
               (int) surface->format->Ashift, (int) surface->format->Aloss);

        f[0] = '\0';

        /*append_sdl_surface_flag(surface, f, sizeof (f), SDL_SWSURFACE); */
        if ((surface->flags & SDL_HWSURFACE) == 0)
            copy_trunc_str(f, sizeof(f), " SDL_SWSURFACE");

        append_sdl_surface_flag(surface, f, sizeof(f), SDL_HWSURFACE);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_ASYNCBLIT);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_ANYFORMAT);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_HWPALETTE);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_DOUBLEBUF);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_FULLSCREEN);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_OPENGL);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_RESIZABLE);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_NOFRAME);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_HWACCEL);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_SRCCOLORKEY);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_RLEACCELOK);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_RLEACCEL);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_SRCALPHA);
        append_sdl_surface_flag(surface, f, sizeof(f), SDL_PREALLOC);

        if (f[0] == '\0')
            strcpy(f, " (none)");

        printf("  flags      :%s\n", f);
    }

    printf("\n");
}
예제 #3
0
static void output_surface_details(const char *name, SDL_Surface *surface)
{
    printf("Details for %s:\n", name);

    if (surface == NULL)
    {
        printf("-WARNING- You've got a NULL surface!");
    }
    else
    {
        char f[256];
        printf("  width  : %d\n", surface->w);
        printf("  height : %d\n", surface->h);
        printf("  depth  : %d bits per pixel\n", surface->format->BitsPerPixel);
        printf("  pitch  : %d\n", (int) surface->pitch);

        printf("  red    : 0x%08X mask, %d shift, %d loss\n",
                    (int) surface->format->Rmask,
                    (int) surface->format->Rshift,
                    (int) surface->format->Rloss);
        printf("  green  : 0x%08X mask, %d shift, %d loss\n",
                    (int) surface->format->Gmask,
                    (int) surface->format->Gshift,
                    (int) surface->format->Gloss);
        printf("  blue   : 0x%08X mask, %d shift, %d loss\n",
                    (int) surface->format->Bmask,
                    (int) surface->format->Bshift,
                    (int) surface->format->Bloss);
        printf("  alpha  : 0x%08X mask, %d shift, %d loss\n",
                    (int) surface->format->Amask,
                    (int) surface->format->Ashift,
                    (int) surface->format->Aloss);

        f[0] = '\0';

        /*append_sdl_surface_flag(surface, f, sizeof (f), SDL_SWSURFACE);*/
        if ((surface->flags & SDL_HWSURFACE) == 0)
            copy_trunc_str(f, sizeof (f), " SDL_SWSURFACE");

        append_sdl_surface_flag(surface, f, sizeof (f), SDL_HWSURFACE);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_ASYNCBLIT);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_ANYFORMAT);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_HWPALETTE);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_DOUBLEBUF);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_FULLSCREEN);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_OPENGL);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_OPENGLBLIT);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_RESIZABLE);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_NOFRAME);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_HWACCEL);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_SRCCOLORKEY);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_RLEACCELOK);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_RLEACCEL);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_SRCALPHA);
        append_sdl_surface_flag(surface, f, sizeof (f), SDL_PREALLOC);

        if (f[0] == '\0')
            strcpy(f, " (none)");

        printf("  flags  :%s\n", f);

        #if 0
        info = SDL_GetVideoInfo();
        assert(info != NULL);

        print_tf_state("hardware surface available", info->hw_available);
        print_tf_state("window manager available", info->wm_available);
        print_tf_state("accelerated hardware->hardware blits", info->blit_hw);
        print_tf_state("accelerated hardware->hardware colorkey blits", info->blit_hw_CC);
        print_tf_state("accelerated hardware->hardware alpha blits", info->blit_hw_A);
        print_tf_state("accelerated software->hardware blits", info->blit_sw);
        print_tf_state("accelerated software->hardware colorkey blits", info->blit_sw_CC);
        print_tf_state("accelerated software->hardware alpha blits", info->blit_sw_A);
        print_tf_state("accelerated color fills", info->blit_fill);

        printf("video memory: (%d)\n", info->video_mem);
        #endif
    } /* else */

    printf("\n");
}