ScreenDump: check for valid screenId and set screenId for layer
authorEugen Friedrich <efriedrich@de.adit-jv.com>
Wed, 3 Jul 2013 11:53:53 +0000 (13:53 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 5 Jul 2013 10:56:48 +0000 (12:56 +0200)
If rendering plug-in supports several screens we cannot assume
only screen 0 as valid screenId.
Also if the layer is assigned to some screen, containing screenId
should be set.
One layer could also be assigned to more than one
screen at the same time, in this case only the last screenId is set

Signed-off-by: Eugen Friedrich <efriedrich@de.adit-jv.com>
LayerManagerCommands/src/ScreenDumpCommand.cpp
LayerManagerCommands/src/ScreenSetRenderOrderCommand.cpp

index 659ab57..7c7732b 100644 (file)
@@ -23,6 +23,9 @@
 
 ExecutionResult ScreenDumpCommand::execute(ICommandExecutor* executor)
 {
+    uint length = 0;
+    uint i = 0;
+    uint* IDs = executor->getScreenIDs(&length);
     ExecutionResult result = ExecutionFailed;
     RendererList& m_rendererList = *(executor->getRendererList());
 
@@ -30,7 +33,13 @@ ExecutionResult ScreenDumpCommand::execute(ICommandExecutor* executor)
 
     LOG_INFO("ScreenDumpCommand", "making screenshot, output file: " << m_filename);
 
-    status = (m_id == 0);
+    for (i = 0; i < length; i++)
+    {
+        if (m_id == IDs[i])
+        {
+            status = true;
+        }
+    }
 
     if (status)
     {
@@ -44,7 +53,7 @@ ExecutionResult ScreenDumpCommand::execute(ICommandExecutor* executor)
 
             if (renderer)
             {
-                renderer->doScreenShot(m_filename);
+                renderer->doScreenShot(m_filename, m_id);
             }
         }
         result = ExecutionSuccessRedraw;
index 0a8484e..c1f4022 100644 (file)
@@ -78,6 +78,7 @@ ExecutionResult ScreenSetRenderOrderCommand::execute(ICommandExecutor* executor)
         if (layer)
         {
             LOG_DEBUG("ScreenSetRenderOrderCommand", "Adding Layer: " << m_array[i] << " to current render order");
+            layer->setContainingScreenId(m_screenID);
             scene.getCurrentRenderOrder(m_screenID).push_back(layer);
             result = ExecutionSuccessRedraw;
         }