src/video/dummy/SDL_nullvideo.c
branchSDL-1.3
changeset 1669 9857d21967bb
parent 1668 4da1ee79c9af
child 1676 e136f3ffdc1b
equal deleted inserted replaced
1668:4da1ee79c9af 1669:9857d21967bb
    51 /* Initialization/Query functions */
    51 /* Initialization/Query functions */
    52 static int DUMMY_VideoInit(_THIS);
    52 static int DUMMY_VideoInit(_THIS);
    53 static int DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
    53 static int DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
    54 static void DUMMY_CreateWindowSurface(_THIS, SDL_Window * window,
    54 static void DUMMY_CreateWindowSurface(_THIS, SDL_Window * window,
    55                                       Uint32 flags);
    55                                       Uint32 flags);
       
    56 static void DUMMY_UpdateWindowSurface(_THIS, SDL_Window * window,
       
    57                                       int numrects, SDL_Rect * rects);
    56 static void DUMMY_VideoQuit(_THIS);
    58 static void DUMMY_VideoQuit(_THIS);
    57 
    59 
    58 /* DUMMY driver bootstrap functions */
    60 /* DUMMY driver bootstrap functions */
    59 
    61 
    60 static int
    62 static int
    98 
   100 
    99     /* Set the function pointers */
   101     /* Set the function pointers */
   100     device->VideoInit = DUMMY_VideoInit;
   102     device->VideoInit = DUMMY_VideoInit;
   101     device->SetDisplayMode = DUMMY_SetDisplayMode;
   103     device->SetDisplayMode = DUMMY_SetDisplayMode;
   102     device->CreateWindowSurface = DUMMY_CreateWindowSurface;
   104     device->CreateWindowSurface = DUMMY_CreateWindowSurface;
       
   105     device->UpdateWindowSurface = DUMMY_UpdateWindowSurface;
   103     device->VideoQuit = DUMMY_VideoQuit;
   106     device->VideoQuit = DUMMY_VideoQuit;
   104     device->InitOSKeymap = DUMMY_InitOSKeymap;
   107     device->InitOSKeymap = DUMMY_InitOSKeymap;
   105     device->PumpEvents = DUMMY_PumpEvents;
   108     device->PumpEvents = DUMMY_PumpEvents;
   106 
   109 
   107     device->free = DUMMY_DeleteDevice;
   110     device->free = DUMMY_DeleteDevice;
   130 }
   133 }
   131 
   134 
   132 static int
   135 static int
   133 DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
   136 DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
   134 {
   137 {
       
   138     SDL_CurrentDisplay.current_mode = *mode;
   135     return 0;
   139     return 0;
   136 }
   140 }
   137 
   141 
   138 static void
   142 static void
   139 DUMMY_CreateWindowSurface(_THIS, SDL_Window * window, Uint32 flags)
   143 DUMMY_CreateWindowSurface(_THIS, SDL_Window * window, Uint32 flags)
   146     window->surface =
   150     window->surface =
   147         SDL_CreateRGBSurface(flags, window->w, window->h, bpp, Rmask, Gmask,
   151         SDL_CreateRGBSurface(flags, window->w, window->h, bpp, Rmask, Gmask,
   148                              Bmask, Amask);
   152                              Bmask, Amask);
   149 }
   153 }
   150 
   154 
       
   155 static void
       
   156 DUMMY_UpdateWindowSurface(_THIS, SDL_Window * window, int numrects,
       
   157                           SDL_Rect * rects)
       
   158 {
       
   159     static int frame_number;
       
   160     if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
       
   161         char file[128];
       
   162         SDL_snprintf(file, sizeof(file), "SDL_screen-%8.8d.bmp",
       
   163                      ++frame_number);
       
   164         SDL_SaveBMP(window->surface, file);
       
   165     }
       
   166 }
       
   167 
   151 /* Note:  If we are terminated, this could be called in the middle of
   168 /* Note:  If we are terminated, this could be called in the middle of
   152    another SDL video routine -- notably UpdateRects.
   169    another SDL video routine -- notably UpdateRects.
   153 */
   170 */
   154 void
   171 void
   155 DUMMY_VideoQuit(_THIS)
   172 DUMMY_VideoQuit(_THIS)