19 |
|
*/ |
20 |
|
|
21 |
|
#include "sysdeps.h" |
22 |
+ |
#include "video.h" |
23 |
|
|
24 |
|
#include <stdio.h> |
25 |
|
#include <stdlib.h> |
305 |
|
// Initialize the framebuffer update function |
306 |
|
// Returns FALSE, if the function was to be reduced to a simple memcpy() |
307 |
|
// --> In that case, VOSF is not necessary |
308 |
< |
bool Screen_blitter_init(XVisualInfo * visual_info, bool native_byte_order) |
308 |
> |
bool Screen_blitter_init(XVisualInfo * visual_info, bool native_byte_order, video_depth mac_depth) |
309 |
|
{ |
310 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
311 |
< |
visualFormat.depth = visual_info->depth; |
312 |
< |
visualFormat.Rmask = visual_info->red_mask; |
313 |
< |
visualFormat.Gmask = visual_info->green_mask; |
314 |
< |
visualFormat.Bmask = visual_info->blue_mask; |
311 |
> |
if (mac_depth == VDEPTH_1BIT) { |
312 |
> |
|
313 |
> |
// 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines |
314 |
> |
Screen_blit = Blit_Copy_Raw; |
315 |
> |
|
316 |
> |
} else { |
317 |
> |
|
318 |
> |
visualFormat.depth = visual_info->depth; |
319 |
> |
visualFormat.Rmask = visual_info->red_mask; |
320 |
> |
visualFormat.Gmask = visual_info->green_mask; |
321 |
> |
visualFormat.Bmask = visual_info->blue_mask; |
322 |
|
|
323 |
< |
// Compute RGB shift values |
324 |
< |
visualFormat.Rshift = 0; |
325 |
< |
for (uint32 Rmask = visualFormat.Rmask; Rmask && ((Rmask & 1) != 1); Rmask >>= 1) |
326 |
< |
++visualFormat.Rshift; |
327 |
< |
visualFormat.Gshift = 0; |
328 |
< |
for (uint32 Gmask = visualFormat.Gmask; Gmask && ((Gmask & 1) != 1); Gmask >>= 1) |
329 |
< |
++visualFormat.Gshift; |
330 |
< |
visualFormat.Bshift = 0; |
331 |
< |
for (uint32 Bmask = visualFormat.Bmask; Bmask && ((Bmask & 1) != 1); Bmask >>= 1) |
332 |
< |
++visualFormat.Bshift; |
323 |
> |
// Compute RGB shift values |
324 |
> |
visualFormat.Rshift = 0; |
325 |
> |
for (uint32 Rmask = visualFormat.Rmask; Rmask && ((Rmask & 1) != 1); Rmask >>= 1) |
326 |
> |
++visualFormat.Rshift; |
327 |
> |
visualFormat.Gshift = 0; |
328 |
> |
for (uint32 Gmask = visualFormat.Gmask; Gmask && ((Gmask & 1) != 1); Gmask >>= 1) |
329 |
> |
++visualFormat.Gshift; |
330 |
> |
visualFormat.Bshift = 0; |
331 |
> |
for (uint32 Bmask = visualFormat.Bmask; Bmask && ((Bmask & 1) != 1); Bmask >>= 1) |
332 |
> |
++visualFormat.Bshift; |
333 |
|
|
334 |
< |
// Search for an adequate blit function |
335 |
< |
bool blitter_found = false; |
336 |
< |
const int blitters_count = sizeof(Screen_blitters)/sizeof(Screen_blitters[0]); |
337 |
< |
for (int i = 0; !blitter_found && (i < blitters_count); i++) { |
338 |
< |
if ( (visualFormat.depth == Screen_blitters[i].depth) |
339 |
< |
&& (visualFormat.Rmask == Screen_blitters[i].Rmask) |
340 |
< |
&& (visualFormat.Gmask == Screen_blitters[i].Gmask) |
341 |
< |
&& (visualFormat.Bmask == Screen_blitters[i].Bmask) |
342 |
< |
) |
343 |
< |
{ |
344 |
< |
blitter_found = true; |
345 |
< |
Screen_blit = native_byte_order |
346 |
< |
? Screen_blitters[i].handler_nbo |
347 |
< |
: Screen_blitters[i].handler_obo |
348 |
< |
; |
334 |
> |
// Search for an adequate blit function |
335 |
> |
bool blitter_found = false; |
336 |
> |
const int blitters_count = sizeof(Screen_blitters)/sizeof(Screen_blitters[0]); |
337 |
> |
for (int i = 0; !blitter_found && (i < blitters_count); i++) { |
338 |
> |
if ( (visualFormat.depth == Screen_blitters[i].depth) |
339 |
> |
&& (visualFormat.Rmask == Screen_blitters[i].Rmask) |
340 |
> |
&& (visualFormat.Gmask == Screen_blitters[i].Gmask) |
341 |
> |
&& (visualFormat.Bmask == Screen_blitters[i].Bmask) |
342 |
> |
) |
343 |
> |
{ |
344 |
> |
blitter_found = true; |
345 |
> |
Screen_blit = native_byte_order |
346 |
> |
? Screen_blitters[i].handler_nbo |
347 |
> |
: Screen_blitters[i].handler_obo |
348 |
> |
; |
349 |
> |
} |
350 |
|
} |
342 |
– |
} |
351 |
|
|
352 |
< |
// No appropriate blitter found, dump RGB mask values and abort() |
353 |
< |
if (!blitter_found) { |
354 |
< |
fprintf(stderr, "### No appropriate blitter found\n"); |
355 |
< |
fprintf(stderr, "\tR/G/B mask values : 0x%06x, 0x%06x, 0x%06x (depth = %d)\n", |
356 |
< |
visualFormat.Rmask, visualFormat.Gmask, visualFormat.Bmask, visualFormat.depth); |
357 |
< |
fprintf(stderr, "\tR/G/B shift values : %d/%d/%d\n", |
358 |
< |
visualFormat.Rshift, visualFormat.Gshift, visualFormat.Bshift); |
359 |
< |
abort(); |
352 |
> |
// No appropriate blitter found, dump RGB mask values and abort() |
353 |
> |
if (!blitter_found) { |
354 |
> |
fprintf(stderr, "### No appropriate blitter found\n"); |
355 |
> |
fprintf(stderr, "\tR/G/B mask values : 0x%06x, 0x%06x, 0x%06x (depth = %d)\n", |
356 |
> |
visualFormat.Rmask, visualFormat.Gmask, visualFormat.Bmask, visualFormat.depth); |
357 |
> |
fprintf(stderr, "\tR/G/B shift values : %d/%d/%d\n", |
358 |
> |
visualFormat.Rshift, visualFormat.Gshift, visualFormat.Bshift); |
359 |
> |
abort(); |
360 |
> |
} |
361 |
|
} |
362 |
|
#else |
363 |
|
// The UAE memory handlers will blit correctly |