Home | History | Annotate | Download | only in photon
      1 /*
      2     SDL - Simple DirectMedia Layer
      3     Copyright (C) 1997-2012 Sam Lantinga
      4 
      5     This library is free software; you can redistribute it and/or
      6     modify it under the terms of the GNU Library General Public
      7     License as published by the Free Software Foundation; either
      8     version 2 of the License, or (at your option) any later version.
      9 
     10     This library is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13     Library General Public License for more details.
     14 
     15     You should have received a copy of the GNU Library General Public
     16     License along with this library; if not, write to the Free
     17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18 
     19     Sam Lantinga
     20     slouken (at) libsdl.org
     21 */
     22 #include "SDL_config.h"
     23 
     24 #ifndef __SDL_PH_VIDEO_H__
     25 #define __SDL_PH_VIDEO_H__
     26 
     27 #include "SDL_mouse.h"
     28 #include "../SDL_sysvideo.h"
     29 
     30 #include <sys/neutrino.h>
     31 
     32 #include <Ph.h>
     33 #include <Pt.h>
     34 #include <photon/Pg.h>
     35 #include <photon/PdDirect.h>
     36 
     37 #if SDL_VIDEO_OPENGL
     38     #if (_NTO_VERSION < 630)
     39         #include <photon/PdGL.h>
     40     #else
     41         #include <GL/qnxgl.h>
     42         #include <GL/GLPh.h>
     43     #endif /* 6.3.0 */
     44 #endif /* SDL_VIDEO_OPENGL */
     45 
     46 /* Hidden "this" pointer for the video functions */
     47 #define _THIS	SDL_VideoDevice* this
     48 
     49 #define PH_OGL_MAX_ATTRIBS 32
     50 
     51 #define SDLPH_PAL_NONE    0x00000000L
     52 #define SDLPH_PAL_EMULATE 0x00000001L
     53 #define SDLPH_PAL_SYSTEM  0x00000002L
     54 
     55 typedef struct
     56 {
     57     unsigned char* Y;
     58     unsigned char* V;
     59     unsigned char* U;
     60 } FRAMEDATA;
     61 
     62 /* Mask values for SDL_ReallocFormat() */
     63 struct ColourMasks
     64 {
     65     Uint32 red;
     66     Uint32 green;
     67     Uint32 blue;
     68     Uint32 alpha;
     69     Uint32 bpp;
     70 };
     71 
     72 /* Private display data */
     73 struct SDL_PrivateVideoData
     74 {
     75     PgDisplaySettings_t mode_settings;
     76     PtWidget_t *Window;                  /* used to handle input events */
     77     PhImage_t *image;	                 /* used to display image       */
     78 #if SDL_VIDEO_OPENGL
     79     #if (_NTO_VERSION < 630)
     80         PdOpenGLContext_t* OGLContext;   /* OpenGL context              */
     81         void* OGLBuffers;                /* OpenGL buffers (unused)     */
     82     #else
     83         qnxglc_t* OGLContext;            /* OpenGL context for the 6.3  */
     84         qnxgl_bufs_t* OGLBuffers;        /* OpenGL buffers for the 6.3  */
     85     #endif /* 630 */
     86 
     87     Uint32 OGLFlags;                     /* OpenGL flags                */
     88     Uint32 OGLBPP;                       /* OpenGL bpp                  */
     89 #endif /* SDL_VIDEO_OPENGL */
     90     PgColor_t savedpal[_Pg_MAX_PALETTE];
     91     PgColor_t syspalph[_Pg_MAX_PALETTE];
     92 
     93     struct
     94     {
     95         PdDirectContext_t*    direct_context;
     96         PdOffscreenContext_t* offscreen_context;
     97         PdOffscreenContext_t* offscreen_backcontext;
     98         PhDrawContext_t*      oldDC;
     99         uint8_t*              dc_ptr;
    100         unsigned char*        CurrentFrameData;
    101         unsigned char*        FrameData0;
    102         unsigned char*        FrameData1;
    103         Uint32                current;
    104         Uint32                flags;
    105     } ocimage;
    106 
    107     PgHWCaps_t graphics_card_caps;  /* Graphics card caps at the moment of start   */
    108     PgVideoModeInfo_t desktop_mode; /* Current desktop video mode information      */
    109     int old_video_mode;             /* Stored mode before fullscreen switch        */
    110     int old_refresh_rate;           /* Stored refresh rate befor fullscreen switch */
    111 
    112     int mouse_relative;
    113     WMcursor* BlankCursor;
    114     uint32_t videomode_emulatemode;
    115 
    116     Uint32 visualbpp;	            /* current visual bpp                          */
    117     Uint32 desktopbpp;              /* bpp of desktop at the moment of start       */
    118     Uint32 desktoppal;              /* palette mode emulation or system            */
    119 
    120     int currently_fullscreen;
    121     int currently_hided;            /* 1 - window hided (minimazed), 0 - normal    */
    122     int currently_maximized;        /* 1 - window hided (minimazed), 0 - normal    */
    123 
    124     PhEvent_t* event;
    125     SDL_Overlay* overlay;
    126 };
    127 
    128 #define mode_settings         (this->hidden->mode_settings)
    129 #define window	              (this->hidden->Window)
    130 #define SDL_Image             (this->hidden->image)
    131 #define OCImage               (this->hidden->ocimage)
    132 #define old_video_mode        (this->hidden->old_video_mode)
    133 #define old_refresh_rate      (this->hidden->old_refresh_rate)
    134 #define graphics_card_caps    (this->hidden->graphics_card_caps)
    135 #define desktopbpp            (this->hidden->desktopbpp)
    136 #define visualbpp             (this->hidden->visualbpp)
    137 #define desktoppal            (this->hidden->desktoppal)
    138 #define savedpal              (this->hidden->savedpal)
    139 #define syspalph              (this->hidden->syspalph)
    140 #define currently_fullscreen  (this->hidden->currently_fullscreen)
    141 #define currently_hided       (this->hidden->currently_hided)
    142 #define currently_maximized   (this->hidden->currently_maximized)
    143 #define phevent               (this->hidden->event)
    144 #define current_overlay       (this->hidden->overlay)
    145 #define desktop_mode          (this->hidden->desktop_mode)
    146 #define mouse_relative        (this->hidden->mouse_relative)
    147 #define SDL_BlankCursor       (this->hidden->BlankCursor)
    148 #define videomode_emulatemode (this->hidden->videomode_emulatemode)
    149 
    150 #if SDL_VIDEO_OPENGL
    151      #define oglctx               (this->hidden->OGLContext)
    152      #define oglbuffers           (this->hidden->OGLBuffers)
    153      #define oglflags             (this->hidden->OGLFlags)
    154      #define oglbpp               (this->hidden->OGLBPP)
    155 #endif /* SDL_VIDEO_OPENGL */
    156 
    157 #endif /* __SDL_PH_VIDEO_H__ */
    158