Fixed splash macro handling

This commit is contained in:
Martin Pulec
2014-05-12 11:31:08 +02:00
parent 57932e3825
commit 346e65368c
3 changed files with 7 additions and 5 deletions

View File

@@ -264,6 +264,7 @@ static void gl_load_splashscreen(struct state_gl *s)
gl_reconfigure_screen(s);
for (int i = 0; i < 2; ++i) {
const char *data = splash_data;
memset(s->buffers[i], 0, s->tile->data_len);
for (unsigned int y = 0; y < splash_height; ++y) {
char *line = s->buffers[i];
@@ -274,7 +275,7 @@ static void gl_load_splashscreen(struct state_gl *s)
(s->tile->width - splash_width)/2,
s->frame->color_spec);
for (unsigned int x = 0; x < splash_width; ++x) {
HEADER_PIXEL(splash_data,line);
HEADER_PIXEL(data,line);
line += 4;
}
}

View File

@@ -168,10 +168,11 @@ static void loadSplashscreen(struct state_sdl *s) {
#endif
// load splash data
const char *data = splash_data;
for (y_coord = 0; y_coord < splash_height; y_coord++) {
for (x_coord = 0; x_coord < splash_width; x_coord++) {
HEADER_PIXEL(splash_data,pixel);
HEADER_PIXEL(data,pixel);
Uint32 color = SDL_MapRGB(image->format, pixel[0], pixel[1], pixel[2]);
switch(image->format->BytesPerPixel) {

View File

@@ -1,7 +1,7 @@
/* GIMP header image file format (RGB) */
static unsigned int splash_width = 339;
static unsigned int splash_height = 195;
static const unsigned int splash_width = 339;
static const unsigned int splash_height = 195;
/* Call this macro repeatedly. After each use, the pixel data can be extracted */
@@ -11,7 +11,7 @@ pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \
pixel[2] = ((((data[2] - 33) & 0x3) << 6) | ((data[3] - 33))); \
data += 4; \
}
static char *splash_data =
static const char * const splash_data =
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"