when resolving filenames also take system and hidden files into account.
[Rockbox.git] / uisimulator / sdl / lcd-sdl.c
blob981655a32c7904f165b53298d5c480f9303e5484
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Dan Everton
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "lcd-sdl.h"
21 #include "uisdl.h"
23 int display_zoom = 1;
25 void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width,
26 int height, int max_x, int max_y,
27 unsigned long (*getpixel)(int, int))
29 int x, y;
30 int xmax, ymax;
31 SDL_Rect dest;
33 ymax = y_start + height;
34 xmax = x_start + width;
36 if(xmax > max_x)
37 xmax = max_x;
38 if(ymax >= max_y)
39 ymax = max_y;
41 SDL_LockSurface(surface);
43 dest.w = display_zoom;
44 dest.h = display_zoom;
46 for (x = x_start; x < xmax; x++) {
47 dest.x = x * display_zoom;
49 for (y = y_start; y < ymax; y++) {
50 dest.y = y * display_zoom;
52 SDL_FillRect(surface, &dest, (Uint32)getpixel(x, y));
56 SDL_UnlockSurface(surface);
59 void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
60 int height, int max_x, int max_y, int ui_x, int ui_y)
62 int xmax, ymax;
64 ymax = y_start + height;
65 xmax = x_start + width;
67 if(xmax > max_x)
68 xmax = max_x;
69 if(ymax >= max_y)
70 ymax = max_y;
72 SDL_Rect src = {x_start * display_zoom, y_start * display_zoom,
73 xmax * display_zoom, ymax * display_zoom};
74 SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom,
75 xmax * display_zoom, ymax * display_zoom};
77 SDL_BlitSurface(surface, &src, gui_surface, &dest);
78 SDL_Flip(gui_surface);
81 /* set a range of bitmap indices to a gradient from startcolour to endcolour */
82 void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
83 int first, int steps)
85 int i;
86 SDL_Color palette[steps];
88 for (i = 0; i < steps; i++) {
89 palette[i].r = start->r + (end->r - start->r) * i / (steps - 1);
90 palette[i].g = start->g + (end->g - start->g) * i / (steps - 1);
91 palette[i].b = start->b + (end->b - start->b) * i / (steps - 1);
94 SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps);