diff options
author | Rahul Singhal <rasinghal@nvidia.com> | 2012-06-25 13:10:54 +0530 |
---|---|---|
committer | Michael Schuldt <michael.schuldt@bmw.de> | 2012-06-28 12:57:55 +0200 |
commit | e30240d4e8ebcf50df4a42504306046ee969c52f (patch) | |
tree | a83ba58e42f90f5a6b0651f2f481143898447913 /LayerManagerCommands | |
parent | 11af0c5ae8c6a84b2d70d42e251ee1e3ced3b00e (diff) | |
download | layer_management-e30240d4e8ebcf50df4a42504306046ee969c52f.tar.gz |
LayerManagerCommands: Add SurfaceRemoveNativeContentCommand
Using this command a client can remove the native content associated
with a surface. This can be used if multiple windows need to be used
with the same surface.
TODO: The backend for wayland needs to be filled in.
Diffstat (limited to 'LayerManagerCommands')
-rw-r--r-- | LayerManagerCommands/include/SurfaceRemoveNativeContentCommand.h | 69 | ||||
-rw-r--r-- | LayerManagerCommands/src/SurfaceRemoveNativeContentCommand.cpp | 60 |
2 files changed, 129 insertions, 0 deletions
diff --git a/LayerManagerCommands/include/SurfaceRemoveNativeContentCommand.h b/LayerManagerCommands/include/SurfaceRemoveNativeContentCommand.h new file mode 100644 index 0000000..40bd212 --- /dev/null +++ b/LayerManagerCommands/include/SurfaceRemoveNativeContentCommand.h @@ -0,0 +1,69 @@ +/*************************************************************************** +* +* 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. +* +****************************************************************************/ + +#ifndef _SURFACEREMOVENATIVECONTENTCOMMAND_H_ +#define _SURFACEREMOVENATIVECONTENTCOMMAND_H_ + +#include "BaseCommandAsynchronous.h" +#include "PixelFormat.h" +#include "IScene.h" + +class SurfaceRemoveNativeContentCommand : public BaseCommandAsynchronous +{ +public: + /*! + * \action This command removes the native content (application content) + * of a surface within the GENIVI LayerManagement + * \frequency Typically should not be needed unless a client wants to + * re-use the surface with multiple contents. + * \param[in] surfaceId id of surface + * \ingroup Commands + */ + SurfaceRemoveNativeContentCommand(unsigned int surfaceId); + + /** + * \brief default destructor + */ + virtual ~SurfaceRemoveNativeContentCommand() {} + + /** + * \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: + uint m_surfaceId; + + // for unit testing + //template <typename nativeHandle_type, typename pixelformat_type, typename OriginalWidth_type, typename OriginalHeight_type> friend class SurfaceSetRenderBufferCommandEqMatcherP4; +}; + + +#endif /* _SURFACEREMOVENATIVECONTENTCOMMAND_H_ */ diff --git a/LayerManagerCommands/src/SurfaceRemoveNativeContentCommand.cpp b/LayerManagerCommands/src/SurfaceRemoveNativeContentCommand.cpp new file mode 100644 index 0000000..44a449e --- /dev/null +++ b/LayerManagerCommands/src/SurfaceRemoveNativeContentCommand.cpp @@ -0,0 +1,60 @@ +/*************************************************************************** +* +* 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 "SurfaceRemoveNativeContentCommand.h" +#include "ICommandExecutor.h" +#include "Scene.h" +#include <sstream> +#include "stdio.h" + +SurfaceRemoveNativeContentCommand::SurfaceRemoveNativeContentCommand(unsigned int surfaceId) +: m_surfaceId(surfaceId) +{ +} + +ExecutionResult SurfaceRemoveNativeContentCommand::execute(ICommandExecutor* executor) +{ + Scene& scene = *(executor->getScene()); + ExecutionResult result = ExecutionFailed; + + Surface* surface = scene.getSurface(m_surfaceId); + + if (surface) + { + if(surface->hasNativeContent()) + { + surface->removeNativeContent(); + result = ExecutionSuccessRedraw; + } + else + { + result = ExecutionSuccess; + } + } + + return result; +} + +const std::string SurfaceRemoveNativeContentCommand::getString() +{ + std::stringstream description; + description << "SurfaceRemoveNativeContentCommand(" + << "surfaceId=" << m_surfaceId + << ")"; + return description.str(); +} |