0
|
1 /*
|
|
2 SDL - Simple DirectMedia Layer
|
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 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@devolution.com
|
|
21 */
|
|
22 /*
|
|
23 static PhEvent_t *event;
|
|
24 static PtAppContext_t app;
|
|
25 static PtWidget_t *window;
|
|
26 static PgVideoModes_t modelist;
|
|
27 static PdOffscreenContext_t *Buff[2];
|
|
28 static PdDirectContext_t *directContext;
|
|
29 static PhRect_t screenRect,windowRect;
|
|
30 static PgColor_t currRGB;
|
|
31 static PhPoint_t zeroPoint;
|
|
32 static char keyque[ QUE_SIZE ],keyMatrix[256];
|
|
33 static int queput,queget;
|
|
34 static int modeSet;
|
|
35 static PgHWCaps_t hwCaps;
|
|
36 static PgDisplaySettings_t mode_settings;
|
|
37 static int rshift1,rshift2,gshift1,gshift2,bshift1,bshift2;
|
|
38 static int backPitch;
|
|
39 static unsigned RBitMask,GBitMask,BBitMask;
|
|
40 static unsigned TranslatedFillColor;
|
|
41 */
|
|
42
|
|
43 #ifndef _SDL_ph_video_h
|
|
44 #define _SDL_ph_video_h
|
|
45
|
|
46 #include "SDL_mouse.h"
|
|
47 #include "SDL_sysvideo.h"
|
|
48
|
|
49 #include "Ph.h"
|
|
50 #include "Pt.h"
|
|
51 #include <photon/Pg.h>
|
|
52 #include <photon/PdDirect.h>
|
|
53
|
|
54 /* Hidden "this" pointer for the video functions */
|
|
55 #define _THIS SDL_VideoDevice *this
|
|
56
|
|
57 typedef union vidptr{
|
|
58 uint8_t *volatile ptr8;
|
|
59 uint16_t *volatile ptr16;
|
|
60 uint32_t *volatile ptr32;
|
|
61 } VidPtr_t;
|
|
62
|
|
63 typedef struct {
|
|
64 unsigned char *Y;
|
|
65 unsigned char *V;
|
|
66 unsigned char *U;
|
|
67 }FRAMEDATA;
|
|
68
|
|
69 #define EVENT_SIZE sizeof( PhEvent_t ) + 1000
|
|
70
|
|
71 /* Private display data */
|
|
72 struct SDL_PrivateVideoData {
|
|
73 int local_ph; /* Flag: true if local display */
|
|
74 PtAppContext_t app;
|
|
75 PgDisplaySettings_t mode_settings;
|
|
76 PtWidget_t *window; /* used to handle input events */
|
|
77 PhImage_t *image; /* used to display image */
|
|
78
|
|
79 struct {
|
|
80 PdDirectContext_t *direct_context;
|
|
81 PdOffscreenContext_t *offscreen_context;
|
|
82 VidPtr_t dc_ptr;
|
|
83 FRAMEDATA *CurrentFrameData;
|
|
84 FRAMEDATA *FrameData0;
|
|
85 FRAMEDATA *FrameData1;
|
|
86 int current;
|
|
87 long Stride;
|
|
88 long flags;
|
|
89 } ocimage;
|
|
90
|
|
91 PhDrawContext_t *ScreenDC; //=NULL;
|
|
92 signed short old_video_mode; //=-1;
|
|
93 signed short old_refresh_rate; //=-1;
|
|
94 PgHWCaps_t graphics_card_caps;
|
|
95
|
|
96 PdDirectContext_t *directContext;
|
|
97 PdOffscreenContext_t *Buff[2];
|
|
98 struct _Ph_ctrl* ctrl_channel;
|
|
99
|
|
100 PhGC_t *Pt_GC, *Pg_GC; /* Graphic contexts to switch between Pt and Pg APIs */
|
|
101
|
|
102 /* The variables used for displaying graphics */
|
|
103
|
|
104 /* The current width and height of the fullscreen mode */
|
|
105 int current_w;
|
|
106 int current_h;
|
|
107
|
|
108 /* Support for internal mouse warping */
|
|
109 struct {
|
|
110 int x;
|
|
111 int y;
|
|
112 } mouse_last;
|
|
113 struct {
|
|
114 int numerator;
|
|
115 int denominator;
|
|
116 int threshold;
|
|
117 } mouse_accel;
|
|
118 int mouse_relative;
|
|
119 WMcursor* BlankCursor;
|
|
120
|
|
121
|
|
122
|
|
123 int depth; /* current visual depth (not bpp) */
|
|
124
|
|
125 int use_vidmode;
|
|
126 int currently_fullscreen;
|
|
127
|
|
128 /* Automatic mode switching support (entering/leaving fullscreen) */
|
|
129 Uint32 switch_waiting;
|
|
130 Uint32 switch_time;
|
|
131
|
|
132 /* Prevent too many XSync() calls */
|
|
133 int blit_queued;
|
|
134
|
|
135 short *iconcolors; /* List of colors used by the icon */
|
|
136 PhEvent_t* event;
|
|
137 };
|
|
138
|
|
139 #define local_ph (this->hidden->local_ph)
|
|
140 #define app (this->hidden->app)
|
|
141 #define mode_settings (this->hidden->mode_settings)
|
|
142 #define window (this->hidden->window)
|
|
143 #define directContext (this->hidden->directContext)
|
|
144 #define Buff (this->hidden->Buff)
|
|
145 #define ctrl_channel (this->hidden->ctrl_channel)
|
|
146 #define SDL_Image (this->hidden->image)
|
|
147 #define OCImage (this->hidden->ocimage)
|
|
148 #define old_video_mode (this->hidden->old_video_mode)
|
|
149 #define old_refresh_rate (this->hidden->old_refresh_rate)
|
|
150 #define graphics_card_caps (this->hidden->graphics_card_caps)
|
|
151 #define Pt_GC (this->hidden->Pt_GC)
|
|
152 #define Pg_GC (this->hidden->Pg_GC)
|
|
153
|
|
154 /* Old variable names */
|
|
155 #define swap_pixels (this->hidden->swap_pixels)
|
|
156 #define current_w (this->hidden->current_w)
|
|
157 #define current_h (this->hidden->current_h)
|
|
158 #define mouse_last (this->hidden->mouse_last)
|
|
159 #define mouse_accel (this->hidden->mouse_accel)
|
|
160 #define mouse_relative (this->hidden->mouse_relative)
|
|
161 #define saved_mode (this->hidden->saved_mode)
|
|
162 #define saved_view (this->hidden->saved_view)
|
|
163 #define use_vidmode (this->hidden->use_vidmode)
|
|
164 #define currently_fullscreen (this->hidden->currently_fullscreen)
|
|
165 #define switch_waiting (this->hidden->switch_waiting)
|
|
166 #define switch_time (this->hidden->switch_time)
|
|
167 #define blit_queued (this->hidden->blit_queued)
|
|
168 #define SDL_iconcolorIs (this->hidden->iconcolors)
|
|
169 #define event (this->hidden->event)
|
|
170 #define SDL_BlankCursor (this->hidden->BlankCursor)
|
|
171
|
|
172 #endif /* _SDL_x11video_h */
|