src/os/macosx/splash.cpp
author rubidium
Tue, 06 May 2008 15:11:33 +0000
changeset 9111 48ce04029fe4
parent 8131 160939e24ed3
child 9551 6f60dca6c566
permissions -rw-r--r--
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
2847
65c54f935db6 (svn r3395) Add Id tag (and svn property) to macosx files.
peter1138
parents: 2736
diff changeset
     1
/* $Id$ */
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8131
diff changeset
     3
/** @file splash.cpp Splash screen support for OSX. */
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8131
diff changeset
     4
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     5
#include "../../stdafx.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     6
#include "../../openttd.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     7
#include "../../variables.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     8
#include "../../debug.h"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8115
diff changeset
     9
#include "../../gfx_func.h"
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    10
#include "../../fileio.h"
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
    11
#include "../../blitter/factory.hpp"
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    12
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    13
#include "splash.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    14
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    15
#ifdef WITH_PNG
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    16
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    17
#include <png.h>
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    18
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    19
static void PNGAPI png_my_error(png_structp png_ptr, png_const_charp message)
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    20
{
5388
db011d108caa (svn r7577) -Fix (r7565): Missed out some OSX files (Bjarni)
Darkvater
parents: 4300
diff changeset
    21
	DEBUG(misc, 0, "[libpng] error: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    22
	longjmp(png_ptr->jmpbuf, 1);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    23
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    24
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    25
static void PNGAPI png_my_warning(png_structp png_ptr, png_const_charp message)
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    26
{
5388
db011d108caa (svn r7577) -Fix (r7565): Missed out some OSX files (Bjarni)
Darkvater
parents: 4300
diff changeset
    27
	DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    28
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    29
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5584
diff changeset
    30
void DisplaySplashImage()
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    31
{
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    32
	png_byte header[8];
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    33
	FILE *f;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    34
	png_structp png_ptr;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    35
	png_infop info_ptr, end_info;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    36
	uint width, height, bit_depth, color_type;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    37
	png_colorp palette;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    38
	int num_palette;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    39
	png_bytep *row_pointers;
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
    40
	uint8 *src;
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    41
	uint y;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    42
	uint xoff, yoff;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    43
	int i;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    44
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    45
	f = FioFOpenFile(SPLASH_IMAGE_FILE);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    46
	if (f == NULL) return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    47
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    48
	fread(header, 1, 8, f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    49
	if (png_sig_cmp(header, 0, 8) != 0) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    50
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    51
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    52
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    53
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    54
	png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, (png_voidp) NULL, png_my_error, png_my_warning);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    55
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    56
	if (png_ptr == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    57
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    58
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    59
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    60
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    61
	info_ptr = png_create_info_struct(png_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    62
	if (info_ptr == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    63
		png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    64
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    65
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    66
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    67
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    68
	end_info = png_create_info_struct(png_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    69
	if (end_info == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    70
		png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    71
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    72
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    73
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    74
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    75
	if (setjmp(png_jmpbuf(png_ptr))) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    76
		png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    77
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    78
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    79
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    80
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    81
	png_init_io(png_ptr, f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    82
	png_set_sig_bytes(png_ptr, 8);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    83
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    84
	png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    85
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    86
	width            = png_get_image_width(png_ptr, info_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    87
	height           = png_get_image_height(png_ptr, info_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    88
	bit_depth        = png_get_bit_depth(png_ptr, info_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    89
	color_type       = png_get_color_type(png_ptr, info_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    90
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
    91
	if (color_type != PNG_COLOR_TYPE_PALETTE || bit_depth != 8) {
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    92
		png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    93
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    94
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    95
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    96
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
    97
	if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) {
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    98
		png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    99
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   100
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   101
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   102
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   103
	png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   104
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   105
	row_pointers = png_get_rows(png_ptr, info_ptr);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   106
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
   107
	if (width > (uint) _screen.width) width = _screen.width;
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
   108
	if (height > (uint) _screen.height) height = _screen.height;
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   109
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   110
	xoff = (_screen.width - width) / 2;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   111
	yoff = (_screen.height - height) / 2;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   112
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   113
	switch (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth()) {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   114
		case 8: {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   115
				uint8 *dst;
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   116
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   117
				memset(_screen.dst_ptr, 0xff, _screen.pitch * _screen.height);
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   118
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   119
				for (y = 0; y < height; y++) {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   120
					src = row_pointers[y];
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   121
					dst = ((uint8 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   122
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   123
					memcpy(dst, src, width);
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   124
				}
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   125
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   126
				for (i = 0; i < num_palette; i++) {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   127
					_cur_palette[i].r = palette[i].red;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   128
					_cur_palette[i].g = palette[i].green;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   129
					_cur_palette[i].b = palette[i].blue;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   130
				}
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   131
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   132
				_cur_palette[0xff].r = 0;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   133
				_cur_palette[0xff].g = 0;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   134
				_cur_palette[0xff].b = 0;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   135
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   136
				_pal_first_dirty = 0;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   137
				_pal_count_dirty = 256;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   138
			}
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   139
			break;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   140
		case 32: {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   141
				uint32 *dst;
7801
4ff6114abbd6 (svn r11351) -Fix (r11342): [OSX] killed a warning
bjarni
parents: 7792
diff changeset
   142
				uint x;
7792
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   143
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   144
				memset(_screen.dst_ptr, 0xff000000, _screen.pitch * _screen.height * 4);
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   145
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   146
				for (y = 0; y < height; y++) {
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   147
					src = row_pointers[y];
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   148
					dst = ((uint32 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   149
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   150
					for (x = 0; x < width; x++)
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   151
						dst[x] = palette[src[x]].blue | (palette[src[x]].green << 8) | (palette[src[x]].red << 16) | 0xff000000;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   152
				}
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   153
			}
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   154
			break;
e236261e5a58 (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.
egladil
parents: 7392
diff changeset
   155
	}
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   156
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   157
	png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   158
	fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   159
	return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   160
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   161
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   162
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   163
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 2953
diff changeset
   164
#else /* WITH_PNG */
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   165
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5584
diff changeset
   166
void DisplaySplashImage() {}
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   167
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 2953
diff changeset
   168
#endif /* WITH_PNG */