Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_phyuv.c @ 1327:d12a63a8d95a
Resolved bug #130
Use XFilterEvent() to handle dead-key composition under X11
Cleaned up the code in preparation for 1.3 API changes
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 04 Feb 2006 08:35:11 +0000 |
parents | c9b51268668f |
children | 3692456e7b0f |
rev | line source |
---|---|
0 | 1 /* |
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:
1289
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
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:
1289
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 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:
1289
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
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:
1289
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1289
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:
1289
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:
1289
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
23 /* This is the QNX Realtime Platform version of SDL YUV video overlays */ |
0 | 24 |
25 #include <stdlib.h> | |
26 #include <string.h> | |
27 #include <errno.h> | |
28 | |
29 #include <Ph.h> | |
30 #include <Pt.h> | |
31 | |
32 #include "SDL_error.h" | |
33 #include "SDL_video.h" | |
34 #include "SDL_phyuv_c.h" | |
35 #include "SDL_yuvfuncs.h" | |
36 | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
37 #define OVERLAY_STATE_UNINIT 0 |
0 | 38 #define OVERLAY_STATE_ACTIVE 1 |
39 | |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
40 /* The functions are used to manipulate software video overlays */ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
41 static struct private_yuvhwfuncs ph_yuvfuncs = |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
42 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
43 ph_LockYUVOverlay, |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
44 ph_UnlockYUVOverlay, |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
45 ph_DisplayYUVOverlay, |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
46 ph_FreeYUVOverlay |
0 | 47 }; |
48 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
49 int grab_ptrs2(PgVideoChannel_t* channel, FRAMEDATA* Frame0, FRAMEDATA* Frame1) |
0 | 50 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
51 int planes = 0; |
0 | 52 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
53 /* Buffers have moved; re-obtain the pointers */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
54 Frame0->Y = (unsigned char *)PdGetOffscreenContextPtr(channel->yplane1); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
55 Frame1->Y = (unsigned char *)PdGetOffscreenContextPtr(channel->yplane2); |
1289
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
56 Frame0->U = (unsigned char *)PdGetOffscreenContextPtr(channel->vplane1); |
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
57 Frame1->U = (unsigned char *)PdGetOffscreenContextPtr(channel->vplane2); |
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
58 Frame0->V = (unsigned char *)PdGetOffscreenContextPtr(channel->uplane1); |
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
59 Frame1->V = (unsigned char *)PdGetOffscreenContextPtr(channel->uplane2); |
0 | 60 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
61 if (Frame0->Y) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
62 planes++; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
63 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
64 if (Frame0->U) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
65 planes++; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
66 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
67 if (Frame0->V) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
68 planes++; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
69 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
70 return planes; |
0 | 71 } |
72 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
73 SDL_Overlay* ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display) |
0 | 74 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
75 SDL_Overlay* overlay; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
76 struct private_yuvhwdata* hwdata; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
77 int vidport; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
78 int rtncode; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
79 int planes; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
80 int i=0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
81 PhPoint_t pos; |
0 | 82 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
83 /* Create the overlay structure */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
84 overlay = calloc(1, sizeof(SDL_Overlay)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
85 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
86 if (overlay == NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
87 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
88 SDL_OutOfMemory(); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
89 return NULL; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
90 } |
0 | 91 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
92 /* Fill in the basic members */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
93 overlay->format = format; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
94 overlay->w = width; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
95 overlay->h = height; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
96 overlay->hwdata = NULL; |
0 | 97 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
98 /* Set up the YUV surface function structure */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
99 overlay->hwfuncs = &ph_yuvfuncs; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
100 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
101 /* Create the pixel data and lookup tables */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
102 hwdata = calloc(1, sizeof(struct private_yuvhwdata)); |
0 | 103 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
104 if (hwdata == NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
105 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
106 SDL_OutOfMemory(); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
107 SDL_FreeYUVOverlay(overlay); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
108 return NULL; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
109 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
110 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
111 overlay->hwdata = hwdata; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
112 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
113 PhDCSetCurrent(0); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
114 if (overlay->hwdata->channel == NULL) |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
115 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
116 if ((overlay->hwdata->channel = PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) == NULL) |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
117 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
118 SDL_SetError("ph_CreateYUVOverlay(): Create channel failed: %s\n", strerror(errno)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
119 SDL_FreeYUVOverlay(overlay); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
120 return NULL; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
121 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
122 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
123 } |
0 | 124 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
125 overlay->hwdata->forcedredraw=0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
126 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
127 PtGetAbsPosition(window, &pos.x, &pos.y); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
128 overlay->hwdata->CurrentWindowPos.x = pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
129 overlay->hwdata->CurrentWindowPos.y = pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
130 overlay->hwdata->CurrentViewPort.pos.x = 0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
131 overlay->hwdata->CurrentViewPort.pos.y = 0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
132 overlay->hwdata->CurrentViewPort.size.w = width; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
133 overlay->hwdata->CurrentViewPort.size.h = height; |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
134 overlay->hwdata->State = OVERLAY_STATE_UNINIT; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
135 overlay->hwdata->FrameData0 = (FRAMEDATA *) calloc(1, sizeof(FRAMEDATA)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
136 overlay->hwdata->FrameData1 = (FRAMEDATA *) calloc(1, sizeof(FRAMEDATA)); |
0 | 137 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
138 vidport = -1; |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
139 i=0; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
140 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
141 overlay->hwdata->ischromakey=0; |
0 | 142 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
143 do { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
144 memset(&overlay->hwdata->caps, 0x00, sizeof(PgScalerCaps_t)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
145 overlay->hwdata->caps.size = sizeof(PgScalerCaps_t); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
146 rtncode = PgGetScalerCapabilities(overlay->hwdata->channel, i, &overlay->hwdata->caps); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
147 if (rtncode==0) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
148 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
149 if (overlay->hwdata->caps.format==format) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
150 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
151 if ((overlay->hwdata->caps.flags & Pg_SCALER_CAP_DST_CHROMA_KEY) == Pg_SCALER_CAP_DST_CHROMA_KEY) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
152 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
153 overlay->hwdata->ischromakey=1; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
154 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
155 vidport=1; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
156 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
157 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
158 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
159 else |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
160 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
161 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
162 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
163 i++; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
164 } while(1); |
0 | 165 |
166 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
167 if (vidport == -1) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
168 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
169 SDL_SetError("No available video ports for requested format\n"); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
170 SDL_FreeYUVOverlay(overlay); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
171 return NULL; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
172 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
173 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
174 overlay->hwdata->format = format; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
175 overlay->hwdata->props.format = format; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
176 overlay->hwdata->props.size = sizeof(PgScalerProps_t); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
177 overlay->hwdata->props.src_dim.w = width; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
178 overlay->hwdata->props.src_dim.h = height; |
0 | 179 |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
180 /* overlay->hwdata->chromakey = PgGetOverlayChromaColor(); */ |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
181 overlay->hwdata->chromakey = PgRGB(12, 6, 12); /* very dark pink color */ |
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
182 overlay->hwdata->props.color_key = overlay->hwdata->chromakey; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
183 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
184 PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); |
0 | 185 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
186 overlay->hwdata->props.flags = Pg_SCALER_PROP_DOUBLE_BUFFER; |
0 | 187 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
188 if ((overlay->hwdata->ischromakey)&&(overlay->hwdata->chromakey)) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
189 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
190 overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_ENABLE; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
191 overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_SPECIFY_KEY_MASK; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
192 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
193 else |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
194 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
195 overlay->hwdata->props.flags &= ~Pg_SCALER_PROP_CHROMA_ENABLE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
196 } |
0 | 197 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
198 rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &overlay->hwdata->props); |
0 | 199 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
200 switch(rtncode) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
201 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
202 case -1: SDL_SetError("PgConfigScalerChannel failed\n"); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
203 SDL_FreeYUVOverlay(overlay); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
204 return NULL; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
205 case 1: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
206 case 0: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
207 default: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
208 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
209 } |
0 | 210 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
211 planes = grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1); |
0 | 212 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
213 if(overlay->hwdata->channel->yplane1 != NULL) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
214 overlay->hwdata->YStride = overlay->hwdata->channel->yplane1->pitch; |
1289
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
215 if(overlay->hwdata->channel->vplane1 != NULL) |
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
216 overlay->hwdata->UStride = overlay->hwdata->channel->vplane1->pitch; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
217 if(overlay->hwdata->channel->uplane1 != NULL) |
1289
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
218 overlay->hwdata->VStride = overlay->hwdata->channel->uplane1->pitch; |
0 | 219 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
220 /* check for the validness of all planes */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
221 if ((overlay->hwdata->channel->yplane1 == NULL) && |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
222 (overlay->hwdata->channel->uplane1 == NULL) && |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
223 (overlay->hwdata->channel->vplane1 == NULL)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
224 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
225 SDL_FreeYUVOverlay(overlay); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
226 SDL_SetError("PgConfigScaler() returns all planes equal NULL\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
227 return NULL; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
228 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
229 /* |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
230 overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel); |
0 | 231 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
232 if (overlay->hwdata->current==0) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
233 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
234 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
235 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
236 else |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
237 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
238 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
239 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
240 */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
241 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0; |
0 | 242 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
243 /* |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
244 overlay->hwdata->locked = 1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
245 */ |
0 | 246 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
247 /* Find the pitch and offset values for the overlay */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
248 overlay->planes = planes; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
249 overlay->pitches = calloc(overlay->planes, sizeof(Uint16)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
250 overlay->pixels = calloc(overlay->planes, sizeof(Uint8*)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
251 if (!overlay->pitches || !overlay->pixels) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
252 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
253 SDL_OutOfMemory(); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
254 SDL_FreeYUVOverlay(overlay); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
255 return(NULL); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
256 } |
0 | 257 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
258 if (overlay->planes > 0) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
259 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
260 overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
261 overlay->pixels[0] = overlay->hwdata->CurrentFrameData->Y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
262 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
263 if (overlay->planes > 1) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
264 { |
1289
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
265 overlay->pitches[1] = overlay->hwdata->channel->vplane1->pitch; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
266 overlay->pixels[1] = overlay->hwdata->CurrentFrameData->U; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
267 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
268 if (overlay->planes > 2) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
269 { |
1289
c07c6ef7c93e
Date: Fri, 18 Feb 2005 07:58:00 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
270 overlay->pitches[2] = overlay->hwdata->channel->uplane1->pitch; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
271 overlay->pixels[2] = overlay->hwdata->CurrentFrameData->V; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
272 } |
0 | 273 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
274 overlay->hwdata->State = OVERLAY_STATE_ACTIVE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
275 overlay->hwdata->scaler_on = 0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
276 overlay->hw_overlay = 1; |
0 | 277 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
278 current_overlay=overlay; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
279 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
280 return overlay; |
0 | 281 } |
282 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
283 int ph_LockYUVOverlay(_THIS, SDL_Overlay* overlay) |
0 | 284 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
285 if (overlay == NULL) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
286 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
287 return -1; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
288 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
289 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
290 overlay->hwdata->locked = 1; |
0 | 291 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
292 /* overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
293 if (overlay->hwdata->current == -1) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
294 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
295 SDL_SetError("ph_LockYUVOverlay: PgNextFrame() failed, bailing out\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
296 SDL_FreeYUVOverlay(overlay); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
297 return 0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
298 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
299 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
300 if (overlay->hwdata->current == 0) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
301 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
302 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
303 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
304 else |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
305 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
306 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
307 } |
0 | 308 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
309 if (overlay->planes > 0) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
310 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
311 overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
312 overlay->pixels[0] = overlay->hwdata->CurrentFrameData->Y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
313 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
314 if (overlay->planes > 1) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
315 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
316 overlay->pitches[1] = overlay->hwdata->channel->uplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
317 overlay->pixels[1] = overlay->hwdata->CurrentFrameData->U; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
318 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
319 if (overlay->planes > 2) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
320 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
321 overlay->pitches[2] = overlay->hwdata->channel->vplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
322 overlay->pixels[2] = overlay->hwdata->CurrentFrameData->V; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
323 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
324 */ |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
325 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
326 return(0); |
0 | 327 } |
328 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
329 void ph_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay) |
0 | 330 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
331 if (overlay == NULL) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
332 { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
333 return; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
334 } |
0 | 335 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
336 overlay->hwdata->locked = 0; |
0 | 337 } |
338 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
339 int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect) |
0 | 340 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
341 int rtncode; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
342 PhPoint_t pos; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
343 SDL_Rect backrect; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
344 PhRect_t windowextent; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
345 int winchanged=0; |
0 | 346 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
347 if ((overlay == NULL) || (overlay->hwdata==NULL)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
348 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
349 return -1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
350 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
351 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
352 if (overlay->hwdata->State == OVERLAY_STATE_UNINIT) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
353 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
354 return -1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
355 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
356 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
357 PtGetAbsPosition(window, &pos.x, &pos.y); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
358 if ((pos.x!=overlay->hwdata->CurrentWindowPos.x) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
359 (pos.y!=overlay->hwdata->CurrentWindowPos.y)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
360 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
361 winchanged=1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
362 overlay->hwdata->CurrentWindowPos.x=pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
363 overlay->hwdata->CurrentWindowPos.y=pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
364 } |
0 | 365 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
366 /* If CurrentViewPort position/size has been changed, then move/resize the viewport */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
367 if ((overlay->hwdata->CurrentViewPort.pos.x != dstrect->x) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
368 (overlay->hwdata->CurrentViewPort.pos.y != dstrect->y) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
369 (overlay->hwdata->CurrentViewPort.size.w != dstrect->w) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
370 (overlay->hwdata->CurrentViewPort.size.h != dstrect->h) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
371 (overlay->hwdata->scaler_on==0) || (winchanged==1) || |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
372 (overlay->hwdata->forcedredraw==1)) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
373 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
374 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
375 if (overlay->hwdata->ischromakey==1) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
376 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
377 /* restore screen behind the overlay/chroma color. */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
378 backrect.x=overlay->hwdata->CurrentViewPort.pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
379 backrect.y=overlay->hwdata->CurrentViewPort.pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
380 backrect.w=overlay->hwdata->CurrentViewPort.size.w; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
381 backrect.h=overlay->hwdata->CurrentViewPort.size.h; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
382 this->UpdateRects(this, 1, &backrect); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
383 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
384 /* Draw the new rectangle of the chroma color at the viewport position */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
385 PgSetFillColor(overlay->hwdata->chromakey); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
386 PgDrawIRect(dstrect->x, dstrect->y, dstrect->x+dstrect->w-1, dstrect->y+dstrect->h-1, Pg_DRAW_FILL); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
387 PgFlush(); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
388 } |
0 | 389 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
390 overlay->hwdata->props.flags |= Pg_SCALER_PROP_SCALER_ENABLE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
391 overlay->hwdata->scaler_on = 1; |
0 | 392 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
393 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window), &windowextent); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
394 overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dstrect->x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
395 overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dstrect->y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
396 overlay->hwdata->CurrentViewPort.size.w = dstrect->w; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
397 overlay->hwdata->CurrentViewPort.size.h = dstrect->h; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
398 PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
399 overlay->hwdata->CurrentViewPort.pos.x = dstrect->x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
400 overlay->hwdata->CurrentViewPort.pos.y = dstrect->y; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
401 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
402 rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props)); |
0 | 403 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
404 switch(rtncode) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
405 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
406 case -1: |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
407 SDL_SetError("PgConfigScalerChannel() function failed\n"); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
408 SDL_FreeYUVOverlay(overlay); |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
409 return -1; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
410 case 1: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
411 grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
412 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
413 case 0: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
414 default: |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
415 break; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
416 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
417 } |
0 | 418 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
419 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
420 /* |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
421 if (overlay->hwdata->locked==0) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
422 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
423 overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
424 if (overlay->hwdata->current == -1) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
425 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
426 SDL_SetError("ph_LockYUVOverlay: PgNextFrame() failed, bailing out\n"); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
427 SDL_FreeYUVOverlay(overlay); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
428 return 0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
429 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
430 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
431 if (overlay->hwdata->current == 0) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
432 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
433 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
434 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
435 else |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
436 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
437 overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
438 } |
0 | 439 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
440 if (overlay->planes > 0) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
441 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
442 overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
443 overlay->pixels[0] = overlay->hwdata->CurrentFrameData->Y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
444 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
445 if (overlay->planes > 1) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
446 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
447 overlay->pitches[1] = overlay->hwdata->channel->uplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
448 overlay->pixels[1] = overlay->hwdata->CurrentFrameData->U; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
449 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
450 if (overlay->planes > 2) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
451 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
452 overlay->pitches[2] = overlay->hwdata->channel->vplane1->pitch; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
453 overlay->pixels[2] = overlay->hwdata->CurrentFrameData->V; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
454 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
455 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
456 */ |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
457 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
458 return 0; |
0 | 459 } |
460 | |
461 void ph_FreeYUVOverlay(_THIS, SDL_Overlay *overlay) | |
462 { | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
463 SDL_Rect backrect; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
464 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
465 if (overlay == NULL) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
466 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
467 return; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
468 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
469 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
470 if (overlay->hwdata == NULL) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
471 { |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
472 return; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
473 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
474 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
475 current_overlay=NULL; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
476 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
477 /* restore screen behind the overlay/chroma color. */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
478 backrect.x=overlay->hwdata->CurrentViewPort.pos.x; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
479 backrect.y=overlay->hwdata->CurrentViewPort.pos.y; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
480 backrect.w=overlay->hwdata->CurrentViewPort.size.w; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
481 backrect.h=overlay->hwdata->CurrentViewPort.size.h; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
482 this->UpdateRects(this, 1, &backrect); |
0 | 483 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
484 /* it is need for some buggy drivers, that can't hide overlay before */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
485 /* freeing buffer, so we got trash on the srceen */ |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
486 overlay->hwdata->props.flags &= ~Pg_SCALER_PROP_SCALER_ENABLE; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
487 PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props)); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
488 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
489 overlay->hwdata->scaler_on = 0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
490 overlay->hwdata->State = OVERLAY_STATE_UNINIT; |
0 | 491 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
492 if (overlay->hwdata->channel != NULL) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
493 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
494 PgDestroyVideoChannel(overlay->hwdata->channel); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
495 overlay->hwdata->channel = NULL; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
496 return; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
497 } |
0 | 498 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
499 overlay->hwdata->CurrentFrameData = NULL; |
0 | 500 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
501 free(overlay->hwdata->FrameData0); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
502 free(overlay->hwdata->FrameData1); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
503 overlay->hwdata->FrameData0 = NULL; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
504 overlay->hwdata->FrameData1 = NULL; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
505 free(overlay->hwdata); |
0 | 506 } |