Home | History | Annotate | Download | only in nanox
      1 /*
      2     SDL - Simple DirectMedia Layer
      3     Copyright (C) 1997-2012 Sam Lantinga
      4     Copyright (C) 2001  Hsieh-Fu Tsai
      5 
      6     This library is free software; you can redistribute it and/or
      7     modify it under the terms of the GNU Library General Public
      8     License as published by the Free Software Foundation; either
      9     version 2 of the License, or (at your option) any later version.
     10 
     11     This library is distributed in the hope that it will be useful,
     12     but WITHOUT ANY WARRANTY; without even the implied warranty of
     13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14     Library General Public License for more details.
     15 
     16     You should have received a copy of the GNU Library General Public
     17     License along with this library; if not, write to the Free
     18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     19 
     20     Sam Lantinga
     21     slouken (at) libsdl.org
     22 
     23     Hsieh-Fu Tsai
     24     clare (at) setabox.com
     25 */
     26 #include "SDL_config.h"
     27 
     28 #ifndef _SDL_nxvideo_h
     29 #define _SDL_nxvideo_h
     30 
     31 #include <microwin/nano-X.h>
     32 
     33 #include "../SDL_sysvideo.h"
     34 
     35 #ifdef ENABLE_NANOX_DEBUG
     36 #define Dprintf printf
     37 #else
     38 #define Dprintf(ignore...)
     39 #endif
     40 
     41 // Hidden "this" pointer for the video functions
     42 #define _THIS   SDL_VideoDevice * this
     43 
     44 // Private display data
     45 typedef struct NX_SDL_VISUAL {
     46     int    bpp ;
     47     Uint32 red_mask ;
     48     Uint32 green_mask ;
     49     Uint32 blue_mask ;
     50 } nx_sdl_visual_t ;
     51 
     52 struct SDL_PrivateVideoData {
     53     GR_WINDOW_ID    SDL_Window ;
     54     GR_WINDOW_ID    FSwindow ;
     55     // Flag: true if we have been passed a window
     56     char            * SDL_windowid ;
     57     GR_GC_ID        GC ;
     58     unsigned char   * Image ;
     59     unsigned char   * Image_buff ;	/* for GrArea*/
     60     unsigned char   * Clientfb;		/* for DirectFB*/
     61     nx_sdl_visual_t SDL_Visual ;
     62     // The current list of available video modes
     63     SDL_Rect        ** modelist ;
     64     int             currently_fullscreen ;
     65     // for fullscreen
     66     int             OffsetX, OffsetY ;
     67     // for GammaRamp
     68     Uint16          * GammaRamp_R, * GammaRamp_G, * GammaRamp_B ;
     69     // for GrArea, r_mask, g_mask, b_mask
     70     int             pixel_type ;
     71 #ifdef ENABLE_NANOX_DIRECT_FB
     72     GR_WINDOW_FB_INFO fbinfo;
     73 #endif
     74 } ;
     75 
     76 #define SDL_Window           (this -> hidden -> SDL_Window)
     77 #define FSwindow             (this -> hidden -> FSwindow)
     78 #define SDL_windowid         (this -> hidden -> SDL_windowid)
     79 #define SDL_GC               (this -> hidden -> GC)
     80 #define SDL_Image            (this -> hidden -> Image)
     81 #define Image_buff           (this -> hidden -> Image_buff)
     82 #define Clientfb             (this -> hidden -> Clientfb)
     83 #define SDL_Visual           (this -> hidden -> SDL_Visual)
     84 #define SDL_modelist         (this -> hidden -> modelist)
     85 #define currently_fullscreen (this -> hidden -> currently_fullscreen)
     86 #define OffsetX              (this -> hidden -> OffsetX)
     87 #define OffsetY              (this -> hidden -> OffsetY)
     88 #define GammaRamp_R          (this -> hidden -> GammaRamp_R)
     89 #define GammaRamp_G          (this -> hidden -> GammaRamp_G)
     90 #define GammaRamp_B          (this -> hidden -> GammaRamp_B)
     91 #define pixel_type           (this -> hidden -> pixel_type)
     92 #define fbinfo               (this -> hidden -> fbinfo)
     93 
     94 #define CI_SIZE 256   // color index size
     95 
     96 #endif  // _SDL_nxvideo_h
     97