Mercurial > sdl-ios-xcode
annotate src/video/SDL_yuv_sw.c @ 1680:9488fca10677 SDL-1.3
Dummy video driver works again in high color video modes. Yay!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 14 Jun 2006 08:41:13 +0000 |
parents | 153477a6cc31 |
children | c4aa1a2f48f1 |
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:
769
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:
769
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:
769
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:
769
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:
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 |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
9
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
1680
9488fca10677
Dummy video driver works again in high color video modes. Yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1679
diff
changeset
|
24 #if 0 /* TODO */ |
0 | 25 /* This is the software implementation of the YUV video overlay support */ |
26 | |
27 /* This code was derived from code carrying the following copyright notices: | |
28 | |
29 * Copyright (c) 1995 The Regents of the University of California. | |
30 * All rights reserved. | |
31 * | |
32 * Permission to use, copy, modify, and distribute this software and its | |
33 * documentation for any purpose, without fee, and without written agreement is | |
34 * hereby granted, provided that the above copyright notice and the following | |
35 * two paragraphs appear in all copies of this software. | |
36 * | |
37 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR | |
38 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | |
39 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF | |
40 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
41 * | |
42 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, | |
43 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | |
44 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | |
45 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO | |
46 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
47 | |
48 * Copyright (c) 1995 Erik Corry | |
49 * All rights reserved. | |
50 * | |
51 * Permission to use, copy, modify, and distribute this software and its | |
52 * documentation for any purpose, without fee, and without written agreement is | |
53 * hereby granted, provided that the above copyright notice and the following | |
54 * two paragraphs appear in all copies of this software. | |
55 * | |
56 * IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | |
57 * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF | |
58 * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED | |
59 * OF THE POSSIBILITY OF SUCH DAMAGE. | |
60 * | |
61 * ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT | |
62 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
63 * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" | |
64 * BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, | |
65 * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
66 | |
67 * Portions of this software Copyright (c) 1995 Brown University. | |
68 * All rights reserved. | |
69 * | |
70 * Permission to use, copy, modify, and distribute this software and its | |
71 * documentation for any purpose, without fee, and without written agreement | |
72 * is hereby granted, provided that the above copyright notice and the | |
73 * following two paragraphs appear in all copies of this software. | |
74 * | |
75 * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR | |
76 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | |
77 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN | |
78 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
79 * | |
80 * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT | |
81 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
82 * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" | |
83 * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, | |
84 * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
85 */ | |
86 | |
87 #include "SDL_video.h" | |
739
22dbf364c017
Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
Sam Lantinga <slouken@libsdl.org>
parents:
366
diff
changeset
|
88 #include "SDL_cpuinfo.h" |
0 | 89 #include "SDL_stretch_c.h" |
90 #include "SDL_yuvfuncs.h" | |
91 #include "SDL_yuv_sw_c.h" | |
92 | |
93 /* The functions used to manipulate software video overlays */ | |
94 static struct private_yuvhwfuncs sw_yuvfuncs = { | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
95 SDL_LockYUV_SW, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
96 SDL_UnlockYUV_SW, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
97 SDL_DisplayYUV_SW, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
98 SDL_FreeYUV_SW |
0 | 99 }; |
100 | |
101 /* RGB conversion lookup tables */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
102 struct private_yuvhwdata |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
103 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
104 SDL_Surface *stretch; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
105 SDL_Surface *display; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
106 Uint8 *pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
107 int *colortab; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
108 Uint32 *rgb_2_pix; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
109 void (*Display1X) (int *colortab, Uint32 * rgb_2_pix, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
110 unsigned char *lum, unsigned char *cr, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
111 unsigned char *cb, unsigned char *out, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
112 int rows, int cols, int mod); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
113 void (*Display2X) (int *colortab, Uint32 * rgb_2_pix, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
114 unsigned char *lum, unsigned char *cr, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
115 unsigned char *cb, unsigned char *out, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
116 int rows, int cols, int mod); |
0 | 117 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
118 /* These are just so we don't have to allocate them separately */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
119 Uint16 pitches[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
120 Uint8 *planes[3]; |
0 | 121 }; |
122 | |
123 | |
124 /* The colorspace conversion functions */ | |
125 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
126 #if 0 /*defined(__GNUC__) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
127 extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
128 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
129 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
130 int rows, int cols, int mod); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
131 extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
132 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
133 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
134 int rows, int cols, int mod); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
135 #endif |
0 | 136 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
137 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
138 Color16DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
139 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
140 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
141 int rows, int cols, int mod) |
0 | 142 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
143 unsigned short *row1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
144 unsigned short *row2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
145 unsigned char *lum2; |
0 | 146 int x, y; |
147 int cr_r; | |
148 int crb_g; | |
149 int cb_b; | |
150 int cols_2 = cols / 2; | |
151 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
152 row1 = (unsigned short *) out; |
0 | 153 row2 = row1 + cols + mod; |
154 lum2 = lum + cols; | |
155 | |
156 mod += cols + mod; | |
157 | |
158 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
159 while (y--) { |
0 | 160 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
161 while (x--) { |
0 | 162 register int L; |
163 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
164 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
165 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
166 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
167 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
168 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
169 ++cb; |
0 | 170 |
171 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
172 *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
173 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
174 rgb_2_pix[L + cb_b]); |
0 | 175 |
176 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
177 *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
178 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
179 rgb_2_pix[L + cb_b]); |
0 | 180 |
181 | |
182 /* Now, do second row. */ | |
183 | |
184 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
185 *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
186 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
187 rgb_2_pix[L + cb_b]); |
0 | 188 |
189 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
190 *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
191 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
192 rgb_2_pix[L + cb_b]); |
0 | 193 } |
194 | |
195 /* | |
196 * These values are at the start of the next line, (due | |
197 * to the ++'s above),but they need to be at the start | |
198 * of the line after that. | |
199 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
200 lum += cols; |
0 | 201 lum2 += cols; |
202 row1 += mod; | |
203 row2 += mod; | |
204 } | |
205 } | |
206 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
207 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
208 Color24DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
209 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
210 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
211 int rows, int cols, int mod) |
0 | 212 { |
213 unsigned int value; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
214 unsigned char *row1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
215 unsigned char *row2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
216 unsigned char *lum2; |
0 | 217 int x, y; |
218 int cr_r; | |
219 int crb_g; | |
220 int cb_b; | |
221 int cols_2 = cols / 2; | |
222 | |
223 row1 = out; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
224 row2 = row1 + cols * 3 + mod * 3; |
0 | 225 lum2 = lum + cols; |
226 | |
227 mod += cols + mod; | |
228 mod *= 3; | |
229 | |
230 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
231 while (y--) { |
0 | 232 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
233 while (x--) { |
0 | 234 register int L; |
235 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
236 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
237 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
238 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
239 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
240 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
241 ++cb; |
0 | 242 |
243 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
244 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
245 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
246 *row1++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
247 *row1++ = (value >> 8) & 0xFF; |
0 | 248 *row1++ = (value >> 16) & 0xFF; |
249 | |
250 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
251 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
252 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
253 *row1++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
254 *row1++ = (value >> 8) & 0xFF; |
0 | 255 *row1++ = (value >> 16) & 0xFF; |
256 | |
257 | |
258 /* Now, do second row. */ | |
259 | |
260 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
261 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
262 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
263 *row2++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
264 *row2++ = (value >> 8) & 0xFF; |
0 | 265 *row2++ = (value >> 16) & 0xFF; |
266 | |
267 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
268 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
269 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
270 *row2++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
271 *row2++ = (value >> 8) & 0xFF; |
0 | 272 *row2++ = (value >> 16) & 0xFF; |
273 } | |
274 | |
275 /* | |
276 * These values are at the start of the next line, (due | |
277 * to the ++'s above),but they need to be at the start | |
278 * of the line after that. | |
279 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
280 lum += cols; |
0 | 281 lum2 += cols; |
282 row1 += mod; | |
283 row2 += mod; | |
284 } | |
285 } | |
286 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
287 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
288 Color32DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
289 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
290 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
291 int rows, int cols, int mod) |
0 | 292 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
293 unsigned int *row1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
294 unsigned int *row2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
295 unsigned char *lum2; |
0 | 296 int x, y; |
297 int cr_r; | |
298 int crb_g; | |
299 int cb_b; | |
300 int cols_2 = cols / 2; | |
301 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
302 row1 = (unsigned int *) out; |
0 | 303 row2 = row1 + cols + mod; |
304 lum2 = lum + cols; | |
305 | |
306 mod += cols + mod; | |
307 | |
308 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
309 while (y--) { |
0 | 310 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
311 while (x--) { |
0 | 312 register int L; |
313 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
314 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
315 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
316 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
317 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
318 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
319 ++cb; |
0 | 320 |
321 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
322 *row1++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
323 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 324 |
325 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
326 *row1++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
327 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 328 |
329 | |
330 /* Now, do second row. */ | |
331 | |
332 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
333 *row2++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
334 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 335 |
336 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
337 *row2++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
338 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 339 } |
340 | |
341 /* | |
342 * These values are at the start of the next line, (due | |
343 * to the ++'s above),but they need to be at the start | |
344 * of the line after that. | |
345 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
346 lum += cols; |
0 | 347 lum2 += cols; |
348 row1 += mod; | |
349 row2 += mod; | |
350 } | |
351 } | |
352 | |
353 /* | |
354 * In this function I make use of a nasty trick. The tables have the lower | |
355 * 16 bits replicated in the upper 16. This means I can write ints and get | |
356 * the horisontal doubling for free (almost). | |
357 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
358 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
359 Color16DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
360 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
361 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
362 int rows, int cols, int mod) |
0 | 363 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
364 unsigned int *row1 = (unsigned int *) out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
365 const int next_row = cols + (mod / 2); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
366 unsigned int *row2 = row1 + 2 * next_row; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
367 unsigned char *lum2; |
0 | 368 int x, y; |
369 int cr_r; | |
370 int crb_g; | |
371 int cb_b; | |
372 int cols_2 = cols / 2; | |
373 | |
374 lum2 = lum + cols; | |
375 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
376 mod = (next_row * 3) + (mod / 2); |
0 | 377 |
378 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
379 while (y--) { |
0 | 380 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
381 while (x--) { |
0 | 382 register int L; |
383 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
384 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
385 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
386 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
387 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
388 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
389 ++cb; |
0 | 390 |
391 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
392 row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
393 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
394 rgb_2_pix[L + cb_b]); |
0 | 395 row1++; |
396 | |
397 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
398 row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
399 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
400 rgb_2_pix[L + cb_b]); |
0 | 401 row1++; |
402 | |
403 | |
404 /* Now, do second row. */ | |
405 | |
406 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
407 row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
408 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
409 rgb_2_pix[L + cb_b]); |
0 | 410 row2++; |
411 | |
412 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
413 row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
414 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
415 rgb_2_pix[L + cb_b]); |
0 | 416 row2++; |
417 } | |
418 | |
419 /* | |
420 * These values are at the start of the next line, (due | |
421 * to the ++'s above),but they need to be at the start | |
422 * of the line after that. | |
423 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
424 lum += cols; |
0 | 425 lum2 += cols; |
426 row1 += mod; | |
427 row2 += mod; | |
428 } | |
429 } | |
430 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
431 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
432 Color24DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
433 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
434 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
435 int rows, int cols, int mod) |
0 | 436 { |
437 unsigned int value; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
438 unsigned char *row1 = out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
439 const int next_row = (cols * 2 + mod) * 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
440 unsigned char *row2 = row1 + 2 * next_row; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
441 unsigned char *lum2; |
0 | 442 int x, y; |
443 int cr_r; | |
444 int crb_g; | |
445 int cb_b; | |
446 int cols_2 = cols / 2; | |
447 | |
448 lum2 = lum + cols; | |
449 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
450 mod = next_row * 3 + mod * 3; |
0 | 451 |
452 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
453 while (y--) { |
0 | 454 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
455 while (x--) { |
0 | 456 register int L; |
457 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
458 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
459 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
460 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
461 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
462 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
463 ++cb; |
0 | 464 |
465 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
466 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
467 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
468 row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
469 row1[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
470 row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
471 row1[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
472 row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
473 row1[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
474 row1 += 2 * 3; |
0 | 475 |
476 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
477 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
478 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
479 row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
480 row1[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
481 row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
482 row1[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
483 row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
484 row1[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
485 row1 += 2 * 3; |
0 | 486 |
487 | |
488 /* Now, do second row. */ | |
489 | |
490 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
491 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
492 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
493 row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
494 row2[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
495 row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
496 row2[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
497 row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
498 row2[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
499 row2 += 2 * 3; |
0 | 500 |
501 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
502 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
503 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
504 row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
505 row2[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
506 row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
507 row2[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
508 row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
509 row2[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
510 row2 += 2 * 3; |
0 | 511 } |
512 | |
513 /* | |
514 * These values are at the start of the next line, (due | |
515 * to the ++'s above),but they need to be at the start | |
516 * of the line after that. | |
517 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
518 lum += cols; |
0 | 519 lum2 += cols; |
520 row1 += mod; | |
521 row2 += mod; | |
522 } | |
523 } | |
524 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
525 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
526 Color32DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
527 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
528 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
529 int rows, int cols, int mod) |
0 | 530 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
531 unsigned int *row1 = (unsigned int *) out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
532 const int next_row = cols * 2 + mod; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
533 unsigned int *row2 = row1 + 2 * next_row; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
534 unsigned char *lum2; |
0 | 535 int x, y; |
536 int cr_r; | |
537 int crb_g; | |
538 int cb_b; | |
539 int cols_2 = cols / 2; | |
540 | |
541 lum2 = lum + cols; | |
542 | |
543 mod = (next_row * 3) + mod; | |
544 | |
545 y = rows / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
546 while (y--) { |
0 | 547 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
548 while (x--) { |
0 | 549 register int L; |
550 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
551 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
552 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
553 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
554 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
555 ++cr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
556 ++cb; |
0 | 557 |
558 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
559 row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
560 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
561 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 562 row1 += 2; |
563 | |
564 L = *lum++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
565 row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
566 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
567 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 568 row1 += 2; |
569 | |
570 | |
571 /* Now, do second row. */ | |
572 | |
573 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
574 row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
575 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
576 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 577 row2 += 2; |
578 | |
579 L = *lum2++; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
580 row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
581 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
582 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 583 row2 += 2; |
584 } | |
585 | |
586 /* | |
587 * These values are at the start of the next line, (due | |
588 * to the ++'s above),but they need to be at the start | |
589 * of the line after that. | |
590 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
591 lum += cols; |
0 | 592 lum2 += cols; |
593 row1 += mod; | |
594 row2 += mod; | |
595 } | |
596 } | |
597 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
598 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
599 Color16DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
600 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
601 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
602 int rows, int cols, int mod) |
0 | 603 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
604 unsigned short *row; |
0 | 605 int x, y; |
606 int cr_r; | |
607 int crb_g; | |
608 int cb_b; | |
609 int cols_2 = cols / 2; | |
610 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
611 row = (unsigned short *) out; |
0 | 612 |
613 y = rows; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
614 while (y--) { |
0 | 615 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
616 while (x--) { |
0 | 617 register int L; |
618 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
619 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
620 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
621 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
622 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
623 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
624 cb += 4; |
0 | 625 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
626 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
627 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
628 *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
629 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
630 rgb_2_pix[L + cb_b]); |
0 | 631 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
632 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
633 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
634 *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
635 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
636 rgb_2_pix[L + cb_b]); |
0 | 637 |
638 } | |
639 | |
640 row += mod; | |
641 } | |
642 } | |
643 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
644 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
645 Color24DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
646 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
647 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
648 int rows, int cols, int mod) |
0 | 649 { |
650 unsigned int value; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
651 unsigned char *row; |
0 | 652 int x, y; |
653 int cr_r; | |
654 int crb_g; | |
655 int cb_b; | |
656 int cols_2 = cols / 2; | |
657 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
658 row = (unsigned char *) out; |
0 | 659 mod *= 3; |
660 y = rows; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
661 while (y--) { |
0 | 662 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
663 while (x--) { |
0 | 664 register int L; |
665 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
666 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
667 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
668 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
669 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
670 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
671 cb += 4; |
0 | 672 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
673 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
674 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
675 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
676 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
677 *row++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
678 *row++ = (value >> 8) & 0xFF; |
0 | 679 *row++ = (value >> 16) & 0xFF; |
680 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
681 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
682 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
683 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
684 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
685 *row++ = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
686 *row++ = (value >> 8) & 0xFF; |
0 | 687 *row++ = (value >> 16) & 0xFF; |
688 | |
689 } | |
690 row += mod; | |
691 } | |
692 } | |
693 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
694 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
695 Color32DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
696 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
697 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
698 int rows, int cols, int mod) |
0 | 699 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
700 unsigned int *row; |
0 | 701 int x, y; |
702 int cr_r; | |
703 int crb_g; | |
704 int cb_b; | |
705 int cols_2 = cols / 2; | |
706 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
707 row = (unsigned int *) out; |
0 | 708 y = rows; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
709 while (y--) { |
0 | 710 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
711 while (x--) { |
0 | 712 register int L; |
713 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
714 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
715 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
716 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
717 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
718 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
719 cb += 4; |
0 | 720 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
721 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
722 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
723 *row++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
724 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 725 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
726 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
727 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
728 *row++ = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
729 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 730 |
731 | |
732 } | |
733 row += mod; | |
734 } | |
735 } | |
736 | |
737 /* | |
738 * In this function I make use of a nasty trick. The tables have the lower | |
739 * 16 bits replicated in the upper 16. This means I can write ints and get | |
740 * the horisontal doubling for free (almost). | |
741 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
742 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
743 Color16DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
744 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
745 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
746 int rows, int cols, int mod) |
0 | 747 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
748 unsigned int *row = (unsigned int *) out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
749 const int next_row = cols + (mod / 2); |
0 | 750 int x, y; |
751 int cr_r; | |
752 int crb_g; | |
753 int cb_b; | |
754 int cols_2 = cols / 2; | |
755 | |
756 y = rows; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
757 while (y--) { |
0 | 758 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
759 while (x--) { |
0 | 760 register int L; |
761 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
762 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
763 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
764 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
765 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
766 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
767 cb += 4; |
0 | 768 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
769 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
770 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
771 row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
772 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
773 rgb_2_pix[L + cb_b]); |
0 | 774 row++; |
775 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
776 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
777 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
778 row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
779 rgb_2_pix[L + crb_g] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
780 rgb_2_pix[L + cb_b]); |
0 | 781 row++; |
782 | |
783 } | |
784 row += next_row; | |
785 } | |
786 } | |
787 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
788 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
789 Color24DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
790 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
791 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
792 int rows, int cols, int mod) |
0 | 793 { |
794 unsigned int value; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
795 unsigned char *row = out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
796 const int next_row = (cols * 2 + mod) * 3; |
0 | 797 int x, y; |
798 int cr_r; | |
799 int crb_g; | |
800 int cb_b; | |
801 int cols_2 = cols / 2; | |
802 y = rows; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
803 while (y--) { |
0 | 804 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
805 while (x--) { |
0 | 806 register int L; |
807 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
808 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
809 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
810 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
811 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
812 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
813 cb += 4; |
0 | 814 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
815 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
816 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
817 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
818 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
819 row[0 + 0] = row[3 + 0] = row[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
820 row[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
821 row[0 + 1] = row[3 + 1] = row[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
822 row[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
823 row[0 + 2] = row[3 + 2] = row[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
824 row[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
825 row += 2 * 3; |
0 | 826 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
827 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
828 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
829 value = (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
830 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
831 row[0 + 0] = row[3 + 0] = row[next_row + 0] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
832 row[next_row + 3 + 0] = (value) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
833 row[0 + 1] = row[3 + 1] = row[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
834 row[next_row + 3 + 1] = (value >> 8) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
835 row[0 + 2] = row[3 + 2] = row[next_row + 2] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
836 row[next_row + 3 + 2] = (value >> 16) & 0xFF; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
837 row += 2 * 3; |
0 | 838 |
839 } | |
840 row += next_row; | |
841 } | |
842 } | |
843 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
844 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
845 Color32DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
846 unsigned char *lum, unsigned char *cr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
847 unsigned char *cb, unsigned char *out, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
848 int rows, int cols, int mod) |
0 | 849 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
850 unsigned int *row = (unsigned int *) out; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
851 const int next_row = cols * 2 + mod; |
0 | 852 int x, y; |
853 int cr_r; | |
854 int crb_g; | |
855 int cb_b; | |
856 int cols_2 = cols / 2; | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
857 mod += mod; |
0 | 858 y = rows; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
859 while (y--) { |
0 | 860 x = cols_2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
861 while (x--) { |
0 | 862 register int L; |
863 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
864 cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
865 crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
866 + colortab[*cb + 2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
867 cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
868 cr += 4; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
869 cb += 4; |
0 | 870 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
871 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
872 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
873 row[0] = row[1] = row[next_row] = row[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
874 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
875 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 876 row += 2; |
877 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
878 L = *lum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
879 lum += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
880 row[0] = row[1] = row[next_row] = row[next_row + 1] = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
881 (rgb_2_pix[L + cr_r] | |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
882 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); |
0 | 883 row += 2; |
884 | |
885 | |
886 } | |
887 | |
888 row += next_row; | |
889 } | |
890 } | |
891 | |
892 /* | |
893 * How many 1 bits are there in the Uint32. | |
894 * Low performance, do not call often. | |
895 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
896 static int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
897 number_of_bits_set(Uint32 a) |
0 | 898 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
899 if (!a) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
900 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
901 if (a & 1) |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
902 return 1 + number_of_bits_set(a >> 1); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
903 return (number_of_bits_set(a >> 1)); |
0 | 904 } |
905 | |
906 /* | |
907 * How many 0 bits are there at least significant end of Uint32. | |
908 * Low performance, do not call often. | |
909 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
910 static int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
911 free_bits_at_bottom(Uint32 a) |
0 | 912 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
913 /* assume char is 8 bits */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
914 if (!a) |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
915 return sizeof(Uint32) * 8; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
916 if (((Sint32) a) & 1l) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
917 return 0; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
918 return 1 + free_bits_at_bottom(a >> 1); |
0 | 919 } |
920 | |
921 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
922 SDL_Overlay * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
923 SDL_CreateYUV_SW(_THIS, int width, int height, Uint32 format, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
924 SDL_Surface * display) |
0 | 925 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
926 SDL_Overlay *overlay; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
927 struct private_yuvhwdata *swdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
928 int *Cr_r_tab; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
929 int *Cr_g_tab; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
930 int *Cb_g_tab; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
931 int *Cb_b_tab; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
932 Uint32 *r_2_pix_alloc; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
933 Uint32 *g_2_pix_alloc; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
934 Uint32 *b_2_pix_alloc; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
935 int i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
936 int CR, CB; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
937 Uint32 Rmask, Gmask, Bmask; |
0 | 938 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
939 /* Only RGB packed pixel conversion supported */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
940 if ((display->format->BytesPerPixel != 2) && |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
941 (display->format->BytesPerPixel != 3) && |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
942 (display->format->BytesPerPixel != 4)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
943 SDL_SetError("Can't use YUV data on non 16/24/32 bit surfaces"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
944 return (NULL); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
945 } |
0 | 946 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
947 /* Verify that we support the format */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
948 switch (format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
949 case SDL_YV12_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
950 case SDL_IYUV_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
951 case SDL_YUY2_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
952 case SDL_UYVY_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
953 case SDL_YVYU_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
954 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
955 default: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
956 SDL_SetError("Unsupported YUV format"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
957 return (NULL); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
958 } |
0 | 959 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
960 /* Create the overlay structure */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
961 overlay = (SDL_Overlay *) SDL_malloc(sizeof *overlay); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
962 if (overlay == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
963 SDL_OutOfMemory(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
964 return (NULL); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
965 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
966 SDL_memset(overlay, 0, (sizeof *overlay)); |
0 | 967 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
968 /* Fill in the basic members */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
969 overlay->format = format; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
970 overlay->w = width; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
971 overlay->h = height; |
0 | 972 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
973 /* Set up the YUV surface function structure */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
974 overlay->hwfuncs = &sw_yuvfuncs; |
0 | 975 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
976 /* Create the pixel data and lookup tables */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
977 swdata = (struct private_yuvhwdata *) SDL_malloc(sizeof *swdata); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
978 overlay->hwdata = swdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
979 if (swdata == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
980 SDL_OutOfMemory(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
981 SDL_FreeYUVOverlay(overlay); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
982 return (NULL); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
983 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
984 swdata->stretch = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
985 swdata->display = display; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
986 swdata->pixels = (Uint8 *) SDL_malloc(width * height * 2); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
987 swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
988 Cr_r_tab = &swdata->colortab[0 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
989 Cr_g_tab = &swdata->colortab[1 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
990 Cb_g_tab = &swdata->colortab[2 * 256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
991 Cb_b_tab = &swdata->colortab[3 * 256]; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
992 swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
993 r_2_pix_alloc = &swdata->rgb_2_pix[0 * 768]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
994 g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
995 b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
996 if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
997 SDL_OutOfMemory(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
998 SDL_FreeYUVOverlay(overlay); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
999 return (NULL); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1000 } |
0 | 1001 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1002 /* Generate the tables for the display surface */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1003 for (i = 0; i < 256; i++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1004 /* Gamma correction (luminescence table) and chroma correction |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1005 would be done here. See the Berkeley mpeg_play sources. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1006 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1007 CB = CR = (i - 128); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1008 Cr_r_tab[i] = (int) ((0.419 / 0.299) * CR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1009 Cr_g_tab[i] = (int) (-(0.299 / 0.419) * CR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1010 Cb_g_tab[i] = (int) (-(0.114 / 0.331) * CB); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1011 Cb_b_tab[i] = (int) ((0.587 / 0.331) * CB); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1012 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1013 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1014 /* |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1015 * Set up entries 0-255 in rgb-to-pixel value tables. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1016 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1017 Rmask = display->format->Rmask; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1018 Gmask = display->format->Gmask; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1019 Bmask = display->format->Bmask; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1020 for (i = 0; i < 256; ++i) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1021 r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Rmask)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1022 r_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Rmask); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1023 g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Gmask)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1024 g_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Gmask); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1025 b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Bmask)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1026 b_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Bmask); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1027 } |
0 | 1028 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1029 /* |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1030 * If we have 16-bit output depth, then we double the value |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1031 * in the top word. This means that we can write out both |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1032 * pixels in the pixel doubling mode with one op. It is |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1033 * harmless in the normal case as storing a 32-bit value |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1034 * through a short pointer will lose the top bits anyway. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1035 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1036 if (display->format->BytesPerPixel == 2) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1037 for (i = 0; i < 256; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1038 r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1039 g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1040 b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1041 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1042 } |
0 | 1043 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1044 /* |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1045 * Spread out the values we have to the rest of the array so that |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1046 * we do not need to check for overflow. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1047 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1048 for (i = 0; i < 256; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1049 r_2_pix_alloc[i] = r_2_pix_alloc[256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1050 r_2_pix_alloc[i + 512] = r_2_pix_alloc[511]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1051 g_2_pix_alloc[i] = g_2_pix_alloc[256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1052 g_2_pix_alloc[i + 512] = g_2_pix_alloc[511]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1053 b_2_pix_alloc[i] = b_2_pix_alloc[256]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1054 b_2_pix_alloc[i + 512] = b_2_pix_alloc[511]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1055 } |
0 | 1056 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1057 /* You have chosen wisely... */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1058 switch (format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1059 case SDL_YV12_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1060 case SDL_IYUV_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1061 if (display->format->BytesPerPixel == 2) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1062 #if 0 /*defined(__GNUC__) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1063 /* inline assembly functions */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1064 if (SDL_HasMMX() && (Rmask == 0xF800) && |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1065 (Gmask == 0x07E0) && (Bmask == 0x001F) && (width & 15) == 0) { |
0 | 1066 /*printf("Using MMX 16-bit 565 dither\n");*/ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1067 swdata->Display1X = Color565DitherYV12MMX1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1068 } else { |
0 | 1069 /*printf("Using C 16-bit dither\n");*/ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1070 swdata->Display1X = Color16DitherYV12Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1071 } |
0 | 1072 #else |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1073 swdata->Display1X = Color16DitherYV12Mod1X; |
0 | 1074 #endif |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1075 swdata->Display2X = Color16DitherYV12Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1076 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1077 if (display->format->BytesPerPixel == 3) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1078 swdata->Display1X = Color24DitherYV12Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1079 swdata->Display2X = Color24DitherYV12Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1080 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1081 if (display->format->BytesPerPixel == 4) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1082 #if 0 /*defined(__GNUC__) && defined(__i386__) && SDL_ASSEMBLY_ROUTINES */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1083 /* inline assembly functions */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1084 if (SDL_HasMMX() && (Rmask == 0x00FF0000) && |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1085 (Gmask == 0x0000FF00) && |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1086 (Bmask == 0x000000FF) && (width & 15) == 0) { |
0 | 1087 /*printf("Using MMX 32-bit dither\n");*/ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1088 swdata->Display1X = ColorRGBDitherYV12MMX1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1089 } else { |
0 | 1090 /*printf("Using C 32-bit dither\n");*/ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1091 swdata->Display1X = Color32DitherYV12Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1092 } |
0 | 1093 #else |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1094 swdata->Display1X = Color32DitherYV12Mod1X; |
0 | 1095 #endif |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1096 swdata->Display2X = Color32DitherYV12Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1097 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1098 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1099 case SDL_YUY2_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1100 case SDL_UYVY_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1101 case SDL_YVYU_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1102 if (display->format->BytesPerPixel == 2) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1103 swdata->Display1X = Color16DitherYUY2Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1104 swdata->Display2X = Color16DitherYUY2Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1105 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1106 if (display->format->BytesPerPixel == 3) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1107 swdata->Display1X = Color24DitherYUY2Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1108 swdata->Display2X = Color24DitherYUY2Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1109 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1110 if (display->format->BytesPerPixel == 4) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1111 swdata->Display1X = Color32DitherYUY2Mod1X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1112 swdata->Display2X = Color32DitherYUY2Mod2X; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1113 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1114 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1115 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1116 /* We should never get here (caught above) */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1117 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1118 } |
0 | 1119 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1120 /* Find the pitch and offset values for the overlay */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1121 overlay->pitches = swdata->pitches; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1122 overlay->pixels = swdata->planes; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1123 switch (format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1124 case SDL_YV12_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1125 case SDL_IYUV_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1126 overlay->pitches[0] = overlay->w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1127 overlay->pitches[1] = overlay->pitches[0] / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1128 overlay->pitches[2] = overlay->pitches[0] / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1129 overlay->pixels[0] = swdata->pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1130 overlay->pixels[1] = overlay->pixels[0] + |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1131 overlay->pitches[0] * overlay->h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1132 overlay->pixels[2] = overlay->pixels[1] + |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1133 overlay->pitches[1] * overlay->h / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1134 overlay->planes = 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1135 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1136 case SDL_YUY2_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1137 case SDL_UYVY_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1138 case SDL_YVYU_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1139 overlay->pitches[0] = overlay->w * 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1140 overlay->pixels[0] = swdata->pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1141 overlay->planes = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1142 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1143 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1144 /* We should never get here (caught above) */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1145 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1146 } |
0 | 1147 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1148 /* We're all done.. */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1149 return (overlay); |
0 | 1150 } |
1151 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1152 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1153 SDL_LockYUV_SW(_THIS, SDL_Overlay * overlay) |
0 | 1154 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1155 return (0); |
0 | 1156 } |
1157 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1158 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1159 SDL_UnlockYUV_SW(_THIS, SDL_Overlay * overlay) |
0 | 1160 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1161 return; |
0 | 1162 } |
1163 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1164 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1165 SDL_DisplayYUV_SW(_THIS, SDL_Overlay * overlay, SDL_Rect * src, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1166 SDL_Rect * dst) |
0 | 1167 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1168 struct private_yuvhwdata *swdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1169 int stretch; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1170 int scale_2x; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1171 SDL_Surface *display; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1172 Uint8 *lum, *Cr, *Cb; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1173 Uint8 *dstp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1174 int mod; |
0 | 1175 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1176 swdata = overlay->hwdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1177 stretch = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1178 scale_2x = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1179 if (src->x || src->y || src->w < overlay->w || src->h < overlay->h) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1180 /* The source rectangle has been clipped. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1181 Using a scratch surface is easier than adding clipped |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1182 source support to all the blitters, plus that would |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1183 slow them down in the general unclipped case. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1184 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1185 stretch = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1186 } else if ((src->w != dst->w) || (src->h != dst->h)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1187 if ((dst->w == 2 * src->w) && (dst->h == 2 * src->h)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1188 scale_2x = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1189 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1190 stretch = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1191 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1192 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1193 if (stretch) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1194 if (!swdata->stretch) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1195 display = swdata->display; |
1672
8e754b82cecc
Updated SDL_Surface code for software-only access, fixed some build errors
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
1196 swdata->stretch = SDL_CreateRGBSurface(0, |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1197 overlay->w, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1198 overlay->h, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1199 display->format-> |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1200 BitsPerPixel, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1201 display->format-> |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1202 Rmask, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1203 display->format-> |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1204 Gmask, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1205 display->format->Bmask, 0); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1206 if (!swdata->stretch) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1207 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1208 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1209 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1210 display = swdata->stretch; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1211 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1212 display = swdata->display; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1213 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1214 switch (overlay->format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1215 case SDL_YV12_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1216 lum = overlay->pixels[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1217 Cr = overlay->pixels[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1218 Cb = overlay->pixels[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1219 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1220 case SDL_IYUV_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1221 lum = overlay->pixels[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1222 Cr = overlay->pixels[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1223 Cb = overlay->pixels[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1224 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1225 case SDL_YUY2_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1226 lum = overlay->pixels[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1227 Cr = lum + 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1228 Cb = lum + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1229 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1230 case SDL_UYVY_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1231 lum = overlay->pixels[0] + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1232 Cr = lum + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1233 Cb = lum - 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1234 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1235 case SDL_YVYU_OVERLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1236 lum = overlay->pixels[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1237 Cr = lum + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1238 Cb = lum + 3; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1239 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1240 default: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1241 SDL_SetError("Unsupported YUV format in blit"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1242 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1243 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1244 if (SDL_MUSTLOCK(display)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1245 if (SDL_LockSurface(display) < 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1246 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1247 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1248 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1249 if (stretch) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1250 dstp = (Uint8 *) swdata->stretch->pixels; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1251 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1252 dstp = (Uint8 *) display->pixels |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1253 + dst->x * display->format->BytesPerPixel |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1254 + dst->y * display->pitch; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1255 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1256 mod = (display->pitch / display->format->BytesPerPixel); |
0 | 1257 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1258 if (scale_2x) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1259 mod -= (overlay->w * 2); |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1260 swdata->Display2X(swdata->colortab, swdata->rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1261 lum, Cr, Cb, dstp, overlay->h, overlay->w, mod); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1262 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1263 mod -= overlay->w; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1264 swdata->Display1X(swdata->colortab, swdata->rgb_2_pix, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1265 lum, Cr, Cb, dstp, overlay->h, overlay->w, mod); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1266 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1267 if (SDL_MUSTLOCK(display)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1268 SDL_UnlockSurface(display); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1269 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1270 if (stretch) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1271 display = swdata->display; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1272 SDL_SoftStretch(swdata->stretch, src, display, dst); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1273 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1274 SDL_UpdateRects(display, 1, dst); |
0 | 1275 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1276 return (0); |
0 | 1277 } |
1278 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1279 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1280 SDL_FreeYUV_SW(_THIS, SDL_Overlay * overlay) |
0 | 1281 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1282 struct private_yuvhwdata *swdata; |
0 | 1283 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1284 swdata = overlay->hwdata; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1285 if (swdata) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1286 if (swdata->stretch) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1287 SDL_FreeSurface(swdata->stretch); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1288 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1289 if (swdata->pixels) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1290 SDL_free(swdata->pixels); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1291 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1292 if (swdata->colortab) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1293 SDL_free(swdata->colortab); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1294 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1295 if (swdata->rgb_2_pix) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1296 SDL_free(swdata->rgb_2_pix); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1297 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
1298 SDL_free(swdata); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1299 } |
0 | 1300 } |
1679 | 1301 #endif /* TODO */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1302 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1644
diff
changeset
|
1303 /* vi: set ts=4 sw=4 expandtab: */ |