Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_yuv.c @ 1338:604d73db6802
Removed uses of stdlib.h and string.h
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 09:29:18 +0000 |
parents | c9b51268668f |
children | c71e05b4dc2e |
rev | line source |
---|---|
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
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:
769
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:
769
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:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 /* This is the DirectFB implementation of YUV video overlays */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
25 #include "SDL_stdlib.h" |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include "SDL_error.h" |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_video.h" |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 #include "SDL_DirectFB_yuv.h" |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "SDL_yuvfuncs.h" |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 /* The functions used to manipulate software video overlays */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 static struct private_yuvhwfuncs directfb_yuvfuncs = { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 DirectFB_LockYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 DirectFB_UnlockYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 DirectFB_DisplayYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 DirectFB_FreeYUVOverlay |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 }; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 struct private_yuvhwdata { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 DFBDisplayLayerID layer_id; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 IDirectFBDisplayLayer *layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 IDirectFBSurface *surface; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 /* These are just so we don't have to allocate them separately */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 Uint16 pitches[3]; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 Uint8 *planes[3]; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 }; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 static DFBEnumerationResult |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 enum_layers_callback( DFBDisplayLayerID id, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 DFBDisplayLayerDescription desc, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 void *data ) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 struct private_yuvhwdata *hwdata = (struct private_yuvhwdata *) data; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 /* we don't want the primary */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 if (id == DLID_PRIMARY) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 return DFENUM_OK; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 /* take the one with a surface for video */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 if ((desc.caps & DLCAPS_SURFACE) && (desc.type & DLTF_VIDEO)) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 hwdata->layer_id = id; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 return DFENUM_CANCEL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 return DFENUM_OK; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 static DFBResult CreateYUVSurface(_THIS, struct private_yuvhwdata *hwdata, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 int width, int height, Uint32 format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 IDirectFB *dfb = HIDDEN->dfb; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 IDirectFBDisplayLayer *layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 DFBDisplayLayerConfig conf; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 ret = dfb->EnumDisplayLayers (dfb, enum_layers_callback, hwdata); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 SetDirectFBerror("IDirectFB::EnumDisplayLayers", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 if (!hwdata->layer_id) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 return DFB_UNSUPPORTED; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 ret = dfb->GetDisplayLayer (dfb, hwdata->layer_id, &layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 SetDirectFBerror("IDirectFB::GetDisplayLayer", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 conf.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 conf.width = width; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 conf.height = height; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 switch (format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 conf.pixelformat = DSPF_YV12; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 conf.pixelformat = DSPF_I420; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 case SDL_YUY2_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 conf.pixelformat = DSPF_YUY2; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 case SDL_UYVY_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 conf.pixelformat = DSPF_UYVY; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 fprintf (stderr, "SDL_DirectFB: Unsupported YUV format (0x%08x)!\n", format); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 ret = layer->SetConfiguration (layer, &conf); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 SetDirectFBerror("IDirectFBDisplayLayer::SetConfiguration", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 layer->Release (layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 ret = layer->GetSurface (layer, &hwdata->surface); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 SetDirectFBerror("IDirectFBDisplayLayer::GetSurface", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 layer->Release (layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 hwdata->layer = layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 return DFB_OK; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 SDL_Overlay *DirectFB_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 SDL_Overlay *overlay; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 struct private_yuvhwdata *hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 /* Create the overlay structure */ |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
149 overlay = SDL_calloc (1, sizeof(SDL_Overlay)); |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 if (!overlay) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 SDL_OutOfMemory(); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 /* Fill in the basic members */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 overlay->format = format; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 overlay->w = width; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 overlay->h = height; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 /* Set up the YUV surface function structure */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 overlay->hwfuncs = &directfb_yuvfuncs; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 /* Create the pixel data and lookup tables */ |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
165 hwdata = SDL_calloc(1, sizeof(struct private_yuvhwdata)); |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 overlay->hwdata = hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 if (!hwdata) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 SDL_OutOfMemory(); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 SDL_FreeYUVOverlay (overlay); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 if (CreateYUVSurface (this, hwdata, width, height, format)) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 SDL_FreeYUVOverlay (overlay); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 overlay->hw_overlay = 1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 /* Set up the plane pointers */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 overlay->pitches = hwdata->pitches; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 overlay->pixels = hwdata->planes; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 switch (format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 overlay->planes = 3; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 overlay->planes = 1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 /* We're all done.. */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 return overlay; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 int DirectFB_LockYUVOverlay(_THIS, SDL_Overlay *overlay) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 void *data; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 unsigned int pitch; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 IDirectFBSurface *surface = overlay->hwdata->surface; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 ret = surface->Lock (surface, DSLF_READ | DSLF_WRITE, &data, &pitch); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 SetDirectFBerror("IDirectFBSurface::Lock", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 return -1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 /* Find the pitch and offset values for the overlay */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 overlay->pitches[0] = (Uint16) pitch; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 overlay->pixels[0] = (Uint8*) data; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 switch (overlay->format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 /* Add the two extra planes */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 overlay->pitches[1] = overlay->pitches[0] / 2; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 overlay->pitches[2] = overlay->pitches[0] / 2; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 overlay->pixels[1] = overlay->pixels[0] + overlay->pitches[0] * overlay->h; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 overlay->pixels[2] = overlay->pixels[1] + overlay->pitches[1] * overlay->h / 2; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 /* Only one plane, no worries */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 return 0; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 void DirectFB_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 IDirectFBSurface *surface = overlay->hwdata->surface; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 overlay->pixels[0] = overlay->pixels[1] = overlay->pixels[2] = NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 surface->Unlock (surface); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 int DirectFB_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dst) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 DFBDisplayLayerConfig conf; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 IDirectFBDisplayLayer *primary = HIDDEN->layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 IDirectFBDisplayLayer *layer = overlay->hwdata->layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 primary->GetConfiguration (primary, &conf); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 ret = layer->SetScreenLocation (layer, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 dst->x / (float) conf.width, dst->y / (float) conf.height, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 dst->w / (float) conf.width, dst->h / (float) conf.height ); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 SetDirectFBerror("IDirectFBDisplayLayer::SetScreenLocation", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 return -1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 return 0; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 void DirectFB_FreeYUVOverlay(_THIS, SDL_Overlay *overlay) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 struct private_yuvhwdata *hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 hwdata = overlay->hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 if (hwdata) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 if (hwdata->surface) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 hwdata->surface->Release (hwdata->surface); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 if (hwdata->layer) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 hwdata->layer->Release (hwdata->layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 free (hwdata); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |