annotate src/video/directfb/SDL_DirectFB_yuv.c @ 1319:66f6c64c2c69

Logic bug in X11 Unicode input shutdown...was checking for == NULL when it should be != NULL.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 01 Feb 2006 19:59:02 +0000
parents c9b51268668f
children 604d73db6802
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 <stdlib.h>
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include <string.h>
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_error.h"
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "SDL_video.h"
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "SDL_DirectFB_yuv.h"
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include "SDL_yuvfuncs.h"
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 /* 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
35 static struct private_yuvhwfuncs directfb_yuvfuncs = {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 DirectFB_LockYUVOverlay,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 DirectFB_UnlockYUVOverlay,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 DirectFB_DisplayYUVOverlay,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 DirectFB_FreeYUVOverlay
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 struct private_yuvhwdata {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 DFBDisplayLayerID layer_id;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 IDirectFBDisplayLayer *layer;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 IDirectFBSurface *surface;
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 /* 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
49 Uint16 pitches[3];
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 Uint8 *planes[3];
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 };
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 static DFBEnumerationResult
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 enum_layers_callback( DFBDisplayLayerID id,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 DFBDisplayLayerDescription desc,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 void *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 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
59
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 /* we don't want the primary */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 if (id == DLID_PRIMARY)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 return DFENUM_OK;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 /* 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
65 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
66 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 hwdata->layer_id = id;
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 return DFENUM_CANCEL;
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 return DFENUM_OK;
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 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
77 int width, int height, Uint32 format)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 DFBResult ret;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 IDirectFB *dfb = HIDDEN->dfb;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 IDirectFBDisplayLayer *layer;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 DFBDisplayLayerConfig conf;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 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
85 if (ret)
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 SetDirectFBerror("IDirectFB::EnumDisplayLayers", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 return ret;
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 if (!hwdata->layer_id)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 return DFB_UNSUPPORTED;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 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
95 if (ret)
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 SetDirectFBerror("IDirectFB::GetDisplayLayer", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 return ret;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 }
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 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
102 conf.width = width;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 conf.height = height;
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 switch (format)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 case SDL_YV12_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 conf.pixelformat = DSPF_YV12;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 case SDL_IYUV_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 conf.pixelformat = DSPF_I420;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 case SDL_YUY2_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 conf.pixelformat = DSPF_YUY2;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 case SDL_UYVY_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 conf.pixelformat = DSPF_UYVY;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 default:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 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
121 break;
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 ret = layer->SetConfiguration (layer, &conf);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 if (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 SetDirectFBerror("IDirectFBDisplayLayer::SetConfiguration", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 layer->Release (layer);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 return 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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 ret = layer->GetSurface (layer, &hwdata->surface);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 if (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 SetDirectFBerror("IDirectFBDisplayLayer::GetSurface", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 layer->Release (layer);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 return ret;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 }
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 hwdata->layer = layer;
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 return DFB_OK;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 }
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 *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
146 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 SDL_Overlay *overlay;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 struct private_yuvhwdata *hwdata;
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 /* Create the overlay structure */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 overlay = calloc (1, sizeof(SDL_Overlay));
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 if (!overlay)
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 SDL_OutOfMemory();
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 return NULL;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 }
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 /* Fill in the basic members */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 overlay->format = format;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 overlay->w = width;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 overlay->h = height;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 /* 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
164 overlay->hwfuncs = &directfb_yuvfuncs;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 /* Create the pixel data and lookup tables */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 hwdata = calloc(1, sizeof(struct private_yuvhwdata));
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 overlay->hwdata = hwdata;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 if (!hwdata)
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 SDL_OutOfMemory();
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 SDL_FreeYUVOverlay (overlay);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 return NULL;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 }
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 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
177 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 SDL_FreeYUVOverlay (overlay);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 return NULL;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 }
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 overlay->hw_overlay = 1;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 /* Set up the plane pointers */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 overlay->pitches = hwdata->pitches;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 overlay->pixels = hwdata->planes;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 switch (format)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 case SDL_YV12_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 case SDL_IYUV_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 overlay->planes = 3;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 default:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 overlay->planes = 1;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 break;
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 /* We're all done.. */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 return overlay;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 }
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 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
203 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 DFBResult ret;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 void *data;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 unsigned int pitch;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 IDirectFBSurface *surface = overlay->hwdata->surface;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 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
210 if (ret)
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 SetDirectFBerror("IDirectFBSurface::Lock", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 return -1;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 }
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 /* 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
217 overlay->pitches[0] = (Uint16) pitch;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 overlay->pixels[0] = (Uint8*) data;
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 switch (overlay->format)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 case SDL_YV12_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 case SDL_IYUV_OVERLAY:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 /* Add the two extra planes */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 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
226 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
227 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
228 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
229 break;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 default:
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 /* Only one plane, no worries */
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 break;
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 return 0;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 }
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 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
239 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 IDirectFBSurface *surface = overlay->hwdata->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 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
243
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 surface->Unlock (surface);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 }
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 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
248 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 DFBResult ret;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 DFBDisplayLayerConfig conf;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 IDirectFBDisplayLayer *primary = HIDDEN->layer;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 IDirectFBDisplayLayer *layer = overlay->hwdata->layer;
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 primary->GetConfiguration (primary, &conf);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 ret = layer->SetScreenLocation (layer,
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 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
258 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
259 if (ret)
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 SetDirectFBerror("IDirectFBDisplayLayer::SetScreenLocation", ret);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 return -1;
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
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 return 0;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 }
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 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
269 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 struct private_yuvhwdata *hwdata;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 hwdata = overlay->hwdata;
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 if (hwdata)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 {
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 if (hwdata->surface)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 hwdata->surface->Release (hwdata->surface);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 if (hwdata->layer)
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 hwdata->layer->Release (hwdata->layer);
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 free (hwdata);
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 }
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 }
f8482d7c9595 Date: Tue, 27 Aug 2002 19:07:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284