1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
24 #include "Layermanager.h"
25 #include "CommandList.h"
26 #include "ShaderMap.h"
27 #include "LayerGroup.h"
28 #include "LayerGroupMap.h"
29 #include "SurfaceGroup.h"
30 #include "SurfaceGroupMap.h"
31 #include "SurfaceMap.h"
33 #include "ShaderMap.h"
34 #include "LayerList.h"
35 #include "LmScreenList.h"
42 * Represents a list of Layers which contain the Surfaces.
44 class Scene: public IScene
46 // TODO: these should use public interface instead
47 friend class Layermanager;
48 friend class CommitCommand;
49 friend class ShaderCreateCommand;
50 friend class ShaderDestroyCommand;
51 friend class SurfaceSetShaderCommand;
52 friend class ShaderSetUniformsCommand;
58 virtual Layer* createLayer(const uint id, int creatorPid);
59 virtual Surface *createSurface(const uint id, int creatorPid);
60 virtual LayerGroup *createLayerGroup(const uint id, int creatorPid);
61 virtual SurfaceGroup *createSurfaceGroup(const uint id, int creatorPid);
63 virtual bool removeLayer(Layer* layer);
64 virtual bool removeSurface(Surface* surface);
65 virtual void removeSurfaceNativeContent(Surface* surface);
66 virtual LmScreenList& getScreenList();
67 virtual LmScreen* getScreen(const uint id) const;
68 virtual Layer* getLayer(const uint id);
69 virtual Surface* getSurface(const uint id);
70 virtual SurfaceGroup* getSurfaceGroup(const uint id);
71 virtual LayerGroup* getLayerGroup(const uint id);
73 virtual void getLayerIDs(uint* length, uint** array) const;
74 virtual bool getLayerIDsOfScreen(const uint screenID, uint* length, uint** array) const;
75 virtual void getSurfaceGroupIDs(uint* length, uint** array) const;
76 virtual void getLayerGroupIDs(uint* length, uint** array) const;
77 virtual void getSurfaceIDs(uint* length, uint** array) const;
79 virtual void lockScene();
80 virtual void unlockScene();
82 virtual LayerList& getCurrentRenderOrder(const uint id);
83 virtual void removeSurfaceGroup(SurfaceGroup *surface);
84 virtual void removeLayerGroup(LayerGroup *layer);
85 virtual const SurfaceMap getAllSurfaces() const;
86 virtual bool isLayerInCurrentRenderOrder(const uint id);
88 const LayerMap getAllLayers() const;
91 void removeLayerFromAllLayerGroups(Layer* layer);
92 void removeSurfaceFromAllSurfaceGroups(Surface* surface);
95 ShaderMap m_shaderMap;
96 pthread_mutex_t m_layerListMutex;
97 LayerGroupMap m_layerGroupMap;
98 SurfaceGroupMap m_surfaceGroupMap;
99 SurfaceMap m_surfaceMap;
101 LayerList m_nullRenderOrder;
102 LmScreenList m_screenList;
105 inline const LayerMap Scene::getAllLayers() const
110 inline LayerList& Scene::getCurrentRenderOrder(const uint id) // TODO: const
112 LmScreen* screen = Scene::getScreen(id);
115 return screen->getCurrentRenderOrder();
119 return m_nullRenderOrder;
123 inline LmScreenList& Scene::getScreenList()
128 inline const SurfaceMap Scene::getAllSurfaces() const
133 inline void Scene::lockScene()
135 pthread_mutex_lock(&m_layerListMutex);
138 inline void Scene::unlockScene()
140 pthread_mutex_unlock(&m_layerListMutex);
143 #endif /* _SCENE_H_ */