203 |
|
VideoModes.push_back(mode); |
204 |
|
} |
205 |
|
|
206 |
+ |
// Add standard list of windowed modes for given color depth |
207 |
+ |
static void add_window_modes(video_depth depth) |
208 |
+ |
{ |
209 |
+ |
add_mode(512, 384, 0x80, TrivialBytesPerRow(512, depth), depth); |
210 |
+ |
add_mode(640, 480, 0x81, TrivialBytesPerRow(640, depth), depth); |
211 |
+ |
add_mode(800, 600, 0x82, TrivialBytesPerRow(800, depth), depth); |
212 |
+ |
add_mode(1024, 768, 0x83, TrivialBytesPerRow(1024, depth), depth); |
213 |
+ |
add_mode(1152, 870, 0x84, TrivialBytesPerRow(1152, depth), depth); |
214 |
+ |
add_mode(1280, 1024, 0x85, TrivialBytesPerRow(1280, depth), depth); |
215 |
+ |
add_mode(1600, 1200, 0x86, TrivialBytesPerRow(1600, depth), depth); |
216 |
+ |
} |
217 |
+ |
|
218 |
|
// Set Mac frame layout and base address (uses the_buffer/MacFrameBaseMac) |
219 |
|
static void set_mac_frame_buffer(video_depth depth, bool native_byte_order) |
220 |
|
{ |
1303 |
|
if (classic) |
1304 |
|
add_mode(512, 342, 0x80, 64, VDEPTH_1BIT); |
1305 |
|
else { |
1306 |
< |
if (default_depth != VDEPTH_1BIT) { // 1-bit modes are always available |
1307 |
< |
add_mode(512, 384, 0x80, TrivialBytesPerRow(512, VDEPTH_1BIT), VDEPTH_1BIT); |
1296 |
< |
add_mode(640, 480, 0x81, TrivialBytesPerRow(640, VDEPTH_1BIT), VDEPTH_1BIT); |
1297 |
< |
add_mode(800, 600, 0x82, TrivialBytesPerRow(800, VDEPTH_1BIT), VDEPTH_1BIT); |
1298 |
< |
add_mode(1024, 768, 0x83, TrivialBytesPerRow(1024, VDEPTH_1BIT), VDEPTH_1BIT); |
1299 |
< |
add_mode(1152, 870, 0x84, TrivialBytesPerRow(1152, VDEPTH_1BIT), VDEPTH_1BIT); |
1300 |
< |
add_mode(1280, 1024, 0x85, TrivialBytesPerRow(1280, VDEPTH_1BIT), VDEPTH_1BIT); |
1301 |
< |
add_mode(1600, 1200, 0x86, TrivialBytesPerRow(1600, VDEPTH_1BIT), VDEPTH_1BIT); |
1302 |
< |
} |
1306 |
> |
if (default_depth != VDEPTH_1BIT) |
1307 |
> |
add_window_modes(VDEPTH_1BIT); // 1-bit modes are always available |
1308 |
|
#ifdef ENABLE_VOSF |
1309 |
< |
if (default_depth > VDEPTH_8BIT) { // 8-bit modes are also possible on 16/32-bit screens with VOSF blitters |
1310 |
< |
add_mode(512, 384, 0x80, TrivialBytesPerRow(512, VDEPTH_8BIT), VDEPTH_8BIT); |
1311 |
< |
add_mode(640, 480, 0x81, TrivialBytesPerRow(640, VDEPTH_8BIT), VDEPTH_8BIT); |
1312 |
< |
add_mode(800, 600, 0x82, TrivialBytesPerRow(800, VDEPTH_8BIT), VDEPTH_8BIT); |
1308 |
< |
add_mode(1024, 768, 0x83, TrivialBytesPerRow(1024, VDEPTH_8BIT), VDEPTH_8BIT); |
1309 |
< |
add_mode(1152, 870, 0x84, TrivialBytesPerRow(1152, VDEPTH_8BIT), VDEPTH_8BIT); |
1310 |
< |
add_mode(1280, 1024, 0x85, TrivialBytesPerRow(1280, VDEPTH_8BIT), VDEPTH_8BIT); |
1311 |
< |
add_mode(1600, 1200, 0x86, TrivialBytesPerRow(1600, VDEPTH_8BIT), VDEPTH_8BIT); |
1309 |
> |
if (default_depth > VDEPTH_8BIT) { |
1310 |
> |
add_window_modes(VDEPTH_2BIT); // 2, 4 and 8-bit modes are also possible on 16/32-bit screens with VOSF blitters |
1311 |
> |
add_window_modes(VDEPTH_4BIT); |
1312 |
> |
add_window_modes(VDEPTH_8BIT); |
1313 |
|
} |
1314 |
|
#endif |
1315 |
< |
add_mode(512, 384, 0x80, TrivialBytesPerRow(512, default_depth), default_depth); |
1315 |
< |
add_mode(640, 480, 0x81, TrivialBytesPerRow(640, default_depth), default_depth); |
1316 |
< |
add_mode(800, 600, 0x82, TrivialBytesPerRow(800, default_depth), default_depth); |
1317 |
< |
add_mode(1024, 768, 0x83, TrivialBytesPerRow(1024, default_depth), default_depth); |
1318 |
< |
add_mode(1152, 870, 0x84, TrivialBytesPerRow(1152, default_depth), default_depth); |
1319 |
< |
add_mode(1280, 1024, 0x85, TrivialBytesPerRow(1280, default_depth), default_depth); |
1320 |
< |
add_mode(1600, 1200, 0x86, TrivialBytesPerRow(1600, default_depth), default_depth); |
1315 |
> |
add_window_modes(default_depth); |
1316 |
|
} |
1317 |
|
} else |
1318 |
|
add_mode(default_width, default_height, 0x80, TrivialBytesPerRow(default_width, default_depth), default_depth); |
1439 |
|
* Set palette |
1440 |
|
*/ |
1441 |
|
|
1442 |
< |
void video_set_palette(uint8 *pal) |
1442 |
> |
void video_set_palette(uint8 *pal, int num_in) |
1443 |
|
{ |
1444 |
|
LOCK_PALETTE; |
1445 |
|
|
1446 |
|
// Convert colors to XColor array |
1447 |
< |
int num_in = 256, num_out = 256; |
1453 |
< |
if (VideoMonitor.mode.depth == VDEPTH_16BIT) |
1454 |
< |
num_in = 32; |
1447 |
> |
int num_out = 256; |
1448 |
|
if (IsDirectMode(VideoMonitor.mode)) { |
1449 |
< |
// If X is in 565 mode we have to stretch the palette from 32 to 64 entries |
1449 |
> |
// If X is in 565 mode we have to stretch the gamma table from 32 to 64 entries |
1450 |
|
num_out = vis->map_entries; |
1451 |
|
} |
1452 |
|
XColor *p = palette; |
1464 |
|
#ifdef ENABLE_VOSF |
1465 |
|
// Recalculate pixel color expansion map |
1466 |
|
if (!IsDirectMode(VideoMonitor.mode) && (vis->c_class == TrueColor || vis->c_class == DirectColor)) { |
1467 |
< |
for (int i=0; i<256; i++) |
1468 |
< |
ExpandMap[i] = map_rgb(pal[i*3+0], pal[i*3+1], pal[i*3+2]); |
1467 |
> |
for (int i=0; i<256; i++) { |
1468 |
> |
int c = i % num_in; // If there are less than 256 colors, we repeat the first entries (this makes color expansion easier) |
1469 |
> |
ExpandMap[i] = map_rgb(pal[c*3+0], pal[c*3+1], pal[c*3+2]); |
1470 |
> |
} |
1471 |
|
|
1472 |
|
// We have to redraw everything because the interpretation of pixel values changed |
1473 |
|
LOCK_VOSF; |