Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_yuv.c @ 1361:19418e4422cb
New configure-based build system. Still work in progress, but much improved
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 16 Feb 2006 10:11:48 +0000 |
parents | c71e05b4dc2e |
children | d910939febfa |
rev | line source |
---|---|
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_video.h" |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #include "SDL_DirectFB_yuv.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
27 #include "../SDL_yuvfuncs.h" |
478
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 /* 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
|
31 static struct private_yuvhwfuncs directfb_yuvfuncs = { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 DirectFB_LockYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 DirectFB_UnlockYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 DirectFB_DisplayYUVOverlay, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 DirectFB_FreeYUVOverlay |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 }; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 struct private_yuvhwdata { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 DFBDisplayLayerID layer_id; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 IDirectFBDisplayLayer *layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 IDirectFBSurface *surface; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 /* 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
|
45 Uint16 pitches[3]; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 Uint8 *planes[3]; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 }; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 static DFBEnumerationResult |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 enum_layers_callback( DFBDisplayLayerID id, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 DFBDisplayLayerDescription desc, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 void *data ) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 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
|
55 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 /* we don't want the primary */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 if (id == DLID_PRIMARY) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 return DFENUM_OK; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 /* 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
|
61 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
|
62 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 hwdata->layer_id = id; |
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 return DFENUM_CANCEL; |
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 return DFENUM_OK; |
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 |
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 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
|
73 int width, int height, Uint32 format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 IDirectFB *dfb = HIDDEN->dfb; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 IDirectFBDisplayLayer *layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 DFBDisplayLayerConfig conf; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 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
|
81 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 SetDirectFBerror("IDirectFB::EnumDisplayLayers", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 if (!hwdata->layer_id) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 return DFB_UNSUPPORTED; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 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
|
91 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 SetDirectFBerror("IDirectFB::GetDisplayLayer", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 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
|
98 conf.width = width; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 conf.height = height; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 switch (format) |
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 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 conf.pixelformat = DSPF_YV12; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 conf.pixelformat = DSPF_I420; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 case SDL_YUY2_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 conf.pixelformat = DSPF_YUY2; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 case SDL_UYVY_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 conf.pixelformat = DSPF_UYVY; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 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
|
117 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 ret = layer->SetConfiguration (layer, &conf); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 SetDirectFBerror("IDirectFBDisplayLayer::SetConfiguration", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 layer->Release (layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 ret = layer->GetSurface (layer, &hwdata->surface); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 SetDirectFBerror("IDirectFBDisplayLayer::GetSurface", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 layer->Release (layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 return ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 hwdata->layer = layer; |
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 return DFB_OK; |
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 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
|
142 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 SDL_Overlay *overlay; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 struct private_yuvhwdata *hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 /* Create the overlay structure */ |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
147 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
|
148 if (!overlay) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 SDL_OutOfMemory(); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 /* Fill in the basic members */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 overlay->format = format; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 overlay->w = width; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 overlay->h = height; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 /* 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
|
160 overlay->hwfuncs = &directfb_yuvfuncs; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 /* 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
|
163 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
|
164 overlay->hwdata = hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 if (!hwdata) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 SDL_OutOfMemory(); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 SDL_FreeYUVOverlay (overlay); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 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
|
173 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 SDL_FreeYUVOverlay (overlay); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 return NULL; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 overlay->hw_overlay = 1; |
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 /* Set up the plane pointers */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 overlay->pitches = hwdata->pitches; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 overlay->pixels = hwdata->planes; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 switch (format) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 overlay->planes = 3; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 overlay->planes = 1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 /* We're all done.. */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 return overlay; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 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
|
199 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 void *data; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 unsigned int pitch; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 IDirectFBSurface *surface = overlay->hwdata->surface; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 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
|
206 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 SetDirectFBerror("IDirectFBSurface::Lock", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 return -1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 /* 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
|
213 overlay->pitches[0] = (Uint16) pitch; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 overlay->pixels[0] = (Uint8*) data; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 switch (overlay->format) |
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 case SDL_YV12_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 case SDL_IYUV_OVERLAY: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 /* Add the two extra planes */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 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
|
222 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
|
223 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
|
224 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
|
225 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 default: |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 /* Only one plane, no worries */ |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 break; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 return 0; |
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 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
|
235 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 IDirectFBSurface *surface = overlay->hwdata->surface; |
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 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
|
239 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 surface->Unlock (surface); |
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 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
|
244 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 DFBResult ret; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 DFBDisplayLayerConfig conf; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 IDirectFBDisplayLayer *primary = HIDDEN->layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 IDirectFBDisplayLayer *layer = overlay->hwdata->layer; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 primary->GetConfiguration (primary, &conf); |
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 ret = layer->SetScreenLocation (layer, |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 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
|
254 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
|
255 if (ret) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 SetDirectFBerror("IDirectFBDisplayLayer::SetScreenLocation", ret); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 return -1; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 return 0; |
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 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 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
|
265 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 struct private_yuvhwdata *hwdata; |
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 hwdata = overlay->hwdata; |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 if (hwdata) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 { |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 if (hwdata->surface) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 hwdata->surface->Release (hwdata->surface); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 if (hwdata->layer) |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 hwdata->layer->Release (hwdata->layer); |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 free (hwdata); |
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 } |
f8482d7c9595
Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 |