comparison src/video/photon/SDL_ph_video.h @ 315:3333b6e68289

Date: Sat, 23 Mar 2002 13:53:37 +0200 From: "Mike Gorchak" <mike@malva.ua> Subject: Big QNX patch again. Added 8bit palette emulation code for window mode with bpp>=15. Added store/restore original palette for 8bit modes. Added more information about photon API call fails. Rewroten change palette code, slow but works. Fixed bug with set caption before window was inited. Fixed bugs with some initial state of variables. Fixed bug with storing old video mode settings. Fixed bug with switching to fullscreen mode and back. Fixed few double SEGFAULTS during parachute mode. Removed compilation warning with no PgWaitHWIdle prototype. Removed pack of dead unusable code. Cleanups SDL_PrivateVideoData structure, some headers. Some code formatting.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 Mar 2002 20:19:44 +0000
parents 2de77f7b7a28
children bce7171e7a85
comparison
equal deleted inserted replaced
314:bff64eba7721 315:3333b6e68289
37 /* Hidden "this" pointer for the video functions */ 37 /* Hidden "this" pointer for the video functions */
38 #define _THIS SDL_VideoDevice *this 38 #define _THIS SDL_VideoDevice *this
39 39
40 #define PH_OGL_MAX_ATTRIBS 32 40 #define PH_OGL_MAX_ATTRIBS 32
41 41
42 #define SDLPH_PAL_NONE 0x00000000L
43 #define SDLPH_PAL_EMULATE 0x00000001L
44 #define SDLPH_PAL_SYSTEM 0x00000002L
45
42 typedef union vidptr{ 46 typedef union vidptr{
43 uint8_t *volatile ptr8; 47 uint8_t *volatile ptr8;
44 uint16_t *volatile ptr16; 48 uint16_t *volatile ptr16;
45 uint32_t *volatile ptr32; 49 uint32_t *volatile ptr32;
46 } VidPtr_t; 50 } VidPtr_t;
53 57
54 #define EVENT_SIZE sizeof( PhEvent_t ) + 1000 58 #define EVENT_SIZE sizeof( PhEvent_t ) + 1000
55 59
56 /* Private display data */ 60 /* Private display data */
57 struct SDL_PrivateVideoData { 61 struct SDL_PrivateVideoData {
58 int local_ph; /* Flag: true if local display */
59 PtAppContext_t app;
60 PgDisplaySettings_t mode_settings; 62 PgDisplaySettings_t mode_settings;
61 PtWidget_t *Window; /* used to handle input events */ 63 PtWidget_t *Window; /* used to handle input events */
62 PhImage_t *image; /* used to display image */ 64 PhImage_t *image; /* used to display image */
63 #ifdef HAVE_OPENGL 65 #ifdef HAVE_OPENGL
64 PdOpenGLContext_t* OGLContext; 66 PdOpenGLContext_t* OGLContext; /* OpenGL context */
65 #endif /* HAVE_OPENGL */ 67 #endif /* HAVE_OPENGL */
68 PgColor_t ph_palette[_Pg_MAX_PALETTE];
66 69
67 struct { 70 struct {
68 PdDirectContext_t *direct_context; 71 PdDirectContext_t *direct_context;
69 PdOffscreenContext_t *offscreen_context; 72 PdOffscreenContext_t *offscreen_context;
70 VidPtr_t dc_ptr; 73 VidPtr_t dc_ptr;
74 int current; 77 int current;
75 long Stride; 78 long Stride;
76 long flags; 79 long flags;
77 } ocimage; 80 } ocimage;
78 81
79 PhDrawContext_t *ScreenDC; //=NULL; 82 PgHWCaps_t graphics_card_caps; /* Graphics card caps at the moment of start */
80 signed short old_video_mode; //=-1; 83 int old_video_mode; /* Stored mode before fullscreen switch */
81 signed short old_refresh_rate; //=-1; 84 int old_refresh_rate; /* Stored refresh rate befor fullscreen switch */
82 PgHWCaps_t graphics_card_caps;
83
84 PdDirectContext_t *directContext;
85 PdOffscreenContext_t *Buff[2];
86 struct _Ph_ctrl* ctrl_channel;
87
88 /* The variables used for displaying graphics */
89 85
90 /* The current width and height of the fullscreen mode */ 86 /* The current width and height of the fullscreen mode */
91 int current_w; 87 int current_w;
92 int current_h; 88 int current_h;
93 89
104 } mouse_accel; 100 } mouse_accel;
105 101
106 int mouse_relative; 102 int mouse_relative;
107 WMcursor* BlankCursor; 103 WMcursor* BlankCursor;
108 104
109 int depth; /* current visual depth (not bpp) */ 105 int depth; /* current visual depth (not bpp) */
106 int desktopbpp; /* bpp of desktop at the moment of start */
107 int desktoppal; /* palette mode emulation or system */
108 int captionflag; /* caption setting flag */
110 109
111 int use_vidmode; 110 int use_vidmode;
112 int currently_fullscreen; 111 int currently_fullscreen;
113 112
114 /* Automatic mode switching support (entering/leaving fullscreen) */ 113 /* Automatic mode switching support (entering/leaving fullscreen) */
116 Uint32 switch_time; 115 Uint32 switch_time;
117 116
118 /* Prevent too many XSync() calls */ 117 /* Prevent too many XSync() calls */
119 int blit_queued; 118 int blit_queued;
120 119
121 short *iconcolors; /* List of colors used by the icon */
122 PhEvent_t* event; 120 PhEvent_t* event;
123 }; 121 };
124 122
125 #define local_ph (this->hidden->local_ph)
126 #define app (this->hidden->app)
127 #define mode_settings (this->hidden->mode_settings) 123 #define mode_settings (this->hidden->mode_settings)
128 #define window (this->hidden->Window) 124 #define window (this->hidden->Window)
129 #define oglctx (this->hidden->OGLContext) 125 #define oglctx (this->hidden->OGLContext)
130 #define directContext (this->hidden->directContext)
131 #define Buff (this->hidden->Buff)
132 #define ctrl_channel (this->hidden->ctrl_channel)
133 #define SDL_Image (this->hidden->image) 126 #define SDL_Image (this->hidden->image)
134 #define OCImage (this->hidden->ocimage) 127 #define OCImage (this->hidden->ocimage)
135 #define old_video_mode (this->hidden->old_video_mode) 128 #define old_video_mode (this->hidden->old_video_mode)
136 #define old_refresh_rate (this->hidden->old_refresh_rate) 129 #define old_refresh_rate (this->hidden->old_refresh_rate)
137 #define graphics_card_caps (this->hidden->graphics_card_caps) 130 #define graphics_card_caps (this->hidden->graphics_card_caps)
131 #define desktopbpp (this->hidden->desktopbpp)
132 #define desktoppal (this->hidden->desktoppal)
133 #define ph_palette (this->hidden->ph_palette)
138 134
139 /* Old variable names */ 135 /* Old variable names */
140 #define swap_pixels (this->hidden->swap_pixels)
141 #define current_w (this->hidden->current_w) 136 #define current_w (this->hidden->current_w)
142 #define current_h (this->hidden->current_h) 137 #define current_h (this->hidden->current_h)
143 #define mouse_last (this->hidden->mouse_last) 138 #define mouse_last (this->hidden->mouse_last)
144 #define mouse_accel (this->hidden->mouse_accel) 139 #define mouse_accel (this->hidden->mouse_accel)
145 #define mouse_relative (this->hidden->mouse_relative) 140 #define mouse_relative (this->hidden->mouse_relative)
148 #define use_vidmode (this->hidden->use_vidmode) 143 #define use_vidmode (this->hidden->use_vidmode)
149 #define currently_fullscreen (this->hidden->currently_fullscreen) 144 #define currently_fullscreen (this->hidden->currently_fullscreen)
150 #define switch_waiting (this->hidden->switch_waiting) 145 #define switch_waiting (this->hidden->switch_waiting)
151 #define switch_time (this->hidden->switch_time) 146 #define switch_time (this->hidden->switch_time)
152 #define blit_queued (this->hidden->blit_queued) 147 #define blit_queued (this->hidden->blit_queued)
153 #define SDL_iconcolorIs (this->hidden->iconcolors)
154 #define event (this->hidden->event) 148 #define event (this->hidden->event)
155 #define SDL_BlankCursor (this->hidden->BlankCursor) 149 #define SDL_BlankCursor (this->hidden->BlankCursor)
150 #define captionflag (this->hidden->captionflag)
156 151
157 #endif /* _SDL_x11video_h */ 152 #endif /* _SDL_x11video_h */