src/os/macosx/splash.cpp
author rubidium
Tue, 25 Dec 2007 11:26:07 +0000
changeset 8131 160939e24ed3
parent 8123 ce31d2843a95
child 9111 48ce04029fe4
permissions -rw-r--r--
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
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
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     3
#include "../../stdafx.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     4
#include "../../openttd.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     5
#include "../../variables.h"
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     6
#include "../../debug.h"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8115
diff changeset
     7
#include "../../gfx_func.h"
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
     8
#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
     9
#include "../../blitter/factory.hpp"
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    10
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    11
#include "splash.h"
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
#ifdef WITH_PNG
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
#include <png.h>
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
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
    18
{
5388
db011d108caa (svn r7577) -Fix (r7565): Missed out some OSX files (Bjarni)
Darkvater
parents: 4300
diff changeset
    19
	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
    20
	longjmp(png_ptr->jmpbuf, 1);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    21
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    22
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    23
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
    24
{
5388
db011d108caa (svn r7577) -Fix (r7565): Missed out some OSX files (Bjarni)
Darkvater
parents: 4300
diff changeset
    25
	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
    26
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    27
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5584
diff changeset
    28
void DisplaySplashImage()
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    29
{
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    30
	png_byte header[8];
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    31
	FILE *f;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    32
	png_structp png_ptr;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    33
	png_infop info_ptr, end_info;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    34
	uint width, height, bit_depth, color_type;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    35
	png_colorp palette;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    36
	int num_palette;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    37
	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
    38
	uint8 *src;
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    39
	uint y;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    40
	uint xoff, yoff;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    41
	int i;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    42
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    43
	f = FioFOpenFile(SPLASH_IMAGE_FILE);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    44
	if (f == NULL) return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    45
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    46
	fread(header, 1, 8, f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    47
	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
    48
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    49
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    50
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    51
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    52
	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
    53
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    54
	if (png_ptr == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    55
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    56
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    57
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    58
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    59
	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
    60
	if (info_ptr == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    61
		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
    62
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    63
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    64
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    65
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    66
	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
    67
	if (end_info == NULL) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    68
		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
    69
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    70
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    71
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    72
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    73
	if (setjmp(png_jmpbuf(png_ptr))) {
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    74
		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
    75
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    76
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    77
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    78
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    79
	png_init_io(png_ptr, f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    80
	png_set_sig_bytes(png_ptr, 8);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    81
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    82
	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
    83
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    84
	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
    85
	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
    86
	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
    87
	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
    88
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
    89
	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
    90
		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
    91
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    92
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    93
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    94
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
    95
	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
    96
		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
    97
		fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    98
		return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
    99
	}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   100
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   101
	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
   102
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   103
	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
   104
2953
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
   105
	if (width > (uint) _screen.width) width = _screen.width;
4d933ef9a41f (svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents: 2847
diff changeset
   106
	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
   107
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   108
	xoff = (_screen.width - width) / 2;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   109
	yoff = (_screen.height - height) / 2;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   110
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
   111
	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
   112
		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
   113
				uint8 *dst;
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   114
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
   115
				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
   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
				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
   118
					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
   119
					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
   120
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
					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
   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
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
				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
   125
					_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
   126
					_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
   127
					_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
   128
				}
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
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
				_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
   131
				_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
   132
				_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
   133
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
				_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
   135
				_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
   136
			}
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
			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
   138
		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
   139
				uint32 *dst;
7801
4ff6114abbd6 (svn r11351) -Fix (r11342): [OSX] killed a warning
bjarni
parents: 7792
diff changeset
   140
				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
   141
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
   142
				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
   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
				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
   145
					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
   146
					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
   147
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
					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
   149
						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
   150
				}
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
			}
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
			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
   153
	}
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   154
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   155
	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
   156
	fclose(f);
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   157
	return;
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   158
}
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   159
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
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 2953
diff changeset
   162
#else /* WITH_PNG */
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   163
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5584
diff changeset
   164
void DisplaySplashImage() {}
2736
3d6487cbbb69 (svn r3281) -Feature: [OSX] added native cocoa sound and video drivers (egladil)
bjarni
parents:
diff changeset
   165
4300
c7e43c47a2b9 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 2953
diff changeset
   166
#endif /* WITH_PNG */