draw on PC only when needed

This commit is contained in:
Edouard DUPIN 2012-08-14 08:56:17 +02:00
parent 24cb070116
commit c91eb1bece
5 changed files with 32 additions and 9 deletions

View File

@ -291,3 +291,14 @@ void ewol::Widget::PeriodicCallSet(bool statusToSet)
ewol::widgetManager::PeriodicCallRm(this);
}
}
/**
* @brief The widget mark itself that it need to regenerate the nest time.
* @param ---
* @return ---
*/
void ewol::Widget::MarkToReedraw(void)
{
m_needRegenerateDisplay = true;
ewol::widgetManager::MarkDrawingIsNeeded();
};

View File

@ -415,7 +415,7 @@ namespace ewol {
* @param ---
* @return ---
*/
void MarkToReedraw(void) { m_needRegenerateDisplay = true; };
void MarkToReedraw(void);
/**
* @brief Get the need of the redrawing of the widget and reset it to false
* @param ---

View File

@ -32,7 +32,6 @@
#undef __class__
#define __class__ "WidgetManager"
static pthread_mutex_t localMutex;
static bool IsInit = false;
// For the focus Management
@ -41,17 +40,17 @@ static ewol::Widget * m_focusWidgetCurrent = NULL;
static etk::VectorType<ewol::Widget*> l_listOfPeriodicWidget;
static bool l_havePeriodic = false;
static bool l_haveRedraw = true;
void ewol::widgetManager::Init(void)
{
EWOL_DEBUG("==> Init Widget-Manager");
// create interface mutex :
int ret = pthread_mutex_init(&localMutex, NULL);
EWOL_ASSERT(ret == 0, "Error creating Mutex ...");
// prevent android error ==> can create memory leak but I prefer
m_focusWidgetDefault = NULL;
m_focusWidgetCurrent = NULL;
l_listOfPeriodicWidget.Clear();
l_havePeriodic = false;
l_haveRedraw = true;
// init all the widget global parameters :
ewol::WIDGET_JoystickInit();
ewol::WIDGET_ButtonInit();
@ -70,8 +69,6 @@ void ewol::widgetManager::UnInit(void)
IsInit = false;
l_listOfPeriodicWidget.Clear();
int ret = pthread_mutex_destroy(&localMutex);
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
}
void ewol::widgetManager::Rm(ewol::Widget * newWidget)
@ -214,3 +211,15 @@ bool ewol::widgetManager::PeriodicCallHave(void)
return l_havePeriodic;
}
void ewol::widgetManager::MarkDrawingIsNeeded(void)
{
l_haveRedraw = true;
}
bool ewol::widgetManager::IsDrawingNeeded(void)
{
bool tmp = l_haveRedraw;
l_haveRedraw = false;
return tmp;
}

View File

@ -49,6 +49,8 @@ namespace ewol {
void PeriodicCall(int64_t localTime);
bool PeriodicCallHave(void);
void MarkDrawingIsNeeded(void);
bool IsDrawingNeeded(void);
};
};

View File

@ -254,8 +254,9 @@ void EWOL_GenericDraw(bool everyTime)
display = true;
}
int64_t currentTime3 = GetCurrentTime();
// TODO : Check if somthink has regenerate his display befor redraw ...
{
// check if the regenerate is needed ...
if( true == ewol::widgetManager::IsDrawingNeeded()
|| true == everyTime) {
ewol::texture::UpdateContext();
nbDisplayTime++;
gui_uniqueWindows->SysDraw();