|
|
|
@@ -3,7 +3,6 @@
|
|
|
|
|
|
|
|
|
|
(C) 2012-2014 by martii
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
License: GPL
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
@@ -184,9 +183,12 @@ uint32_t cGLCD::ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue)
|
|
|
|
|
unsigned int color_green_tmp = (static_cast<int>(green) * 2.55) + 1;
|
|
|
|
|
unsigned int color_blue_tmp = (static_cast<int>(blue) * 2.55) + 1;
|
|
|
|
|
|
|
|
|
|
uint32_t color = 0xff; color <<= 8;
|
|
|
|
|
color |= color_red_tmp; color <<= 8;
|
|
|
|
|
color |= color_green_tmp; color <<= 8;
|
|
|
|
|
uint32_t color = 0xff;
|
|
|
|
|
color <<= 8;
|
|
|
|
|
color |= color_red_tmp;
|
|
|
|
|
color <<= 8;
|
|
|
|
|
color |= color_green_tmp;
|
|
|
|
|
color <<= 8;
|
|
|
|
|
color |= color_blue_tmp;
|
|
|
|
|
|
|
|
|
|
return color;
|
|
|
|
@@ -325,19 +327,28 @@ void cGLCD::Exec()
|
|
|
|
|
g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height);
|
|
|
|
|
|
|
|
|
|
if (t.glcd_logo && percent_logo &&
|
|
|
|
|
showImage(channel_id, Channel, t.glcd_logo_x_position+(bitmap->Width()-(percent_logo_width * bitmap->Width()/100))/2, t.glcd_logo_y_position, percent_logo_width * bitmap->Width()/100, percent_logo * bitmap->Height()/100, true, false)) {
|
|
|
|
|
showImage(channel_id, Channel, t.glcd_logo_x_position + (bitmap->Width() - (percent_logo_width * bitmap->Width() / 100)) / 2, t.glcd_logo_y_position, percent_logo_width * bitmap->Width() / 100, percent_logo * bitmap->Height() / 100, true, false))
|
|
|
|
|
{
|
|
|
|
|
doScrollChannel = false;
|
|
|
|
|
scrollChannelSkip = 0;
|
|
|
|
|
} else if (percent_logo && icon_start_width && icon_start_height &&
|
|
|
|
|
doShowLcdIcon && showImage(Logo, icon_start_width, icon_start_height, t.glcd_logo_x_position, t.glcd_logo_y_position, bitmap->Width(), percent_logo * bitmap->Height()/100, true, false)) {
|
|
|
|
|
}
|
|
|
|
|
else if (percent_logo && icon_start_width && icon_start_height &&
|
|
|
|
|
doShowLcdIcon && showImage(Logo, icon_start_width, icon_start_height, t.glcd_logo_x_position, t.glcd_logo_y_position, bitmap->Width(), percent_logo * bitmap->Height() / 100, true, false))
|
|
|
|
|
{
|
|
|
|
|
doScrollChannel = false;
|
|
|
|
|
scrollChannelSkip = 0;
|
|
|
|
|
} else if (percent_channel) {
|
|
|
|
|
if (ChannelWidth) {
|
|
|
|
|
if (scrollChannelForward) {
|
|
|
|
|
}
|
|
|
|
|
else if (percent_channel)
|
|
|
|
|
{
|
|
|
|
|
if (ChannelWidth)
|
|
|
|
|
{
|
|
|
|
|
if (scrollChannelForward)
|
|
|
|
|
{
|
|
|
|
|
if (ChannelWidth - scrollChannelSkip < bitmap->Width())
|
|
|
|
|
scrollChannelForward = false;
|
|
|
|
|
} else if (scrollChannelSkip <= 0) {
|
|
|
|
|
}
|
|
|
|
|
else if (scrollChannelSkip <= 0)
|
|
|
|
|
{
|
|
|
|
|
scrollChannelSkip = 0;
|
|
|
|
|
doScrollChannel = false;
|
|
|
|
|
}
|
|
|
|
@@ -352,7 +363,8 @@ void cGLCD::Exec()
|
|
|
|
|
if (scrollChannelOffset < 0)
|
|
|
|
|
scrollChannelOffset = 0;
|
|
|
|
|
|
|
|
|
|
if (scrollChannelOffset == 0) {
|
|
|
|
|
if (scrollChannelOffset == 0)
|
|
|
|
|
{
|
|
|
|
|
if (scrollChannelForward)
|
|
|
|
|
scrollChannelSkip += g_settings.glcd_scroll_speed;
|
|
|
|
|
else
|
|
|
|
@@ -365,10 +377,13 @@ void cGLCD::Exec()
|
|
|
|
|
{
|
|
|
|
|
if (EpgWidth)
|
|
|
|
|
{
|
|
|
|
|
if (scrollEpgForward) {
|
|
|
|
|
if (scrollEpgForward)
|
|
|
|
|
{
|
|
|
|
|
if (EpgWidth - scrollEpgSkip < bitmap->Width())
|
|
|
|
|
scrollEpgForward = false;
|
|
|
|
|
} else if (scrollEpgSkip <= 0) {
|
|
|
|
|
}
|
|
|
|
|
else if (scrollEpgSkip <= 0)
|
|
|
|
|
{
|
|
|
|
|
scrollEpgSkip = 0;
|
|
|
|
|
doScrollEpg = false;
|
|
|
|
|
}
|
|
|
|
@@ -383,7 +398,8 @@ void cGLCD::Exec()
|
|
|
|
|
if (scrollEpgOffset < 0)
|
|
|
|
|
scrollEpgOffset = 0;
|
|
|
|
|
|
|
|
|
|
if (scrollEpgOffset == 0) {
|
|
|
|
|
if (scrollEpgOffset == 0)
|
|
|
|
|
{
|
|
|
|
|
if (scrollEpgForward)
|
|
|
|
|
scrollEpgSkip += g_settings.glcd_scroll_speed;
|
|
|
|
|
else
|
|
|
|
@@ -453,7 +469,8 @@ void cGLCD::Exec()
|
|
|
|
|
&font_end, ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent, true, 0, t.glcd_end_align);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (percent_smalltext && !doStandby) {
|
|
|
|
|
if (percent_smalltext && !doStandby)
|
|
|
|
|
{
|
|
|
|
|
Lock();
|
|
|
|
|
SmalltextWidth = font_smalltext.Width(Smalltext);
|
|
|
|
|
Unlock();
|
|
|
|
@@ -473,11 +490,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_rec_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "REC";
|
|
|
|
|
if (recLocked) {
|
|
|
|
|
if (recLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -487,11 +507,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_mute_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "MUTE";
|
|
|
|
|
if (muteLocked) {
|
|
|
|
|
if (muteLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -501,11 +524,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_ts_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "TS";
|
|
|
|
|
if (tsLocked) {
|
|
|
|
|
if (tsLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -515,11 +541,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_ecm_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "ECM";
|
|
|
|
|
if (ecmLocked) {
|
|
|
|
|
if (ecmLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_ecm_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_ecm_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -529,11 +558,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_timer_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "TIMER";
|
|
|
|
|
if (timerLocked) {
|
|
|
|
|
if (timerLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -543,11 +575,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_dd_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "DD";
|
|
|
|
|
if (ddLocked) {
|
|
|
|
|
if (ddLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -556,24 +591,33 @@ void cGLCD::Exec()
|
|
|
|
|
|
|
|
|
|
if (t.glcd_icon_txt_x_position)
|
|
|
|
|
{
|
|
|
|
|
if (ismediaplayer) {
|
|
|
|
|
if (ismediaplayer)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "SUB";
|
|
|
|
|
if (subLocked) {
|
|
|
|
|
if (subLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
smalltext = "TXT";
|
|
|
|
|
if (txtLocked) {
|
|
|
|
|
if (txtLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -584,11 +628,14 @@ void cGLCD::Exec()
|
|
|
|
|
if (t.glcd_icon_cam_x_position)
|
|
|
|
|
{
|
|
|
|
|
smalltext = "CAM";
|
|
|
|
|
if (camLocked) {
|
|
|
|
|
if (camLocked)
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position,
|
|
|
|
|
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
|
|
|
|
|
GLCD::cColor::Transparent, true, 0, 0);
|
|
|
|
@@ -624,55 +671,69 @@ void cGLCD::updateFonts()
|
|
|
|
|
int fontsize_end_new = percent_end * cglcd->lcd->Height() / 100;
|
|
|
|
|
int fontsize_smalltext_new = percent_smalltext * cglcd->lcd->Height() / 100;
|
|
|
|
|
|
|
|
|
|
if (!fonts_initialized || (fontsize_channel_new != fontsize_channel)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_channel_new != fontsize_channel))
|
|
|
|
|
{
|
|
|
|
|
fontsize_channel = fontsize_channel_new;
|
|
|
|
|
if (!font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel)) {
|
|
|
|
|
if (!font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!fonts_initialized || (fontsize_epg_new != fontsize_epg)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_epg_new != fontsize_epg))
|
|
|
|
|
{
|
|
|
|
|
fontsize_epg = fontsize_epg_new;
|
|
|
|
|
if (!font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg)) {
|
|
|
|
|
if (!font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!fonts_initialized || (fontsize_time_new != fontsize_time)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_time_new != fontsize_time))
|
|
|
|
|
{
|
|
|
|
|
fontsize_time = fontsize_time_new;
|
|
|
|
|
if (!font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time)) {
|
|
|
|
|
if (!font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fonts_initialized || (fontsize_duration_new != fontsize_duration)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_duration_new != fontsize_duration))
|
|
|
|
|
{
|
|
|
|
|
fontsize_duration = fontsize_duration_new;
|
|
|
|
|
if (!font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration)) {
|
|
|
|
|
if (!font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fonts_initialized || (fontsize_start_new != fontsize_start)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_start_new != fontsize_start))
|
|
|
|
|
{
|
|
|
|
|
fontsize_start = fontsize_start_new;
|
|
|
|
|
if (!font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start)) {
|
|
|
|
|
if (!font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fonts_initialized || (fontsize_end_new != fontsize_end)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_end_new != fontsize_end))
|
|
|
|
|
{
|
|
|
|
|
fontsize_end = fontsize_end_new;
|
|
|
|
|
if (!font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end)) {
|
|
|
|
|
if (!font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) {
|
|
|
|
|
if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext))
|
|
|
|
|
{
|
|
|
|
|
fontsize_smalltext = fontsize_smalltext_new;
|
|
|
|
|
if (!font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext)) {
|
|
|
|
|
if (!font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext))
|
|
|
|
|
{
|
|
|
|
|
t.glcd_font = g_settings.font_file;
|
|
|
|
|
font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext);
|
|
|
|
|
}
|
|
|
|
@@ -685,7 +746,8 @@ void cGLCD::updateFonts()
|
|
|
|
|
|
|
|
|
|
bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_w, int &bb_h)
|
|
|
|
|
{
|
|
|
|
|
if (!width || !height) {
|
|
|
|
|
if (!width || !height)
|
|
|
|
|
{
|
|
|
|
|
bb_x = bb_y = bb_w = bb_h = 0;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@@ -694,7 +756,8 @@ bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, i
|
|
|
|
|
uint32_t *b = buffer;
|
|
|
|
|
for (int y = 0; y < height; y++)
|
|
|
|
|
for (int x = 0; x < width; x++, b++)
|
|
|
|
|
if (*b) {
|
|
|
|
|
if (*b)
|
|
|
|
|
{
|
|
|
|
|
y_min = y;
|
|
|
|
|
goto out1;
|
|
|
|
|
}
|
|
|
|
@@ -703,26 +766,31 @@ out1:
|
|
|
|
|
b = buffer + height * width - 1;
|
|
|
|
|
for (int y = height - 1; y_min < y; y--)
|
|
|
|
|
for (int x = 0; x < width; x++, b--)
|
|
|
|
|
if (*b) {
|
|
|
|
|
if (*b)
|
|
|
|
|
{
|
|
|
|
|
y_max = y;
|
|
|
|
|
goto out2;
|
|
|
|
|
}
|
|
|
|
|
out2:
|
|
|
|
|
int x_min = width;
|
|
|
|
|
for (int x = 0; x < width; x++) {
|
|
|
|
|
for (int x = 0; x < width; x++)
|
|
|
|
|
{
|
|
|
|
|
b = buffer + x + y_min * width;
|
|
|
|
|
for (int y = y_min; y < y_max; y++, b += width)
|
|
|
|
|
if (*b) {
|
|
|
|
|
if (*b)
|
|
|
|
|
{
|
|
|
|
|
x_min = x;
|
|
|
|
|
goto out3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
out3:
|
|
|
|
|
int x_max = x_min;
|
|
|
|
|
for (int x = width - 1; x_min < x; x--) {
|
|
|
|
|
for (int x = width - 1; x_min < x; x--)
|
|
|
|
|
{
|
|
|
|
|
b = buffer + x + y_min * width;
|
|
|
|
|
for (int y = y_min; y < y_max; y++, b += width)
|
|
|
|
|
if (*b) {
|
|
|
|
|
if (*b)
|
|
|
|
|
{
|
|
|
|
|
x_max = x;
|
|
|
|
|
goto out4;
|
|
|
|
|
}
|
|
|
|
@@ -848,7 +916,8 @@ void cGLCD::Run(void)
|
|
|
|
|
break;
|
|
|
|
|
if (!g_settings.glcd_enable)
|
|
|
|
|
continue;
|
|
|
|
|
} else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
while ((doSuspend || doStandby || !g_settings.glcd_enable) && !doExit)
|
|
|
|
|
sem_wait(&sem);
|
|
|
|
|
|
|
|
|
@@ -861,7 +930,8 @@ void cGLCD::Run(void)
|
|
|
|
|
g_settings.glcd_selected_config = 0;
|
|
|
|
|
|
|
|
|
|
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]);
|
|
|
|
|
if (!lcd) {
|
|
|
|
|
if (!lcd)
|
|
|
|
|
{
|
|
|
|
|
#ifdef GLCD_DEBUG
|
|
|
|
|
fprintf(stderr, "CreateDriver failed.\n");
|
|
|
|
|
#endif
|
|
|
|
@@ -1002,7 +1072,8 @@ void cGLCD::Run(void)
|
|
|
|
|
doScrollEpg = EpgWidth > bitmap->Width();
|
|
|
|
|
scrollEpgSkip = 0;
|
|
|
|
|
scrollEpgForward = true;
|
|
|
|
|
if (doScrollEpg) {
|
|
|
|
|
if (doScrollEpg)
|
|
|
|
|
{
|
|
|
|
|
scrollEpgOffset = bitmap->Width() / 4;
|
|
|
|
|
EpgWidth += scrollEpgOffset;
|
|
|
|
|
}
|
|
|
|
@@ -1014,7 +1085,9 @@ void cGLCD::Run(void)
|
|
|
|
|
scrollChannelForward = true;
|
|
|
|
|
Scale = g_settings.current_volume;
|
|
|
|
|
//epg_id = -1;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Epg = "";
|
|
|
|
|
if (Channel.compare(g_Locale->getText(LOCALE_GLCD_VOLUME)))
|
|
|
|
|
{
|
|
|
|
@@ -1023,7 +1096,8 @@ void cGLCD::Run(void)
|
|
|
|
|
doScrollChannel = ChannelWidth > bitmap->Width();
|
|
|
|
|
scrollChannelForward = true;
|
|
|
|
|
scrollChannelSkip = 0;
|
|
|
|
|
if (doScrollChannel) {
|
|
|
|
|
if (doScrollChannel)
|
|
|
|
|
{
|
|
|
|
|
scrollChannelOffset = bitmap->Width() / 4;
|
|
|
|
|
ChannelWidth += scrollChannelOffset;
|
|
|
|
|
}
|
|
|
|
@@ -1094,7 +1168,8 @@ void cGLCD::Run(void)
|
|
|
|
|
doScrollChannel = ChannelWidth > bitmap->Width();
|
|
|
|
|
scrollChannelForward = true;
|
|
|
|
|
scrollChannelSkip = 0;
|
|
|
|
|
if (doScrollChannel) {
|
|
|
|
|
if (doScrollChannel)
|
|
|
|
|
{
|
|
|
|
|
scrollChannelOffset = bitmap->Width() / 4;
|
|
|
|
|
ChannelWidth += scrollChannelOffset;
|
|
|
|
|
}
|
|
|
|
@@ -1119,7 +1194,8 @@ void cGLCD::Run(void)
|
|
|
|
|
{
|
|
|
|
|
scrollEpgOffset = bitmap->Width() / 4;
|
|
|
|
|
EpgWidth += scrollEpgOffset;
|
|
|
|
|
} else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
scrollEpgOffset = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1180,7 +1256,8 @@ void cGLCD::Run(void)
|
|
|
|
|
{
|
|
|
|
|
scrollEpgOffset = bitmap->Width() / 4;
|
|
|
|
|
EpgWidth += scrollEpgOffset;
|
|
|
|
|
} else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
scrollEpgOffset = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1220,7 +1297,8 @@ void cGLCD::Run(void)
|
|
|
|
|
lcd->DeInit();
|
|
|
|
|
delete lcd;
|
|
|
|
|
lcd = NULL;
|
|
|
|
|
} while(!doExit);
|
|
|
|
|
}
|
|
|
|
|
while (!doExit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cGLCD::Update()
|
|
|
|
@@ -1512,10 +1590,12 @@ void cGLCD::unlockIcon(int type)
|
|
|
|
|
bool cGLCD::showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress)
|
|
|
|
|
{
|
|
|
|
|
cglcd->bitmap->DrawRectangle(x1, y1, x1 + (x2 - x1 - 1), y2, color_border, false);
|
|
|
|
|
if (scale) {
|
|
|
|
|
if (scale)
|
|
|
|
|
{
|
|
|
|
|
cglcd->bitmap->DrawRectangle(x1 + 1, y1 + 1, x1 + (scale * (x2 - x1 - 1) / 100), y2 - 1, color_progress, true);
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1532,7 +1612,9 @@ bool cGLCD::showImage(fb_pixel_t *s, uint32_t sw, uint32_t sh, uint32_t dx, uint
|
|
|
|
|
uint32_t dw_new = dh * bb_w / bb_h;
|
|
|
|
|
dx += (dw - dw_new) >> 1;
|
|
|
|
|
dw = dw_new;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
uint32_t dh_new = dw * bb_h / bb_w;
|
|
|
|
|
dy += (dh - dh_new) >> 1;
|
|
|
|
|
dh = dh_new;
|
|
|
|
@@ -1589,8 +1671,7 @@ bool cGLCD::imageShow(const std::string & filename, uint32_t dx, uint32_t dy, ui
|
|
|
|
|
cglcd->bitmap->Clear(GLCD::cColor::Black);
|
|
|
|
|
if (maximize)
|
|
|
|
|
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) cglcd->bitmap->Width(), (uint32_t) cglcd->bitmap->Height(), transp, false);
|
|
|
|
|
else
|
|
|
|
|
if (center_sw || center_sh)
|
|
|
|
|
else if (center_sw || center_sh)
|
|
|
|
|
{
|
|
|
|
|
int move_sw = 0;
|
|
|
|
|
int move_sh = 0;
|
|
|
|
@@ -1607,8 +1688,7 @@ bool cGLCD::imageShow(const std::string & filename, uint32_t dx, uint32_t dy, ui
|
|
|
|
|
else
|
|
|
|
|
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) sw, (uint32_t) sh, transp, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (dw > 0 && dh > 0)
|
|
|
|
|
else if (dw > 0 && dh > 0)
|
|
|
|
|
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) dw, (uint32_t) dh, transp, false);
|
|
|
|
|
else
|
|
|
|
|
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) sw, (uint32_t) sh, transp, false);
|
|
|
|
@@ -1659,20 +1739,31 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
|
|
|
|
|
if (cglcd)
|
|
|
|
|
cglcd->Lock();
|
|
|
|
|
|
|
|
|
|
if (format == BMP) {
|
|
|
|
|
if (format == BMP)
|
|
|
|
|
{
|
|
|
|
|
// write bmp
|
|
|
|
|
unsigned char hdr[14 + 40];
|
|
|
|
|
int i = 0;
|
|
|
|
|
#define PUT32(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); hdr[i++] = (((x)>>16)&0xFF); hdr[i++] = (((x)>>24)&0xFF);
|
|
|
|
|
#define PUT16(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF);
|
|
|
|
|
#define PUT8(x) hdr[i++] = ((x)&0xFF);
|
|
|
|
|
PUT8('B'); PUT8('M');
|
|
|
|
|
PUT8('B');
|
|
|
|
|
PUT8('M');
|
|
|
|
|
PUT32((((xres * yres) * 3 + 3) & ~ 3) + 14 + 40);
|
|
|
|
|
PUT16(0); PUT16(0); PUT32(14 + 40);
|
|
|
|
|
PUT32(40); PUT32(xres); PUT32(yres);
|
|
|
|
|
PUT16(0);
|
|
|
|
|
PUT16(0);
|
|
|
|
|
PUT32(14 + 40);
|
|
|
|
|
PUT32(40);
|
|
|
|
|
PUT32(xres);
|
|
|
|
|
PUT32(yres);
|
|
|
|
|
PUT16(1);
|
|
|
|
|
PUT16(output_bytes * 8); // bits
|
|
|
|
|
PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
PUT32(0);
|
|
|
|
|
#undef PUT32
|
|
|
|
|
#undef PUT16
|
|
|
|
|
#undef PUT8
|
|
|
|
@@ -1681,7 +1772,9 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
|
|
|
|
|
int y;
|
|
|
|
|
for (y = yres - 1; y >= 0 ; y -= 1)
|
|
|
|
|
fwrite(output + (y * xres * output_bytes), xres * output_bytes, 1, fd);
|
|
|
|
|
} else if (format == JPG) {
|
|
|
|
|
}
|
|
|
|
|
else if (format == JPG)
|
|
|
|
|
{
|
|
|
|
|
const int row_stride = xres * output_bytes;
|
|
|
|
|
// write jpg
|
|
|
|
|
if (output_bytes == 3) // swap bgr<->rgb
|
|
|
|
@@ -1741,7 +1834,9 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
|
|
|
|
|
}
|
|
|
|
|
jpeg_finish_compress(&cinfo);
|
|
|
|
|
jpeg_destroy_compress(&cinfo);
|
|
|
|
|
} else if (format == PNG) {
|
|
|
|
|
}
|
|
|
|
|
else if (format == PNG)
|
|
|
|
|
{
|
|
|
|
|
// write png
|
|
|
|
|
png_bytep *row_pointers;
|
|
|
|
|
png_structp png_ptr;
|
|
|
|
|