diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-03-24 12:33:16 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-03-24 12:33:59 +0100 |
commit | 0b4207a6183b1e5eccd697973116f1a60fc5c6c9 (patch) | |
tree | 2b7fff6b608873df62131827780b0c696f4aee50 | |
parent | e489bd0e50e1cd9582afc174b2efad605840ed8c (diff) |
Factorize common code in 'renderLayers'
The code factorized was present 4 times in the code.
Factorizing it improves the overall.
Change-Id: I94833679fcd366796b332259ebac5ecac5fc047c
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | windowmanager/src/windowmanager.cpp | 33 | ||||
-rw-r--r-- | windowmanager/src/windowmanager.hpp | 1 |
2 files changed, 14 insertions, 20 deletions
diff --git a/windowmanager/src/windowmanager.cpp b/windowmanager/src/windowmanager.cpp index e7802ca..1f5e4c9 100644 --- a/windowmanager/src/windowmanager.cpp +++ b/windowmanager/src/windowmanager.cpp @@ -132,6 +132,15 @@ int WindowManager::getLayerRenderOrder(t_ilm_layer id_array[]) return j; } + +void WindowManager::renderLayers() +{ + t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; + int num_layers = getLayerRenderOrder(renderOrder); + qDebug("Screen render order %d, %d layers", m_screenId, num_layers); + ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); + ilm_commitChanges(); +} #endif void WindowManager::dumpScene() @@ -405,12 +414,7 @@ void WindowManager::updateScreen() showAppLayer(m_pending_to_show); } else { // display layer render order - t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; - int num_layers = getLayerRenderOrder(renderOrder); - - qDebug("Screen render order %d, %d layers", m_screenId, num_layers); - ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); - ilm_commitChanges(); + renderLayers(); } #endif } @@ -700,11 +704,7 @@ void WindowManager::hideLayer(int layer) /* clear pending flag */ m_pending_to_show = -1; } - - t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; - int num_layers = getLayerRenderOrder(renderOrder); - ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); - ilm_commitChanges(); + renderLayers(); } #endif } @@ -779,10 +779,7 @@ void WindowManager::showLayer(int layer) m_showLayers[layer] = layer_id_array[layer]; - t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; - int num_layers = getLayerRenderOrder(renderOrder); - ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); - ilm_commitChanges(); + renderLayers(); } #endif } @@ -820,10 +817,6 @@ void WindowManager::showAppLayer(int pid) m_showLayers[2] = 0; qDebug("No layer to show for app(pid=%d)", pid); } - t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; - - int num_layers = getLayerRenderOrder(renderOrder); - ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); - ilm_commitChanges(); + renderLayers(); #endif } diff --git a/windowmanager/src/windowmanager.hpp b/windowmanager/src/windowmanager.hpp index 89f255e..8b70349 100644 --- a/windowmanager/src/windowmanager.hpp +++ b/windowmanager/src/windowmanager.hpp @@ -66,6 +66,7 @@ private: void configureHomeScreenMainSurface(const t_ilm_surface surface, const t_ilm_int width, const t_ilm_int height); void configureAppSurface(const pid_t pid, const t_ilm_surface surface, const t_ilm_int width, const t_ilm_int height); + void renderLayers(); #endif void updateScreen(); |