Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_modes.c @ 3473:7bdc10624cba
This is terrible, but the OpenGL standard says that lines are half open, which means that one endpoint is not covered so adjoining lines don't overlap. It also doesn't define which end is open, and indeed Mac OS X and Linux differ. Mac OS X seems to leave the second endpoint open, but Linux uses the right-most endpoint for x major lines and the bottom-most endpoint for y major lines.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Nov 2009 07:14:21 +0000 |
parents | 490f3e4fe753 |
children | 4b594623401b |
rev | line source |
---|---|
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_DirectFB_video.h" |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #define DFB_MAX_MODES 200 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 struct scn_callback_t |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 int numscreens; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 DFBScreenID screenid[DFB_MAX_SCREENS]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 DFBDisplayLayerID gralayer[DFB_MAX_SCREENS]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 int aux; /* auxiliary integer for callbacks */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 }; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 struct modes_callback_t |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 int nummodes; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 SDL_DisplayMode *modelist; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 }; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 static int |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat, Uint32 * fmt) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 switch (pixelformat) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 case DSPF_ALUT44: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 *fmt = SDL_PIXELFORMAT_INDEX4LSB; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 case DSPF_LUT8: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 *fmt = SDL_PIXELFORMAT_INDEX8; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 case DSPF_RGB332: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 *fmt = SDL_PIXELFORMAT_RGB332; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 case DSPF_ARGB4444: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 *fmt = SDL_PIXELFORMAT_ARGB4444; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 case SDL_PIXELFORMAT_ARGB1555: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 *fmt = SDL_PIXELFORMAT_ARGB1555; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 case DSPF_RGB16: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 *fmt = SDL_PIXELFORMAT_RGB565; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 case DSPF_RGB24: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 *fmt = SDL_PIXELFORMAT_RGB24; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 case DSPF_RGB32: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 *fmt = SDL_PIXELFORMAT_RGB888; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 case DSPF_ARGB: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 *fmt = SDL_PIXELFORMAT_ARGB8888; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 break; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 case DSPF_YV12: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 *fmt = SDL_PIXELFORMAT_YV12; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 break; /* Planar mode: Y + V + U (3 planes) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 case DSPF_I420: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 *fmt = SDL_PIXELFORMAT_IYUV; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 break; /* Planar mode: Y + U + V (3 planes) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 case DSPF_YUY2: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 *fmt = SDL_PIXELFORMAT_YUY2; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 break; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 case DSPF_UYVY: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 *fmt = SDL_PIXELFORMAT_UYVY; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 break; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 default: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 return 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 static DFBSurfacePixelFormat |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 SDLToDFBPixelFormat(Uint32 format) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 switch (format) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 case SDL_PIXELFORMAT_INDEX4LSB: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 return DSPF_ALUT44; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 case SDL_PIXELFORMAT_INDEX8: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 return DSPF_LUT8; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 case SDL_PIXELFORMAT_RGB332: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 return DSPF_RGB332; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 case SDL_PIXELFORMAT_RGB555: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 return DSPF_ARGB1555; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 case SDL_PIXELFORMAT_ARGB4444: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 return DSPF_ARGB4444; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 case SDL_PIXELFORMAT_ARGB1555: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 return DSPF_ARGB1555; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 case SDL_PIXELFORMAT_RGB565: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 return DSPF_RGB16; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 case SDL_PIXELFORMAT_RGB24: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 return DSPF_RGB24; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 case SDL_PIXELFORMAT_RGB888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 return DSPF_RGB32; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 case SDL_PIXELFORMAT_ARGB8888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 return DSPF_ARGB; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 case SDL_PIXELFORMAT_YV12: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 return DSPF_YV12; /* Planar mode: Y + V + U (3 planes) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 case SDL_PIXELFORMAT_IYUV: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 return DSPF_I420; /* Planar mode: Y + U + V (3 planes) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 case SDL_PIXELFORMAT_YUY2: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 return DSPF_YUY2; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 case SDL_PIXELFORMAT_UYVY: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 return DSPF_UYVY; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 case SDL_PIXELFORMAT_YVYU: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 return DSPF_UNKNOWN; /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 case SDL_PIXELFORMAT_INDEX1LSB: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 case SDL_PIXELFORMAT_INDEX1MSB: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 case SDL_PIXELFORMAT_INDEX4MSB: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 case SDL_PIXELFORMAT_RGB444: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 case SDL_PIXELFORMAT_BGR24: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 case SDL_PIXELFORMAT_BGR888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 case SDL_PIXELFORMAT_RGBA8888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 case SDL_PIXELFORMAT_ABGR8888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 case SDL_PIXELFORMAT_BGRA8888: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 case SDL_PIXELFORMAT_ARGB2101010: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 default: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 return DSPF_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 static DFBEnumerationResult |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 EnumModesCallback(int width, int height, int bpp, void *data) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 struct modes_callback_t *modedata = (struct modes_callback_t *) data; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 SDL_DisplayMode mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 mode.w = width; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 mode.h = height; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 mode.refresh_rate = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 mode.driverdata = NULL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 mode.format = SDL_PIXELFORMAT_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 if (modedata->nummodes < DFB_MAX_MODES) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 modedata->modelist[modedata->nummodes++] = mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 SDL_DFB_DEBUG("w %d h %d bpp %d\n", width, height, bpp); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 return DFENUM_OK; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 static DFBEnumerationResult |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 cbScreens(DFBScreenID screen_id, DFBScreenDescription desc, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 void *callbackdata) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 devdata->screenid[devdata->numscreens++] = screen_id; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 return DFENUM_OK; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 DFBEnumerationResult |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 cbLayers(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 void *callbackdata) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 if (desc.caps & DLCAPS_SURFACE) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 if (devdata->vidlayer[devdata->aux] == -1) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 devdata->vidlayer[devdata->aux] = layer_id; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 } else if (desc.type & DLTF_GRAPHICS) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 if (devdata->gralayer[devdata->aux] == -1) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 devdata->gralayer[devdata->aux] = layer_id; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 return DFENUM_OK; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 static void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 SDL_DFB_DEVICEDATA(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 DFBDisplayLayerConfig config; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 DFBDisplayLayerConfigFlags failed; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 int ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
207 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
208 DLSCL_ADMINISTRATIVE)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 config.width = mode->w; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 config.height = mode->h; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 config.pixelformat = SDLToDFBPixelFormat(mode->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 if (devdata->use_yuv_underlays) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 config.flags |= DLCONF_OPTIONS; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 config.options = DLOP_ALPHACHANNEL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 failed = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 data->layer->TestConfiguration(data->layer, &config, &failed); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
219 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
220 DLSCL_SHARED)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 if (failed == 0) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 SDL_AddDisplayMode(_this->current_display, mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 else |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
224 SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
225 mode->h, failed); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 error: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 DirectFB_InitModes(_THIS) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 SDL_DFB_DEVICEDATA(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 IDirectFBDisplayLayer *layer = NULL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 SDL_VideoDisplay display; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
238 DFB_DisplayData *dispdata = NULL; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 SDL_DisplayMode mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 DFBGraphicsDeviceDescription caps; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 DFBDisplayLayerConfig dlc; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 struct scn_callback_t *screencbdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 int tcw[DFB_MAX_SCREENS]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 int tch[DFB_MAX_SCREENS]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 int i; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 DFBResult ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 SDL_DFB_CALLOC(screencbdata, 1, sizeof(*screencbdata)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 screencbdata->numscreens = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 for (i = 0; i < DFB_MAX_SCREENS; i++) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 screencbdata->gralayer[i] = -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 screencbdata->vidlayer[i] = -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
258 SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &cbScreens, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
259 screencbdata)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 for (i = 0; i < screencbdata->numscreens; i++) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 IDirectFBScreen *screen; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
264 SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
265 screencbdata->screenid |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
266 [i], &screen)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 screencbdata->aux = i; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
269 SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &cbLayers, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
270 screencbdata)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 screen->GetSize(screen, &tcw[i], &tch[i]); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 screen->Release(screen); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 /* Query card capabilities */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); |
2815
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
281 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 for (i = 0; i < screencbdata->numscreens; i++) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
284 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
285 screencbdata->gralayer |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
286 [i], &layer)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
288 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
289 DLSCL_ADMINISTRATIVE)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 layer->EnableCursor(layer, 1); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 if (devdata->use_yuv_underlays) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 dlc.pixelformat = DSPF_ARGB; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 dlc.options = DLOP_ALPHACHANNEL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 ret = layer->SetConfiguration(layer, &dlc); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 if (ret) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 /* try AiRGB if the previous failed */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 dlc.pixelformat = DSPF_AiRGB; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 ret = layer->SetConfiguration(layer, &dlc); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 /* Query layer configuration to determine the current mode and pixelformat */ |
2815
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
307 dlc.flags = DLCONF_ALL; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 layer->GetConfiguration(layer, &dlc); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 goto error; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 mode.w = dlc.width; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 mode.h = dlc.height; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 mode.refresh_rate = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 mode.driverdata = NULL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 SDL_DFB_CALLOC(dispdata, 1, sizeof(*dispdata)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 dispdata->layer = layer; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 dispdata->pixelformat = dlc.pixelformat; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 dispdata->cw = tcw[i]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 dispdata->ch = tch[i]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 /* YUV - Video layer */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 dispdata->vidID = screencbdata->vidlayer[i]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 dispdata->vidIDinuse = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 SDL_zero(display); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 display.desktop_mode = mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 display.current_mode = mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 display.driverdata = dispdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 |
3037
490f3e4fe753
Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents:
3023
diff
changeset
|
338 #if (DFB_VERSION_ATLEAST(1,2,0)) |
2841
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
339 dlc.flags = |
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
340 DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | |
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
341 DLCONF_OPTIONS; |
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
342 ret = layer->SetConfiguration(layer, &dlc); |
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
343 #endif |
2815
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
344 |
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
345 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); |
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
346 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 SDL_AddVideoDisplay(&display); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 SDL_DFB_FREE(screencbdata); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 error: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 /* FIXME: Cleanup not complete, Free existing displays */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 SDL_DFB_FREE(dispdata); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 SDL_DFB_RELEASE(layer); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 DirectFB_GetDisplayModes(_THIS) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 SDL_DFB_DEVICEDATA(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 DFB_DisplayData *dispdata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 (DFB_DisplayData *) SDL_CurrentDisplay.driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 SDL_DisplayMode mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 struct modes_callback_t data; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 int i; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 int ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 data.nummodes = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 /* Enumerate the available fullscreen modes */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
372 SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
373 EnumModesCallback, &data)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 for (i = 0; i < data.nummodes; ++i) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 mode = data.modelist[i]; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 mode.format = SDL_PIXELFORMAT_ARGB8888; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 CheckSetDisplayMode(_this, dispdata, &mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 mode.format = SDL_PIXELFORMAT_RGB888; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 CheckSetDisplayMode(_this, dispdata, &mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 mode.format = SDL_PIXELFORMAT_RGB24; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 CheckSetDisplayMode(_this, dispdata, &mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 mode.format = SDL_PIXELFORMAT_RGB565; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 CheckSetDisplayMode(_this, dispdata, &mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 mode.format = SDL_PIXELFORMAT_INDEX8; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 CheckSetDisplayMode(_this, dispdata, &mode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 SDL_DFB_FREE(data.modelist); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 error: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 SDL_DFB_FREE(data.modelist); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 return; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 int |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 /* |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 * FIXME: video mode switch is currently broken for 1.2.0 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 * |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 SDL_DFB_DEVICEDATA(_this); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 DFBDisplayLayerConfig config, rconfig; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 DFBDisplayLayerConfigFlags fail = 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 DFBResult ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
410 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
411 DLSCL_ADMINISTRATIVE)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 config.flags |= DLCONF_PIXELFORMAT; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 config.pixelformat = SDLToDFBPixelFormat(mode->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 data->pixelformat = config.pixelformat; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 config.width = mode->w; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 config.height = mode->h; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 if (devdata->use_yuv_underlays) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 config.flags |= DLCONF_OPTIONS; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 config.options = DLOP_ALPHACHANNEL; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 data->layer->TestConfiguration(data->layer, &config, &fail); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 if (fail & |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
431 (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
432 DLCONF_OPTIONS)) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 mode->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 SDL_DFB_DEBUG("Trace\n"); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 config.flags &= ~fail; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); |
3037
490f3e4fe753
Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents:
3023
diff
changeset
|
441 #if (DFB_VERSION_ATLEAST(1,2,0)) |
2815
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
442 /* Need to call this twice ! */ |
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
443 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); |
e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2737
diff
changeset
|
444 #endif |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 /* Double check */ |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
448 SDL_DFB_CHECKERR(data-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
449 layer->SetCooperativeLevel(data->layer, DLSCL_SHARED)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
451 if ((config.width != rconfig.width) || (config.height != rconfig.height) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
452 || ((mode->format != SDL_PIXELFORMAT_UNKNOWN) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
453 && (config.pixelformat != rconfig.pixelformat))) { |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 mode->format); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 } |
2841
483f85e35a1a
Date: Sat, 06 Dec 2008 14:54:10 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2815
diff
changeset
|
458 |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 data->pixelformat = rconfig.pixelformat; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 data->cw = config.width; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 data->ch = config.height; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 SDL_CurrentDisplay.current_mode = *mode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 return 0; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 error: |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 return -1; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 void |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 DirectFB_QuitModes(_THIS) |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
472 //DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata; |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 SDL_DisplayMode tmode; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 DFBResult ret; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 int i; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 SDL_SelectVideoDisplay(0); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 SDL_GetDesktopDisplayMode(&tmode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 tmode.format = SDL_PIXELFORMAT_UNKNOWN; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 DirectFB_SetDisplayMode(_this, &tmode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 SDL_GetDesktopDisplayMode(&tmode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 DirectFB_SetDisplayMode(_this, &tmode); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 DFB_DisplayData *dispdata = |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 (DFB_DisplayData *) _this->displays[i].driverdata; |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 if (dispdata->layer) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
491 SDL_DFB_CHECK(dispdata-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
492 layer->SetCooperativeLevel(dispdata->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
493 DLSCL_ADMINISTRATIVE)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
494 SDL_DFB_CHECK(dispdata-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
495 layer->SetCursorOpacity(dispdata->layer, 0x00)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
496 SDL_DFB_CHECK(dispdata-> |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
497 layer->SetCooperativeLevel(dispdata->layer, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
3013
diff
changeset
|
498 DLSCL_SHARED)); |
2737
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 SDL_DFB_RELEASE(dispdata->layer); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 SDL_DFB_RELEASE(dispdata->vidlayer); |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
503 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 } |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 |
140a7edcf2bd
Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
507 /* vi: set ts=4 sw=4 expandtab: */ |