From 134227aa8ccd822e2a836042ba734213c5b15023 Mon Sep 17 00:00:00 2001 From: egladil Date: Thu, 25 Oct 2007 23:45:03 +0000 Subject: (svn r11342) -Fix: [OSX] The cocoa driver incorrectly assumed that the blitter always was 8bpp. Now both 8bpp and 32bpp blitters can be used. The driver will check the blitter screen depth. In fullscreen it will select a proper video mode for this depth, and in windowed mode it will simply skip doing fake 8bpp. --- src/os/macosx/splash.cpp | 60 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 18 deletions(-) (limited to 'src/os') diff --git a/src/os/macosx/splash.cpp b/src/os/macosx/splash.cpp index 30eed880d..45973c781 100644 --- a/src/os/macosx/splash.cpp +++ b/src/os/macosx/splash.cpp @@ -8,6 +8,7 @@ #include "../../functions.h" #include "../../gfx.h" #include "../../fileio.h" +#include "../../blitter/factory.hpp" #include "splash.h" @@ -36,7 +37,7 @@ void DisplaySplashImage() png_colorp palette; int num_palette; png_bytep *row_pointers; - uint8 *src, *dst; + uint8 *src; uint y; uint xoff, yoff; int i; @@ -103,32 +104,55 @@ void DisplaySplashImage() row_pointers = png_get_rows(png_ptr, info_ptr); - memset(_screen.dst_ptr, 0xff, _screen.pitch * _screen.height); - if (width > (uint) _screen.width) width = _screen.width; if (height > (uint) _screen.height) height = _screen.height; xoff = (_screen.width - width) / 2; yoff = (_screen.height - height) / 2; - for (y = 0; y < height; y++) { - src = row_pointers[y]; - dst = ((uint8 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff; - memcpy(dst, src, width); - } + switch (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth()) { + case 8: { + uint8 *dst; - for (i = 0; i < num_palette; i++) { - _cur_palette[i].r = palette[i].red; - _cur_palette[i].g = palette[i].green; - _cur_palette[i].b = palette[i].blue; - } + memset(_screen.dst_ptr, 0xff, _screen.pitch * _screen.height); + + for (y = 0; y < height; y++) { + src = row_pointers[y]; + dst = ((uint8 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff; + + memcpy(dst, src, width); + } - _cur_palette[0xff].r = 0; - _cur_palette[0xff].g = 0; - _cur_palette[0xff].b = 0; + for (i = 0; i < num_palette; i++) { + _cur_palette[i].r = palette[i].red; + _cur_palette[i].g = palette[i].green; + _cur_palette[i].b = palette[i].blue; + } - _pal_first_dirty = 0; - _pal_count_dirty = 256; + _cur_palette[0xff].r = 0; + _cur_palette[0xff].g = 0; + _cur_palette[0xff].b = 0; + + _pal_first_dirty = 0; + _pal_count_dirty = 256; + } + break; + case 32: { + uint32 *dst; + int x; + + memset(_screen.dst_ptr, 0xff000000, _screen.pitch * _screen.height * 4); + + for (y = 0; y < height; y++) { + src = row_pointers[y]; + dst = ((uint32 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff; + + for (x = 0; x < width; x++) + dst[x] = palette[src[x]].blue | (palette[src[x]].green << 8) | (palette[src[x]].red << 16) | 0xff000000; + } + } + break; + } png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(f); -- cgit v1.2.3-54-g00ecf