21 #include "../../SDL_internal.h"
23 #if SDL_VIDEO_DRIVER_HAIKU
26 #include <InterfaceKit.h>
34 #include "../../main/haiku/SDL_BApp.h"
63 return (display_mode*)(
mode->driverdata);
68 static float get_refresh_rate(display_mode &
mode) {
69 return float(
mode.timing.pixel_clock * 1000)
70 / float(
mode.timing.h_total *
mode.timing.v_total);
78 void _SpoutModeData(display_mode *bmode) {
80 printf(
"\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
81 printf(
"\th,v = (%i,%i)\n", bmode->h_display_start,
82 bmode->v_display_start);
85 if(bmode->flags & B_SCROLL) {
86 printf(
"\t\tB_SCROLL\n");
88 if(bmode->flags & B_8_BIT_DAC) {
89 printf(
"\t\tB_8_BIT_DAC\n");
91 if(bmode->flags & B_HARDWARE_CURSOR) {
92 printf(
"\t\tB_HARDWARE_CURSOR\n");
94 if(bmode->flags & B_PARALLEL_ACCESS) {
95 printf(
"\t\tB_PARALLEL_ACCESS\n");
97 if(bmode->flags & B_DPMS) {
98 printf(
"\t\tB_DPMS\n");
100 if(bmode->flags & B_IO_FB_NA) {
101 printf(
"\t\tB_IO_FB_NA\n");
104 printf(
"\tTiming:\n");
105 printf(
"\t\tpx clock: %i\n", bmode->timing.pixel_clock);
106 printf(
"\t\th - display: %i sync start: %i sync end: %i total: %i\n",
107 bmode->timing.h_display, bmode->timing.h_sync_start,
108 bmode->timing.h_sync_end, bmode->timing.h_total);
109 printf(
"\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
110 bmode->timing.v_display, bmode->timing.v_sync_start,
111 bmode->timing.v_sync_end, bmode->timing.v_total);
112 if(bmode->timing.flags) {
113 printf(
"\t\tFlags:\n");
114 if(bmode->timing.flags & B_BLANK_PEDESTAL) {
115 printf(
"\t\t\tB_BLANK_PEDESTAL\n");
117 if(bmode->timing.flags & B_TIMING_INTERLACED) {
118 printf(
"\t\t\tB_TIMING_INTERLACED\n");
120 if(bmode->timing.flags & B_POSITIVE_HSYNC) {
121 printf(
"\t\t\tB_POSITIVE_HSYNC\n");
123 if(bmode->timing.flags & B_POSITIVE_VSYNC) {
124 printf(
"\t\t\tB_POSITIVE_VSYNC\n");
126 if(bmode->timing.flags & B_SYNC_ON_GREEN) {
127 printf(
"\t\t\tB_SYNC_ON_GREEN\n");
140 switch (colorspace) {
163 return(bitsperpixel);
194 static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
196 mode->w = bmode->virtual_width;
197 mode->h = bmode->virtual_height;
198 mode->refresh_rate = (
int)get_refresh_rate(*bmode);
209 mode->driverdata = bmode;
218 static void _AddDisplay(BScreen *
screen) {
222 display_mode *bmode = (display_mode*)
SDL_calloc(1,
sizeof(display_mode));
225 _BDisplayModeToSdlDisplayMode(bmode,
mode);
255 BRect rc = bscreen.Frame();
257 rect->
y = (
int)rc.top;
269 display_mode this_bmode;
270 display_mode *bmodes;
274 bscreen.GetModeList(&bmodes, &
count);
275 bscreen.GetMode(&this_bmode);
279 if (bmodes[
i].space == this_bmode.space) {
280 _BDisplayModeToSdlDisplayMode(&bmodes[
i], &
mode);
291 if(!bscreen.IsValid()) {
292 printf(__FILE__
": %d - ERROR: BAD SCREEN\n", __LINE__);
296 display_mode *bmode = _ExtractBMode(
mode);
301 display_mode *bmode_list;
302 bscreen.GetModeList(&bmode_list, &
c);
303 for(
i = 0;
i <
c; ++
i) {
304 if( bmode_list[
i].space == bmode->space &&
305 bmode_list[
i].virtual_width == bmode->virtual_width &&
306 bmode_list[
i].virtual_height == bmode->virtual_height ) {
307 bmode = &bmode_list[
i];
312 if(bscreen.SetMode(bmode) != B_OK) {
int HAIKU_QuitModes(_THIS)
int HAIKU_InitModes(_THIS)
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
int32 HAIKU_BPPToSDLPxFormat(int32 bpp)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
@ SDL_PIXELFORMAT_INDEX4LSB
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLSurface EGLNativeWindowType * window
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
The structure that defines a display mode.
A rectangle, with the origin at the upper left (integer).
SDL_DisplayMode desktop_mode
SDL_DisplayMode current_mode
The type used to identify a window.
typedef int(__stdcall *FARPROC)()