OSD rotation option.
This commit is contained in:
1
cfg.cpp
1
cfg.cpp
@@ -56,6 +56,7 @@ const ini_var_t ini_vars[] = {
|
||||
{ "FB_TERMINAL", (void*)(&(cfg.fb_terminal)), UINT8, 0, 1 },
|
||||
{ "OSD_TIMEOUT", (void*)(&(cfg.osd_timeout)), INT16, 5, 3600 },
|
||||
{ "DIRECT_VIDEO", (void*)(&(cfg.direct_video)), UINT8, 0, 1 },
|
||||
{ "OSD_ROTATE", (void*)(&(cfg.osd_rotate)), UINT8, 0, 2 },
|
||||
};
|
||||
|
||||
// mist ini config
|
||||
|
||||
1
cfg.h
1
cfg.h
@@ -38,6 +38,7 @@ typedef struct {
|
||||
int16_t bootcore_timeout;
|
||||
uint8_t fb_size;
|
||||
uint8_t fb_terminal;
|
||||
uint8_t osd_rotate;
|
||||
uint16_t osd_timeout;
|
||||
char bootcore[256];
|
||||
char video_conf[1024];
|
||||
|
||||
12
osd.cpp
12
osd.cpp
@@ -593,6 +593,18 @@ void InfoEnable(int x, int y, int width, int height)
|
||||
DisableOsd();
|
||||
}
|
||||
|
||||
void OsdRotation(uint8_t rotate)
|
||||
{
|
||||
if (is_minimig()) return;
|
||||
spi_osd_cmd_cont(MM1_OSDCMDDISABLE);
|
||||
spi_w(0);
|
||||
spi_w(0);
|
||||
spi_w(0);
|
||||
spi_w(0);
|
||||
spi_w(rotate);
|
||||
DisableOsd();
|
||||
}
|
||||
|
||||
// disable displaying of OSD
|
||||
void OsdDisable(void)
|
||||
{
|
||||
|
||||
1
osd.h
1
osd.h
@@ -73,6 +73,7 @@ void OsdWriteOffset(unsigned char n, const char *s, unsigned char inver, unsigne
|
||||
void OsdClear(void);
|
||||
void OsdEnable(unsigned char mode);
|
||||
void InfoEnable(int x, int y, int width, int height);
|
||||
void OsdRotation(uint8_t rotate);
|
||||
void OsdDisable(void);
|
||||
void ConfigVideo(unsigned char hires, unsigned char lores, unsigned char scanlines);
|
||||
void ConfigAudio(unsigned char audio);
|
||||
|
||||
@@ -862,6 +862,8 @@ void user_io_init(const char *path)
|
||||
break;
|
||||
}
|
||||
|
||||
OsdRotation((cfg.osd_rotate == 1) ? 3 : (cfg.osd_rotate == 2) ? 1 : 0);
|
||||
|
||||
spi_uio_cmd_cont(UIO_GETUARTFLG);
|
||||
uart_mode = spi_w(0);
|
||||
DisableIO();
|
||||
|
||||
36
video.cpp
36
video.cpp
@@ -892,6 +892,12 @@ void video_menu_bg(int n, int idle)
|
||||
}
|
||||
vs_wait();
|
||||
};
|
||||
|
||||
if (cfg.osd_rotate)
|
||||
{
|
||||
imlib_context_set_image(logo);
|
||||
imlib_image_orientate(cfg.osd_rotate == 1 ? 3 : 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1016,16 +1022,42 @@ void video_menu_bg(int n, int idle)
|
||||
|
||||
int src_w = imlib_image_get_width();
|
||||
int src_h = imlib_image_get_height();
|
||||
|
||||
printf("logo: src_w=%d, src_h=%d\n", src_w, src_h);
|
||||
|
||||
int dst_w, dst_h;
|
||||
int dst_x, dst_y;
|
||||
if (cfg.osd_rotate)
|
||||
{
|
||||
dst_h = fb_height / 2;
|
||||
dst_w = src_w * dst_h / src_h;
|
||||
if (cfg.osd_rotate == 1)
|
||||
{
|
||||
dst_x = 0;
|
||||
dst_y = fb_height - dst_h;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x = fb_width - dst_w;
|
||||
dst_y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x = 0;
|
||||
dst_y = 0;
|
||||
dst_w = fb_width * 2 / 7;
|
||||
dst_h = src_h * dst_w / src_w;
|
||||
}
|
||||
|
||||
if (*bg)
|
||||
{
|
||||
imlib_context_set_image(*bg);
|
||||
imlib_blend_image_onto_image(logo, 1,
|
||||
0, 0, //int source_x, int source_y,
|
||||
src_w, src_h, //int source_width, int source_height,
|
||||
0, 0, //int destination_x, int destination_y,
|
||||
fb_width*2 / 7, src_h*fb_width*2 / (src_w * 7) //int destination_width, int destination_height
|
||||
dst_x, dst_y, //int destination_x, int destination_y,
|
||||
dst_w, dst_h //int destination_width, int destination_height
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user