diff options
author | Michael Schuldt <michael.schuldt@bmw.de> | 2013-07-05 12:32:45 +0200 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2013-07-05 12:40:56 +0200 |
commit | 5a1a9cd1e6e0bbb3bee7a5662b0c56ad066c7dac (patch) | |
tree | b38b6d677ed5636b16126b847f0163e365665f37 | |
parent | 4fa82547c347cf28c84c1c17414de249bff5faaa (diff) | |
download | layer_management-5a1a9cd1e6e0bbb3bee7a5662b0c56ad066c7dac.tar.gz |
LayerManagerCommands: added RemoveSynchronizedsurface command
Signed-off-by: Michael Schuldt <michael.schuldt@bmw.de>
-rw-r--r-- | LayerManagerCommands/include/RemoveSynchronizedSurfacesCommand.h | 72 | ||||
-rw-r--r-- | LayerManagerCommands/src/RemoveSynchronizedSurfacesCommand.cpp | 58 |
2 files changed, 130 insertions, 0 deletions
diff --git a/LayerManagerCommands/include/RemoveSynchronizedSurfacesCommand.h b/LayerManagerCommands/include/RemoveSynchronizedSurfacesCommand.h new file mode 100644 index 0000000..ec488db --- /dev/null +++ b/LayerManagerCommands/include/RemoveSynchronizedSurfacesCommand.h @@ -0,0 +1,72 @@ +/*************************************************************************** + * + * Copyright 2012, Bayerische Motorenwerke Aktiengesellschaft + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************/ + +#ifndef _REMOVESYNCHRONIZEDSURFACESCOMMAND_H_ +#define _REMOVESYNCHRONIZEDSURFACESCOMMAND_H_ + +#include "ICommand.h" + +class RemoveSynchronizedSurfacesCommand: public ICommand +{ +public: + /*! + * \action This command unset the surfaces which forces a synchronized composition + * in the GENIVI LayerManagement + * \frequency Called to force synchronized composition on a list of surfaces . + * \param[in] sender process id of application that sent this command + * \param[in] array array of surface ids + * \param[in] length length of array provided in parameter array + * \ingroup Commands + */ + RemoveSynchronizedSurfacesCommand(pid_t sender, unsigned int* array, unsigned int length) + : ICommand(ExecuteAsynchronous, sender) + , m_array(array) + , m_length(length) + {} + + /** + * \brief default destructor + */ + virtual ~RemoveSynchronizedSurfacesCommand() + { + delete [] m_array; + } + + /** + * \brief Execute this command. + * \param[in] executor Pointer to instance executing the LayerManagement COmmands + * \return ExecutionSuccess: execution successful + * \return ExecutionSuccessRedraw: execution successful and screen needs to be redrawn + * \return ExecutionFailed: execution failed + * \return ExecutionFailedRedraw: execution unsuccessful and screen needs to be redrawn + */ + virtual ExecutionResult execute(ICommandExecutor* executor); + + /** + * \brief Get description string for this command. + * \return String object with description of this command object + */ + virtual const std::string getString(); + +private: + unsigned int* m_array; + const unsigned int m_length; +}; + +#endif /* _REMOVESYNCHRONIZEDSURFACESCOMMAND_H_ */ diff --git a/LayerManagerCommands/src/RemoveSynchronizedSurfacesCommand.cpp b/LayerManagerCommands/src/RemoveSynchronizedSurfacesCommand.cpp new file mode 100644 index 0000000..3085a22 --- /dev/null +++ b/LayerManagerCommands/src/RemoveSynchronizedSurfacesCommand.cpp @@ -0,0 +1,58 @@ +/*************************************************************************** + * + * Copyright 2010,2011 BMW Car IT GmbH + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************/ +#include "RemoveSynchronizedSurfacesCommand.h" +#include "ICommandExecutor.h" +#include "Scene.h" +#include "Log.h" + +ExecutionResult RemoveSynchronizedSurfacesCommand::execute(ICommandExecutor* executor) +{ + Scene& scene = *(executor->getScene()); + ExecutionResult result = ExecutionFailed; + + LOG_DEBUG("RemoveSynchronizedSurfacesCommand", "Length to set: " << m_length); + + // First of all get all surfaces which are in the current render order. + for (unsigned int i = 0; i < m_length; i++) + { + Surface* surface = scene.getSurface(m_array[i]); + if (surface) + { + surface->setSynchronized(false); + LOG_DEBUG("RemoveSynchronizedSurfacesCommand", "Unsetting synchronized Surface : " << m_array[i]); + result = ExecutionSuccess; + } + } + return result; +} + +const std::string RemoveSynchronizedSurfacesCommand::getString() +{ + std::stringstream description; + description << "RemoveSynchronizedSurfacesCommand(" + << "m_array=["; + + for (unsigned int i = 0; i < m_length; ++i) + { + description << m_array[i] << ","; + } + description << "], m_length=" << m_length + << ")"; + return description.str(); +} |