cast ssize_t to long
[kugel-rb.git] / apps / gui / backdrop.c
blobfb35fe1e51eab3994780d5b4232488c948364b60
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <stdio.h>
23 #include "config.h"
24 #include "lcd.h"
25 #ifdef HAVE_REMOTE_LCD
26 #include "lcd-remote.h"
27 #endif
28 #include "backdrop.h"
30 bool backdrop_load(const char* filename, char *backdrop_buffer)
32 struct bitmap bm;
33 int ret;
35 /* load the image */
36 bm.data = backdrop_buffer;
37 ret = read_bmp_file(filename, &bm, LCD_BACKDROP_BYTES,
38 FORMAT_NATIVE | FORMAT_DITHER, NULL);
40 return ((ret > 0)
41 && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT));
45 void backdrop_show(char *backdrop_buffer)
47 lcd_set_backdrop((fb_data*)backdrop_buffer);
51 #if defined(HAVE_REMOTE_LCD)
53 #if LCD_REMOTE_DEPTH > 1
54 /* api functions */
55 bool remote_backdrop_load(const char *filename, char* backdrop_buffer)
57 struct bitmap bm;
58 int ret;
60 /* load the image */
61 bm.data = backdrop_buffer;
62 ret = read_bmp_file(filename, &bm, REMOTE_LCD_BACKDROP_BYTES,
63 FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE, NULL);
64 return ((ret > 0)
65 && (bm.width == LCD_REMOTE_WIDTH) && (bm.height == LCD_REMOTE_HEIGHT));
68 void remote_backdrop_show(char *backdrop_buffer)
70 lcd_remote_set_backdrop((fb_remote_data*)backdrop_buffer);
73 #else /* needs stubs */
75 bool remote_backdrop_load(const char *filename, char* backdrop_buffer)
77 (void)filename; (void) backdrop_buffer;
78 return false;
80 void remote_backdrop_show(char* backdrop_buffer)
82 (void)backdrop_buffer;
84 #endif
85 #endif