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