2006-02-09 21:49:28 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Dan Everton
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-02-09 21:49:28 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-05-15 21:02:47 +00:00
|
|
|
#include "sim-ui-defines.h"
|
2006-02-09 21:49:28 +00:00
|
|
|
#include "lcd-sdl.h"
|
2006-07-28 07:35:45 +00:00
|
|
|
#include "lcd-remote-bitmap.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
#include "screendump.h"
|
2010-05-15 21:02:47 +00:00
|
|
|
#include "system.h" /* background */
|
2006-02-09 21:49:28 +00:00
|
|
|
|
2009-10-26 09:58:39 +00:00
|
|
|
SDL_Surface *remote_surface = 0;
|
2006-02-09 21:49:28 +00:00
|
|
|
|
2009-02-09 00:32:59 +00:00
|
|
|
SDL_Color remote_bl_color_dark = {RED_CMP(LCD_REMOTE_BL_DARKCOLOR),
|
|
|
|
GREEN_CMP(LCD_REMOTE_BL_DARKCOLOR),
|
|
|
|
BLUE_CMP(LCD_REMOTE_BL_DARKCOLOR), 0};
|
|
|
|
SDL_Color remote_bl_color_bright = {RED_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
|
|
|
|
GREEN_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
|
|
|
|
BLUE_CMP(LCD_REMOTE_BL_BRIGHTCOLOR), 0};
|
|
|
|
SDL_Color remote_color_dark = {RED_CMP(LCD_REMOTE_DARKCOLOR),
|
|
|
|
GREEN_CMP(LCD_REMOTE_DARKCOLOR),
|
|
|
|
BLUE_CMP(LCD_REMOTE_DARKCOLOR), 0};
|
|
|
|
SDL_Color remote_color_bright = {RED_CMP(LCD_REMOTE_BRIGHTCOLOR),
|
|
|
|
GREEN_CMP(LCD_REMOTE_BRIGHTCOLOR),
|
|
|
|
BLUE_CMP(LCD_REMOTE_BRIGHTCOLOR), 0};
|
2006-02-09 21:49:28 +00:00
|
|
|
|
2009-02-10 23:43:37 +00:00
|
|
|
#define NUM_SHADES 129
|
2009-02-09 00:32:59 +00:00
|
|
|
|
|
|
|
#if LCD_REMOTE_DEPTH == 2
|
|
|
|
/* Only defined for positive, non-split LCD for now */
|
|
|
|
static const unsigned char colorindex[4] = {128, 85, 43, 0};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static unsigned long get_lcd_remote_pixel(int x, int y)
|
|
|
|
{
|
2006-07-28 07:35:45 +00:00
|
|
|
#if LCD_REMOTE_DEPTH == 1
|
2012-02-22 10:18:05 +00:00
|
|
|
return *FBREMOTEADDR(x, y/8) & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
|
2006-07-28 07:35:45 +00:00
|
|
|
#elif LCD_REMOTE_DEPTH == 2
|
|
|
|
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
|
2012-02-22 10:18:05 +00:00
|
|
|
unsigned bits = (*FBREMOTEADDR(x, y/8) >> (y & 7)) & 0x0101;
|
2009-02-09 00:32:59 +00:00
|
|
|
return colorindex[(bits | (bits >> 7)) & 3];
|
2006-07-28 07:35:45 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2006-02-09 21:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcd_remote_update (void)
|
|
|
|
{
|
|
|
|
lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
|
|
|
|
{
|
2009-10-26 09:58:39 +00:00
|
|
|
if (remote_surface)
|
|
|
|
{
|
|
|
|
sdl_update_rect(remote_surface, x_start, y_start, width, height,
|
|
|
|
LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, get_lcd_remote_pixel);
|
|
|
|
sdl_gui_update(remote_surface, x_start, y_start, width, height,
|
|
|
|
LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0,
|
|
|
|
background ? UI_REMOTE_POSY : LCD_HEIGHT);
|
|
|
|
}
|
2006-02-09 21:49:28 +00:00
|
|
|
}
|
|
|
|
|
2006-02-13 21:46:28 +00:00
|
|
|
void sim_remote_backlight(int value)
|
|
|
|
{
|
2009-10-26 09:58:39 +00:00
|
|
|
if (remote_surface)
|
|
|
|
{
|
|
|
|
if (value > 0)
|
|
|
|
{
|
|
|
|
sdl_set_gradient(remote_surface, &remote_bl_color_dark,
|
|
|
|
&remote_bl_color_bright, 0, NUM_SHADES);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sdl_set_gradient(remote_surface, &remote_color_dark,
|
|
|
|
&remote_color_bright, 0, NUM_SHADES);
|
|
|
|
}
|
|
|
|
sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
|
|
|
|
LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
|
|
|
|
background ? UI_REMOTE_POSX : 0,
|
|
|
|
background? UI_REMOTE_POSY : LCD_HEIGHT);
|
2006-02-13 21:46:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-09 21:49:28 +00:00
|
|
|
/* initialise simulator lcd remote driver */
|
2010-05-18 12:27:20 +00:00
|
|
|
void lcd_remote_init_device(void)
|
2006-02-09 21:49:28 +00:00
|
|
|
{
|
2010-05-18 12:27:20 +00:00
|
|
|
if (!showremote)
|
|
|
|
return;
|
2006-02-09 21:49:28 +00:00
|
|
|
remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
2009-02-09 00:32:59 +00:00
|
|
|
LCD_REMOTE_WIDTH * display_zoom,
|
|
|
|
LCD_REMOTE_HEIGHT * display_zoom,
|
|
|
|
8, 0, 0, 0, 0);
|
2006-02-09 21:49:28 +00:00
|
|
|
|
2009-02-09 00:32:59 +00:00
|
|
|
sdl_set_gradient(remote_surface, &remote_bl_color_dark,
|
2009-02-10 23:43:37 +00:00
|
|
|
&remote_bl_color_bright, 0, NUM_SHADES);
|
2006-02-09 21:49:28 +00:00
|
|
|
}
|
|
|
|
|