annotate src/video/directfb/SDL_DirectFB_video.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
rev   line source
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
2 SDL - Simple DirectMedia Layer
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
5 This library is free software; you can redistribute it and/or
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
6 modify it under the terms of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
7 License as published by the Free Software Foundation; either
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
10 This library is distributed in the hope that it will be useful,
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
13 Lesser General Public License for more details.
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
19 Sam Lantinga
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1165
diff changeset
20 slouken@libsdl.org
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
21
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
22 MGA CRTC2 support by Thomas Jarosch - tomj@simonv.com
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
23 CRTC2 support is inspired by mplayer's dfbmga driver
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
24 written by Ville Syrj��<syrjala@sci.fi>
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
26 #include "SDL_config.h"
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 /* DirectFB video driver implementation.
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <fcntl.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include <unistd.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <sys/mman.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <directfb.h>
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
36 #include <directfb_version.h>
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #include "SDL_video.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
40 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
41 #include "../SDL_pixels_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
42 #include "../../events/SDL_events_c.h"
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #include "SDL_DirectFB_video.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #include "SDL_DirectFB_events.h"
478
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 477
diff changeset
45 #include "SDL_DirectFB_yuv.h"
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
47 /* The implementation dependent data for the window manager cursor */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
48 struct WMcursor
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
49 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
50 int unused;
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
51 };
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
52
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 /* Initialization/Query functions */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
55 static int DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
56 static SDL_Rect **DirectFB_ListModes(_THIS, SDL_PixelFormat * format,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
57 Uint32 flags);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
58 static SDL_Surface *DirectFB_SetVideoMode(_THIS, SDL_Surface * current,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
59 int width, int height, int bpp,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
60 Uint32 flags);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
61 static int DirectFB_SetColors(_THIS, int firstcolor, int ncolors,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
62 SDL_Color * colors);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
63 static void DirectFB_VideoQuit(_THIS);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 /* Hardware surface functions */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
66 static int DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
67 static int DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
68 Uint32 color);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
69 static int DirectFB_LockHWSurface(_THIS, SDL_Surface * surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
70 static void DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
71 static void DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
72 static int DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
73 static int DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
74 SDL_Surface * dst, SDL_Rect * dstrect);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
75 static int DirectFB_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
76 static int DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
77 static int DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
78 static int DirectFB_ShowWMCursor(_THIS, WMcursor * cursor);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 /* Various screen update functions available */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
81 static void DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
82 static void DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 /* This is the rect EnumModes2 uses */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
85 struct DirectFBEnumRect
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
86 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
87 SDL_Rect r;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
88 struct DirectFBEnumRect *next;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 };
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
91 static struct DirectFBEnumRect *enumlist = NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 /* DirectFB driver bootstrap functions */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
96 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
97 DirectFB_Available(void)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
99 return 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
102 static void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
103 DirectFB_DeleteDevice(SDL_VideoDevice * device)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
105 SDL_free(device->hidden);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
106 SDL_free(device);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
109 static SDL_VideoDevice *
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
110 DirectFB_CreateDevice(int devindex)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
112 SDL_VideoDevice *device;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
114 /* Initialize all variables that we clean on shutdown */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
115 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
116 if (device) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
117 SDL_memset(device, 0, (sizeof *device));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
118 device->hidden = (struct SDL_PrivateVideoData *)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
119 malloc(sizeof(*device->hidden));
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
121 if (device == NULL || device->hidden == NULL) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
122 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
123 if (device) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
124 free(device);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
126 return (0);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 }
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
128 SDL_memset(device->hidden, 0, sizeof(*device->hidden));
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
130 /* Set the function pointers */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
131 device->VideoInit = DirectFB_VideoInit;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
132 device->ListModes = DirectFB_ListModes;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
133 device->SetVideoMode = DirectFB_SetVideoMode;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
134 device->SetColors = DirectFB_SetColors;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
135 device->UpdateRects = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
136 device->CreateYUVOverlay = DirectFB_CreateYUVOverlay;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
137 device->VideoQuit = DirectFB_VideoQuit;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
138 device->AllocHWSurface = DirectFB_AllocHWSurface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
139 device->CheckHWBlit = DirectFB_CheckHWBlit;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
140 device->FillHWRect = DirectFB_FillHWRect;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
141 device->SetHWColorKey = DirectFB_SetHWColorKey;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
142 device->SetHWAlpha = DirectFB_SetHWAlpha;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
143 device->LockHWSurface = DirectFB_LockHWSurface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
144 device->UnlockHWSurface = DirectFB_UnlockHWSurface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
145 device->FlipHWSurface = DirectFB_FlipHWSurface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
146 device->FreeHWSurface = DirectFB_FreeHWSurface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
147 device->ShowWMCursor = DirectFB_ShowWMCursor;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
148 device->SetCaption = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
149 device->SetIcon = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
150 device->IconifyWindow = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
151 device->GrabInput = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
152 device->GetWMInfo = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
153 device->InitOSKeymap = DirectFB_InitOSKeymap;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
154 device->PumpEvents = DirectFB_PumpEvents;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
156 device->free = DirectFB_DeleteDevice;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
158 return device;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 VideoBootStrap DirectFB_bootstrap = {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
162 "directfb", "DirectFB",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
163 DirectFB_Available, DirectFB_CreateDevice
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 };
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
166 static DFBSurfacePixelFormat
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
167 GetFormatForBpp(int bpp, IDirectFBDisplayLayer * layer)
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
168 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
169 DFBDisplayLayerConfig dlc;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
170 int bytes = (bpp + 7) / 8;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
171
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
172 layer->GetConfiguration(layer, &dlc);
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
173
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
174 if (bytes == DFB_BYTES_PER_PIXEL(dlc.pixelformat) && bytes > 1)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
175 return dlc.pixelformat;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
176
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
177 switch (bytes) {
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
178 case 1:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
179 return DSPF_LUT8;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
180 case 2:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
181 return DSPF_RGB16;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
182 case 3:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
183 return DSPF_RGB24;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
184 case 4:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
185 return DSPF_RGB32;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
186 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
187
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
188 return DSPF_UNKNOWN;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
189 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
190
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
191 static DFBEnumerationResult
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
192 EnumModesCallback(int width, int height, int bpp, void *data)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
194 SDL_VideoDevice *this = (SDL_VideoDevice *) data;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
195 struct DirectFBEnumRect *enumrect;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
196
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
197 HIDDEN->nummodes++;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
199 if (enumlist && enumlist->r.w == width && enumlist->r.h == height)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
200 return DFENUM_OK;
1659
14717b52abc0 Merge trunk-1.3-3
Sam Lantinga <slouken@libsdl.org>
parents: 1588
diff changeset
201
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
202 enumrect = SDL_calloc(1, sizeof(struct DirectFBEnumRect));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
203 if (!enumrect) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
204 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
205 return DFENUM_CANCEL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
208 enumrect->r.w = (Uint16) width;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
209 enumrect->r.h = (Uint16) height;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
210 enumrect->next = enumlist;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
211
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
212 enumlist = enumrect;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
213
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
214 return DFENUM_OK;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
217 struct private_hwdata
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
218 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
219 IDirectFBSurface *surface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
220 IDirectFBPalette *palette;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 };
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
223 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
224 SetDirectFBerror(const char *function, DFBResult code)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
226 const char *error = DirectFBErrorString(code);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
228 if (error)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
229 SDL_SetError("%s: %s", function, error);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
230 else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
231 SDL_SetError("Unknown error code from %s", function);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
234 static DFBSurfacePixelFormat
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
235 SDLToDFBPixelFormat(SDL_PixelFormat * format)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
237 if (format->Rmask && format->Gmask && format->Bmask) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
238 switch (format->BitsPerPixel) {
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
239 case 8:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
240 return DSPF_LUT8;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
241
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 case 16:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
243 if (format->Rmask == 0xF800 &&
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
244 format->Gmask == 0x07E0 && format->Bmask == 0x001F)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
245 return DSPF_RGB16;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
246 /* fall through */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
247
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 case 15:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
249 if (format->Rmask == 0x7C00 &&
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
250 format->Gmask == 0x03E0 && format->Bmask == 0x001F)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
251 return DSPF_ARGB1555;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
252 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
253
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 case 24:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
255 if (format->Rmask == 0xFF0000 &&
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
256 format->Gmask == 0x00FF00 && format->Bmask == 0x0000FF)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
257 return DSPF_RGB24;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
258 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
259
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 case 32:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
261 if (format->Rmask == 0xFF0000 &&
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
262 format->Gmask == 0x00FF00 && format->Bmask == 0x0000FF) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
263 if (format->Amask == 0xFF000000)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
264 return DSPF_ARGB;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
265 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
266 return DSPF_RGB32;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
268 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
269 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
270 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
271 switch (format->BitsPerPixel) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
272 case 8:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
273 return DSPF_LUT8;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
274 case 15:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
275 return DSPF_ARGB1555;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
276 case 16:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
277 return DSPF_RGB16;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
278 case 24:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
279 return DSPF_RGB24;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
280 case 32:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
281 return DSPF_RGB32;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
284
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
285 return DSPF_UNKNOWN;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
286 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
287
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
288 static SDL_Palette *
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
289 AllocatePalette(int size)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
290 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
291 SDL_Palette *palette;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
292 SDL_Color *colors;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
293
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
294 palette = SDL_calloc(1, sizeof(SDL_Palette));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
295 if (!palette) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
296 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
297 return NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
300 colors = SDL_calloc(size, sizeof(SDL_Color));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
301 if (!colors) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
302 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
303 return NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
304 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
305
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
306 palette->ncolors = size;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
307 palette->colors = colors;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
308
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
309 return palette;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
310 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
311
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
312 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
313 DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
314 SDL_PixelFormat * format)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
316 format->Amask = format->Rmask = format->Gmask = format->Bmask = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
317 format->BitsPerPixel = format->BytesPerPixel = 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
319 switch (pixelformat) {
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 case DSPF_A8:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
321 format->Amask = 0x000000FF;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
322 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
323
790
d39b74b8583c Date: Wed, 28 Jan 2004 20:25:54 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
324 case DSPF_ARGB1555:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
325 format->Rmask = 0x00007C00;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
326 format->Gmask = 0x000003E0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
327 format->Bmask = 0x0000001F;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
328 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
329
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 case DSPF_RGB16:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
331 format->Rmask = 0x0000F800;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
332 format->Gmask = 0x000007E0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
333 format->Bmask = 0x0000001F;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
334 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
335
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 case DSPF_ARGB:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
337 format->Amask = 0; /* apps don't seem to like that: 0xFF000000; */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
338 /* fall through */
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 case DSPF_RGB24:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 case DSPF_RGB32:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
341 format->Rmask = 0x00FF0000;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
342 format->Gmask = 0x0000FF00;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
343 format->Bmask = 0x000000FF;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
344 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
345
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
346 case DSPF_LUT8:
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
347 format->Rmask = 0x000000FF;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
348 format->Gmask = 0x000000FF;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
349 format->Bmask = 0x000000FF;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
350
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
351 if (!format->palette)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
352 format->palette = AllocatePalette(256);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
353 break;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
354
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 default:
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
356 fprintf(stderr,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
357 "SDL_DirectFB: Unsupported pixelformat (0x%08x)!\n",
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
358 pixelformat);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
359 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
362 format->BitsPerPixel = DFB_BYTES_PER_PIXEL(pixelformat) * 8;
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
363 format->BytesPerPixel = DFB_BYTES_PER_PIXEL(pixelformat);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
365 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
369 int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
370 DirectFB_VideoInit(_THIS, SDL_PixelFormat * vformat)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
372 int i;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
373 DFBResult ret;
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
374 #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
375 DFBCardCapabilities caps;
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
376 #else
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
377 DFBGraphicsDeviceDescription caps;
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
378 #endif
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
379 DFBDisplayLayerConfig dlc;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
380 struct DirectFBEnumRect *rect;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
381 IDirectFB *dfb = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
382 IDirectFBDisplayLayer *layer = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
383 IDirectFBEventBuffer *events = NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
385 HIDDEN->c2layer = NULL, HIDDEN->c2frame = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
386 HIDDEN->enable_mga_crtc2 = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
387 HIDDEN->mga_crtc2_stretch_overscan = 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
389 ret = DirectFBInit(NULL, NULL);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
390 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
391 SetDirectFBerror("DirectFBInit", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
392 goto error;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
395 ret = DirectFBCreate(&dfb);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
396 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
397 SetDirectFBerror("DirectFBCreate", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
398 goto error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
399 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
400
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
401 ret = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
402 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
403 SetDirectFBerror("dfb->GetDisplayLayer", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
404 goto error;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
407 ret = dfb->CreateInputEventBuffer(dfb, DICAPS_ALL, DFB_FALSE, &events);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
408 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
409 SetDirectFBerror("dfb->CreateEventBuffer", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
410 goto error;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
411 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
412
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
413 layer->EnableCursor(layer, 1);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
414
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
415 /* Query layer configuration to determine the current mode and pixelformat */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
416 layer->GetConfiguration(layer, &dlc);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
417
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
418 /* If current format is not supported use LUT8 as the default */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
419 if (DFBToSDLPixelFormat(dlc.pixelformat, vformat))
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
420 DFBToSDLPixelFormat(DSPF_LUT8, vformat);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
421
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
422 /* Enumerate the available fullscreen modes */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
423 ret = dfb->EnumVideoModes(dfb, EnumModesCallback, this);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
424 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
425 SetDirectFBerror("dfb->EnumVideoModes", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
426 goto error;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
427 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
428
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
429 HIDDEN->modelist = SDL_calloc(HIDDEN->nummodes + 1, sizeof(SDL_Rect *));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
430 if (!HIDDEN->modelist) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
431 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
432 goto error;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
433 }
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
434
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
435 for (i = 0, rect = enumlist; rect; ++i, rect = rect->next) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
436 HIDDEN->modelist[i] = &rect->r;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
437 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
438
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
439 HIDDEN->modelist[i] = NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
440
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
441
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
442 /* Query card capabilities to get the video memory size */
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
443 #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
444 dfb->GetCardCapabilities(dfb, &caps);
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
445 #else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
446 dfb->GetDeviceDescription(dfb, &caps);
1165
4fa705cdecb9 Date: Tue, 1 Nov 2005 02:51:09 +0000
Ryan C. Gordon <icculus@icculus.org>
parents: 1029
diff changeset
447 #endif
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
448
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
449 this->info.wm_available = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
450 this->info.hw_available = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
451 this->info.blit_hw = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
452 this->info.blit_hw_CC = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
453 this->info.blit_hw_A = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
454 this->info.blit_fill = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
455 this->info.video_mem = caps.video_memory / 1024;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
456
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
457 HIDDEN->initialized = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
458 HIDDEN->dfb = dfb;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
459 HIDDEN->layer = layer;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
460 HIDDEN->eventbuffer = events;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
461
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
462 if (SDL_getenv("SDL_DIRECTFB_MGA_CRTC2") != NULL)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
463 HIDDEN->enable_mga_crtc2 = 1;
1018
012af0b7e8e6 Date: Fri, 24 Dec 2004 23:32:06 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 893
diff changeset
464
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
465 if (HIDDEN->enable_mga_crtc2) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
466 DFBDisplayLayerConfig dlc;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
467 DFBDisplayLayerConfigFlags failed;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
468
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
469 ret = dfb->GetDisplayLayer(dfb, 2, &HIDDEN->c2layer);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
470 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
471 SetDirectFBerror("dfb->GetDisplayLayer(CRTC2)", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
472 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
473 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
474
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
475 ret =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
476 HIDDEN->layer->SetCooperativeLevel(HIDDEN->layer,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
477 DLSCL_EXCLUSIVE);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
478 if (ret) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
479 SetDirectFBerror
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
480 ("layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
481 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
482 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
483
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
484 ret =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
485 HIDDEN->c2layer->SetCooperativeLevel(HIDDEN->c2layer,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
486 DLSCL_EXCLUSIVE);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
487 if (ret) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
488 SetDirectFBerror
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
489 ("c2layer->SetCooperativeLevel(CRTC2, EXCLUSIVE)", ret);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
490 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
491 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
492
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
493 HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0x0);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
494
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
495 /* Init the surface here as it got a fixed size */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
496 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
497 dlc.buffermode = DLBM_BACKVIDEO;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
498 dlc.pixelformat = DSPF_RGB32;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
499
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
500 ret =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
501 HIDDEN->c2layer->TestConfiguration(HIDDEN->c2layer, &dlc,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
502 &failed);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
503 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
504 SetDirectFBerror("c2layer->TestConfiguration", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
505 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
506 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
507
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
508 ret = HIDDEN->c2layer->SetConfiguration(HIDDEN->c2layer, &dlc);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
509 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
510 SetDirectFBerror("c2layer->SetConfiguration", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
511 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
512 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
513
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
514 ret = HIDDEN->c2layer->GetSurface(HIDDEN->c2layer, &HIDDEN->c2frame);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
515 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
516 SetDirectFBerror("c2layer->GetSurface", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
517 goto error;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
518 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
519
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
520 HIDDEN->c2framesize.x = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
521 HIDDEN->c2framesize.y = 0;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
522 HIDDEN->c2frame->GetSize(HIDDEN->c2frame, &HIDDEN->c2framesize.w,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
523 &HIDDEN->c2framesize.h);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
524
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
525 HIDDEN->c2frame->SetBlittingFlags(HIDDEN->c2frame, DSBLIT_NOFX);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
526 HIDDEN->c2frame->SetColor(HIDDEN->c2frame, 0, 0, 0, 0xff);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
527
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
528 /* Clear CRTC2 */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
529 HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
530 HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
531 HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
532 HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, 0);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
533 HIDDEN->c2frame->Clear(HIDDEN->c2frame, 0, 0, 0, 0xff);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
534
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
535 HIDDEN->c2layer->SetOpacity(HIDDEN->c2layer, 0xFF);
732
d18e2b224d0e Date: Wed, 5 Nov 2003 21:27:47 +0100
Ryan C. Gordon <icculus@icculus.org>
parents: 728
diff changeset
536
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
537 /* Check if overscan is possibly set */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
538 if (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN") != NULL) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
539 float overscan = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
540 if (SDL_sscanf
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
541 (SDL_getenv("SDL_DIRECTFB_MGA_OVERSCAN"), "%f",
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
542 &overscan) == 1)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
543 if (overscan > 0 && overscan < 2)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
544 HIDDEN->mga_crtc2_stretch_overscan = overscan;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
545 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
546 #ifdef DIRECTFB_CRTC2_DEBUG
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
547 printf("CRTC2 overscan: %f\n", HIDDEN->mga_crtc2_stretch_overscan);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
548 #endif
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
549 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
550
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
551 return 0;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
552
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
553 error:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
554 if (events)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
555 events->Release(events);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
556
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
557 if (HIDDEN->c2frame)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
558 HIDDEN->c2frame->Release(HIDDEN->c2frame);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
559
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
560 if (HIDDEN->c2layer)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
561 HIDDEN->c2layer->Release(HIDDEN->c2layer);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
562
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
563 if (layer)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
564 layer->Release(layer);
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
565
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
566 if (dfb)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
567 dfb->Release(dfb);
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
568
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
569 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
570 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
571
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
572 static SDL_Rect **
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
573 DirectFB_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
574 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
575 if (flags & SDL_FULLSCREEN)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
576 return HIDDEN->modelist;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
577 else if (SDLToDFBPixelFormat(format) != DSPF_UNKNOWN)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
578 return (SDL_Rect **) - 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
579
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
580 return NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
581 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
582
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
583 static SDL_Surface *
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
584 DirectFB_SetVideoMode(_THIS, SDL_Surface * current, int width, int height,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
585 int bpp, Uint32 flags)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
586 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
587 DFBResult ret;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
588 DFBSurfaceDescription dsc;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
589 DFBSurfacePixelFormat pixelformat;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
590 IDirectFBSurface *surface;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
591
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
592 fprintf(stderr, "SDL DirectFB_SetVideoMode: %dx%d@%d, flags: 0x%08x\n",
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
593 width, height, bpp, flags);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
594
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
595 flags |= SDL_FULLSCREEN;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
596
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
597 /* Release previous primary surface */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
598 if (current->hwdata && current->hwdata->surface) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
599 current->hwdata->surface->Release(current->hwdata->surface);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
600 current->hwdata->surface = NULL;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
601
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
602 /* And its palette if present */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
603 if (current->hwdata->palette) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
604 current->hwdata->palette->Release(current->hwdata->palette);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
605 current->hwdata->palette = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
606 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
607 } else if (!current->hwdata) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
608 /* Allocate the hardware acceleration data */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
609 current->hwdata =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
610 (struct private_hwdata *) SDL_calloc(1, sizeof(*current->hwdata));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
611 if (!current->hwdata) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
612 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
613 return NULL;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
614 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
615 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
616
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
617 /* Set cooperative level depending on flag SDL_FULLSCREEN */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
618 if (flags & SDL_FULLSCREEN) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
619 ret = HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_FULLSCREEN);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
620 if (ret && !HIDDEN->enable_mga_crtc2) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
621 DirectFBError("dfb->SetCooperativeLevel", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
622 flags &= ~SDL_FULLSCREEN;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
623 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
624 } else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
625 HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
626
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
627 /* Set video mode */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
628 ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
629 if (ret) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
630 if (flags & SDL_FULLSCREEN) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
631 flags &= ~SDL_FULLSCREEN;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
632 HIDDEN->dfb->SetCooperativeLevel(HIDDEN->dfb, DFSCL_NORMAL);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
633 ret = HIDDEN->dfb->SetVideoMode(HIDDEN->dfb, width, height, bpp);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
634 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
635
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
636 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
637 SetDirectFBerror("dfb->SetVideoMode", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
638 return NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
639 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
640 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
641
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
642 /* Create primary surface */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
643 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
644 dsc.caps =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
645 DSCAPS_PRIMARY | ((flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0);
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
646 dsc.pixelformat = GetFormatForBpp(bpp, HIDDEN->layer);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
647
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
648 ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
649 if (ret && (flags & SDL_DOUBLEBUF)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
650 /* Try without double buffering */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
651 dsc.caps &= ~DSCAPS_FLIPPING;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
652 ret = HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc, &surface);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
653 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
654 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
655 SetDirectFBerror("dfb->CreateSurface", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
656 return NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
657 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
658
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
659 current->w = width;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
660 current->h = height;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
661 current->flags = SDL_HWSURFACE | SDL_PREALLOC;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
662
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
663 if (flags & SDL_FULLSCREEN) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
664 current->flags |= SDL_FULLSCREEN;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
665 this->UpdateRects = DirectFB_DirectUpdate;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
666 } else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
667 this->UpdateRects = DirectFB_WindowedUpdate;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
668
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
669 if (dsc.caps & DSCAPS_FLIPPING)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
670 current->flags |= SDL_DOUBLEBUF;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
671
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
672 surface->GetPixelFormat(surface, &pixelformat);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
673
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
674 DFBToSDLPixelFormat(pixelformat, current->format);
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
675
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
676 /* Get the surface palette (if supported) */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
677 if (DFB_PIXELFORMAT_IS_INDEXED(pixelformat)) {
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
678 surface->GetPalette(surface, &current->hwdata->palette);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
679
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
680 current->flags |= SDL_HWPALETTE;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
681 }
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
682
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
683 current->hwdata->surface = surface;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
684
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
685 /* MGA CRTC2 stuff */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
686 if (HIDDEN->enable_mga_crtc2) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
687 /* no stretching if c2ssize == c2framesize */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
688 HIDDEN->c2ssize.x = 0, HIDDEN->c2ssize.y = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
689 HIDDEN->c2ssize.w = width;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
690 HIDDEN->c2ssize.h = height;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
691
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
692 HIDDEN->c2dsize.x = 0, HIDDEN->c2dsize.y = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
693 HIDDEN->c2dsize.w = width;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
694 HIDDEN->c2dsize.h = height;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
695
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
696 HIDDEN->mga_crtc2_stretch = 0;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
697
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
698 if (SDL_getenv("SDL_DIRECTFB_MGA_STRETCH") != NULL) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
699 /* Normally assume a picture aspect ratio of 4:3 */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
700 int zoom_aspect_x = 4, zoom_aspect_y = 3, i, j;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
701
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
702 for (i = 1; i < 20; i++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
703 for (j = 1; j < 10; j++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
704 if ((float) width / (float) i * (float) j == height) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
705 zoom_aspect_x = i;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
706 zoom_aspect_y = j;
732
d18e2b224d0e Date: Wed, 5 Nov 2003 21:27:47 +0100
Ryan C. Gordon <icculus@icculus.org>
parents: 728
diff changeset
707
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
708 /* break the loop */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
709 i = 21;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
710 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
711 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
712 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
713 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
714
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
715 #ifdef DIRECTFB_CRTC2_DEBUG
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
716 printf
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
717 ("Source resolution: X: %d, Y: %d, Aspect ratio: %d:%d\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
718 width, height, zoom_aspect_x, zoom_aspect_y);
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
719 printf("CRTC2 resolution: X: %d, Y: %d\n",
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
720 HIDDEN->c2framesize.w, HIDDEN->c2framesize.h);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
721 #endif
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
722
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
723 /* don't stretch only slightly smaller/larger images */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
724 if ((float) width < (float) HIDDEN->c2framesize.w * 0.95
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
725 || (float) height < (float) HIDDEN->c2framesize.h * 0.95) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
726 while ((float) HIDDEN->c2dsize.w <
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
727 (float) HIDDEN->c2framesize.w *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
728 HIDDEN->mga_crtc2_stretch_overscan
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
729 && (float) HIDDEN->c2dsize.h <
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
730 (float) HIDDEN->c2framesize.h *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
731 HIDDEN->mga_crtc2_stretch_overscan) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
732 HIDDEN->c2dsize.w += zoom_aspect_x;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
733 HIDDEN->c2dsize.h += zoom_aspect_y;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
734 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
735
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
736 /* one step down */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
737 HIDDEN->c2dsize.w -= zoom_aspect_x;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
738 HIDDEN->c2dsize.h -= zoom_aspect_y;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
739
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
740 #ifdef DIRECTFB_CRTC2_DEBUG
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
741 printf("Stretched resolution: X: %d, Y: %d\n",
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
742 HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
743 #endif
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
744
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
745 HIDDEN->mga_crtc2_stretch = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
746 } else if ((float) width > (float) HIDDEN->c2framesize.w * 0.95
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
747 || (float) height >
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
748 (float) HIDDEN->c2framesize.h * 0.95) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
749 while ((float) HIDDEN->c2dsize.w >
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
750 (float) HIDDEN->c2framesize.w *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
751 HIDDEN->mga_crtc2_stretch_overscan
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
752 || (float) HIDDEN->c2dsize.h >
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
753 (float) HIDDEN->c2framesize.h *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
754 HIDDEN->mga_crtc2_stretch_overscan) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
755 HIDDEN->c2dsize.w -= zoom_aspect_x;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
756 HIDDEN->c2dsize.h -= zoom_aspect_y;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
757 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
758
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
759 #ifdef DIRECTFB_CRTC2_DEBUG
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
760 printf("Down-Stretched resolution: X: %d, Y: %d\n",
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
761 HIDDEN->c2dsize.w, HIDDEN->c2dsize.h);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
762 #endif
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
763
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
764 HIDDEN->mga_crtc2_stretch = 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
765 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
766 #ifdef DIRECTFB_CRTC2_DEBUG
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
767 printf("Not stretching image\n");
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
768 #endif
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
769 }
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
770
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
771 /* Panning */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
772 if (HIDDEN->c2framesize.w > HIDDEN->c2dsize.w)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
773 HIDDEN->c2dsize.x =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
774 (HIDDEN->c2framesize.w - HIDDEN->c2dsize.w) / 2;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
775 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
776 HIDDEN->c2dsize.x =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
777 (HIDDEN->c2dsize.w - HIDDEN->c2framesize.w) / 2;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
778
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
779 if (HIDDEN->c2framesize.h > HIDDEN->c2dsize.h)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
780 HIDDEN->c2dsize.y =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
781 (HIDDEN->c2framesize.h - HIDDEN->c2dsize.h) / 2;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
782 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
783 HIDDEN->c2dsize.y =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
784 (HIDDEN->c2dsize.h - HIDDEN->c2framesize.h) / 2;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
785
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
786 #ifdef DIRECTFB_CRTC2_DEBUG
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
787 printf("CRTC2 position X: %d, Y: %d\n", HIDDEN->c2dsize.x,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
788 HIDDEN->c2dsize.y);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
789 #endif
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
790 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
791 }
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
792
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
793 return current;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
794 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
795
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
796 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
797 DirectFB_AllocHWSurface(_THIS, SDL_Surface * surface)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
798 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
799 DFBResult ret;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
800 DFBSurfaceDescription dsc;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
801
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
802 /* fprintf(stderr, "SDL: DirectFB_AllocHWSurface (%dx%d@%d, flags: 0x%08x)\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
803 surface->w, surface->h, surface->format->BitsPerPixel, surface->flags); */
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
804
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
805 if (surface->w < 8 || surface->h < 8)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
806 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
807
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
808 /* fill surface description */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
809 dsc.flags =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
810 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
811 dsc.width = surface->w;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
812 dsc.height = surface->h;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
813 dsc.caps = (surface->flags & SDL_DOUBLEBUF) ? DSCAPS_FLIPPING : 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
814
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
815 /* find the right pixelformat */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
816 dsc.pixelformat = SDLToDFBPixelFormat(surface->format);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
817 if (dsc.pixelformat == DSPF_UNKNOWN)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
818 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
819
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
820 /* Allocate the hardware acceleration data */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
821 surface->hwdata =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
822 (struct private_hwdata *) SDL_calloc(1, sizeof(*surface->hwdata));
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
823 if (surface->hwdata == NULL) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
824 SDL_OutOfMemory();
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
825 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
826 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
827
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
828 /* Create the surface */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
829 ret =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
830 HIDDEN->dfb->CreateSurface(HIDDEN->dfb, &dsc,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
831 &surface->hwdata->surface);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
832 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
833 SetDirectFBerror("dfb->CreateSurface", ret);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
834 free(surface->hwdata);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
835 surface->hwdata = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
836 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
837 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
838
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
839 surface->flags |= SDL_HWSURFACE | SDL_PREALLOC;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
840
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
841 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
842 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
843
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
844 static void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
845 DirectFB_FreeHWSurface(_THIS, SDL_Surface * surface)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
846 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
847 if (surface->hwdata && HIDDEN->initialized) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
848 surface->hwdata->surface->Release(surface->hwdata->surface);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
849 free(surface->hwdata);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
850 surface->hwdata = NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
851 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
852 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
853
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
854 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
855 DirectFB_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
856 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
857 /* fprintf(stderr, "SDL: DirectFB_CheckHWBlit (src->hwdata: %p, dst->hwdata: %p)\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
858 src->hwdata, dst->hwdata); */
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
859
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
860 if (!src->hwdata || !dst->hwdata)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
861 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
862
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
863 src->flags |= SDL_HWACCEL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
864 src->map->hw_blit = DirectFB_HWAccelBlit;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
865
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
866 return 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
867 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
868
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
869 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
870 DirectFB_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
871 SDL_Surface * dst, SDL_Rect * dstrect)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
872 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
873 DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
874
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
875 DFBRectangle sr = { srcrect->x, srcrect->y, srcrect->w, srcrect->h };
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
876 DFBRectangle dr = { dstrect->x, dstrect->y, dstrect->w, dstrect->h };
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
877
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
878 IDirectFBSurface *surface = dst->hwdata->surface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
879
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
880 if (src->flags & SDL_SRCCOLORKEY) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
881 flags |= DSBLIT_SRC_COLORKEY;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
882 DirectFB_SetHWColorKey(NULL, src, src->format->colorkey);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
883 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
884
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
885 if (src->flags & SDL_SRCALPHA) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
886 flags |= DSBLIT_BLEND_COLORALPHA;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
887 surface->SetColor(surface, 0xff, 0xff, 0xff, src->format->alpha);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
888 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
889
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
890 surface->SetBlittingFlags(surface, flags);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
891
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
892 if (sr.w == dr.w && sr.h == dr.h)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
893 surface->Blit(surface, src->hwdata->surface, &sr, dr.x, dr.y);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
894 else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
895 surface->StretchBlit(surface, src->hwdata->surface, &sr, &dr);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
896
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
897 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
898 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
899
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
900 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
901 DirectFB_FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * dstrect,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
902 Uint32 color)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
903 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
904 SDL_PixelFormat *fmt = dst->format;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
905 IDirectFBSurface *surface = dst->hwdata->surface;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
906
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
907 /* ugly */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
908 surface->SetColor(surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
909 (color & fmt->Rmask) >> (fmt->Rshift - fmt->Rloss),
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
910 (color & fmt->Gmask) >> (fmt->Gshift - fmt->Gloss),
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
911 (color & fmt->Bmask) << (fmt->Bloss - fmt->Bshift),
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
912 0xFF);
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
913 surface->FillRectangle(surface, dstrect->x, dstrect->y, dstrect->w,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
914 dstrect->h);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
915
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
916 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
917 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
918
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
919 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
920 DirectFB_SetHWColorKey(_THIS, SDL_Surface * src, Uint32 key)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
921 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
922 SDL_PixelFormat *fmt = src->format;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
923 IDirectFBSurface *surface = src->hwdata->surface;
219
f928da36f0e9 Updated SDL DirectFB backend for DirectFB version 0.9.7
Sam Lantinga <slouken@libsdl.org>
parents: 167
diff changeset
924
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
925 if (fmt->BitsPerPixel == 8)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
926 surface->SetSrcColorKeyIndex(surface, key);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
927 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
928 /* ugly */
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
929 surface->SetSrcColorKey(surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
930 (key & fmt->Rmask) >> (fmt->Rshift -
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
931 fmt->Rloss),
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
932 (key & fmt->Gmask) >> (fmt->Gshift -
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
933 fmt->Gloss),
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
934 (key & fmt->Bmask) << (fmt->Bloss -
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
935 fmt->Bshift));
219
f928da36f0e9 Updated SDL DirectFB backend for DirectFB version 0.9.7
Sam Lantinga <slouken@libsdl.org>
parents: 167
diff changeset
936
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
937 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
938 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
939
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
940 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
941 DirectFB_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
942 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
943 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
944 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
945
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
946 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
947 DirectFB_FlipHWSurface(_THIS, SDL_Surface * surface)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
948 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
949 if (HIDDEN->enable_mga_crtc2) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
950 int rtn =
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
951 surface->hwdata->surface->Flip(surface->hwdata->surface, NULL,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
952 0);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
953 if (HIDDEN->mga_crtc2_stretch)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
954 HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
955 surface->hwdata->surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
956 &HIDDEN->c2ssize, &HIDDEN->c2dsize);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
957 else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
958 HIDDEN->c2frame->Blit(HIDDEN->c2frame,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
959 surface->hwdata->surface, NULL,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
960 HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
961
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
962 HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
963 return rtn;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
964 } else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
965 return surface->hwdata->surface->Flip(surface->hwdata->surface, NULL,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
966 DSFLIP_WAITFORSYNC);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
967 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
968
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
969 static int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
970 DirectFB_LockHWSurface(_THIS, SDL_Surface * surface)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
971 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
972 DFBResult ret;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
973 void *data;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
974 int pitch;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
975
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
976 ret = surface->hwdata->surface->Lock(surface->hwdata->surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
977 DSLF_WRITE, &data, &pitch);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
978 if (ret) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
979 SetDirectFBerror("surface->Lock", ret);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
980 return -1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
981 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
982
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
983 surface->pixels = data;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
984 surface->pitch = pitch;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
985
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
986 return 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
987 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
988
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
989 static void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
990 DirectFB_UnlockHWSurface(_THIS, SDL_Surface * surface)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
991 {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
992 surface->hwdata->surface->Unlock(surface->hwdata->surface);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
993 surface->pixels = NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
994 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
995
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
996 static void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
997 DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect * rects)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
998 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
999 if (HIDDEN->enable_mga_crtc2) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1000 if (HIDDEN->mga_crtc2_stretch)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1001 HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1002 this->screen->hwdata->surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1003 &HIDDEN->c2ssize, &HIDDEN->c2dsize);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1004 else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1005 HIDDEN->c2frame->Blit(HIDDEN->c2frame,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1006 this->screen->hwdata->surface, NULL,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1007 HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
1008
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1009 HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
1010 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1011 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1012
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1013 static void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1014 DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect * rects)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1015 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1016 DFBRegion region;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1017 int i;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1018 int region_valid = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1019 IDirectFBSurface *surface = this->screen->hwdata->surface;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1020
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1021 for (i = 0; i < numrects; ++i) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1022 int x2, y2;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1023
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1024 if (!rects[i].w) /* Clipped? */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1025 continue;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1026
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1027 x2 = rects[i].x + rects[i].w - 1;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1028 y2 = rects[i].y + rects[i].h - 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1029
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1030 if (region_valid) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1031 if (rects[i].x < region.x1)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1032 region.x1 = rects[i].x;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1033
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1034 if (rects[i].y < region.y1)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1035 region.y1 = rects[i].y;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1036
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1037 if (x2 > region.x2)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1038 region.x2 = x2;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1039
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1040 if (y2 > region.y2)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1041 region.y2 = y2;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1042 } else {
286
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1043 region.x1 = rects[i].x;
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1044 region.y1 = rects[i].y;
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1045 region.x2 = x2;
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1046 region.y2 = y2;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1047
286
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1048 region_valid = 1;
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 259
diff changeset
1049 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1050 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1051
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1052 if (region_valid) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1053 if (HIDDEN->enable_mga_crtc2) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1054 if (HIDDEN->mga_crtc2_stretch)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1055 HIDDEN->c2frame->StretchBlit(HIDDEN->c2frame, surface,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1056 &HIDDEN->c2ssize,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1057 &HIDDEN->c2dsize);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1058 else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1059 HIDDEN->c2frame->Blit(HIDDEN->c2frame, surface, NULL,
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1060 HIDDEN->c2dsize.x, HIDDEN->c2dsize.y);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1061
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1062 HIDDEN->c2frame->Flip(HIDDEN->c2frame, NULL, DSFLIP_WAITFORSYNC);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1063 } else
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1064 surface->Flip(surface, &region, DSFLIP_WAITFORSYNC);
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
1065 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1066 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1067
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1068 int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1069 DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1070 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1071 IDirectFBPalette *palette = this->screen->hwdata->palette;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1072
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1073 if (!palette)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1074 return 0;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1075
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1076 if (firstcolor > 255)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1077 return 0;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1078
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1079 if (firstcolor + ncolors > 256)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1080 ncolors = 256 - firstcolor;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1081
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1082 if (ncolors > 0) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1083 int i;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1084 DFBColor entries[ncolors];
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1085
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1086 for (i = 0; i < ncolors; i++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1087 entries[i].a = 0xff;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1088 entries[i].r = colors[i].r;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1089 entries[i].g = colors[i].g;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1090 entries[i].b = colors[i].b;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1091 }
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1092
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1093 palette->SetEntries(palette, entries, ncolors, firstcolor);
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1094 }
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1095
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1096 return 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1097 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1098
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1099 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1100 DirectFB_VideoQuit(_THIS)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1101 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1102 struct DirectFBEnumRect *rect = enumlist;
759
26ac9609211f From: Thomas Jarosch
Ryan C. Gordon <icculus@icculus.org>
parents: 732
diff changeset
1103
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1104 if (this->screen && this->screen->hwdata) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1105 IDirectFBSurface *surface = this->screen->hwdata->surface;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1106 IDirectFBPalette *palette = this->screen->hwdata->palette;
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1107
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1108 if (palette)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1109 palette->Release(palette);
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1110
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1111 if (surface)
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1112 surface->Release(surface);
759
26ac9609211f From: Thomas Jarosch
Ryan C. Gordon <icculus@icculus.org>
parents: 732
diff changeset
1113
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1114 this->screen->hwdata->surface = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1115 this->screen->hwdata->palette = NULL;
759
26ac9609211f From: Thomas Jarosch
Ryan C. Gordon <icculus@icculus.org>
parents: 732
diff changeset
1116 }
477
22581630aab7 Date: Tue, 27 Aug 2002 16:14:11 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 464
diff changeset
1117
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1118 if (HIDDEN->c2frame) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1119 HIDDEN->c2frame->Release(HIDDEN->c2frame);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1120 HIDDEN->c2frame = NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1121 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1122
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1123 if (HIDDEN->eventbuffer) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1124 HIDDEN->eventbuffer->Release(HIDDEN->eventbuffer);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1125 HIDDEN->eventbuffer = NULL;
728
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
1126 }
5446a009107a MGA CRTC2 support for DirectFB target contributed by Thomas Jarosch.
Ryan C. Gordon <icculus@icculus.org>
parents: 546
diff changeset
1127
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1128 if (HIDDEN->c2layer) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1129 HIDDEN->c2layer->Release(HIDDEN->c2layer);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1130 HIDDEN->c2layer = NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1131 }
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1132
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1133 if (HIDDEN->layer) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1134 HIDDEN->layer->Release(HIDDEN->layer);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1135 HIDDEN->layer = NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1136 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1137
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1138 if (HIDDEN->dfb) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1139 HIDDEN->dfb->Release(HIDDEN->dfb);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1140 HIDDEN->dfb = NULL;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1141 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1142
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1143 /* Free video mode list */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1144 if (HIDDEN->modelist) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1145 free(HIDDEN->modelist);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1146 HIDDEN->modelist = NULL;
464
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1147 }
1c4be4a16410 Date: Fri, 23 Aug 2002 11:48:56 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1148
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1149 /* Free mode enumeration list */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1150 while (rect) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1151 struct DirectFBEnumRect *next = rect->next;
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1152 free(rect);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1153 rect = next;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1154 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1155 enumlist = NULL;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1156
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1157 HIDDEN->initialized = 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1158 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1159
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
1160
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1161 int
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1162 DirectFB_ShowWMCursor(_THIS, WMcursor * cursor)
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
1163 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1164 /* We can only hide or show the default cursor */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1165 if (cursor == NULL) {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1166 HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0x00);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1167 } else {
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1168 HIDDEN->layer->SetCursorOpacity(HIDDEN->layer, 0xFF);
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
1169 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1170 return 1;
767
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
1171 }
d9e79e31a7b7 Date: Mon, 17 Nov 2003 21:59:24 -0800
Sam Lantinga <slouken@libsdl.org>
parents: 759
diff changeset
1172
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1173 void
1668
4da1ee79c9af more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents: 1662
diff changeset
1174 DirectFB_FinalQuit(void)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1175 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1176 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1177
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1659
diff changeset
1178 /* vi: set ts=4 sw=4 expandtab: */