LayerManagerService: added support for client specific command queues
[profile/ivi/layer-management.git] / LayerManagerService / include / Scene.h
index 0cd44e7..f5b1575 100644 (file)
@@ -1,6 +1,7 @@
 /***************************************************************************
  *
  * Copyright 2010,2011 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,6 +32,7 @@
 #include "LayerMap.h"
 #include "ShaderMap.h"
 #include "LayerList.h"
+#include "LmScreenList.h"
 #include <pthread.h>
 
 class Layer;
@@ -44,26 +46,29 @@ class Scene: public IScene
     // TODO: these should use public interface instead
     friend class Layermanager;
     friend class CommitCommand;
-    friend class CreateShaderCommand;
-    friend class DestroyShaderCommand;
-    friend class SetShaderCommand;
-    friend class SetUniformsCommand;
+    friend class ShaderCreateCommand;
+    friend class ShaderDestroyCommand;
+    friend class SurfaceSetShaderCommand;
+    friend class ShaderSetUniformsCommand;
 
 public:
     Scene();
-    ~Scene();
-
-    virtual Layer* createLayer(const uint id);
-    virtual Surface *createSurface(const uint id);
-    virtual LayerGroup *createLayerGroup(const uint id);
-    virtual SurfaceGroup *createSurfaceGroup(const uint id);
-
-    virtual void removeLayer(Layer* layer);
-    virtual void removeSurface(Surface* surface);
-    virtual Layer* getLayer(const uint id) const;
-    virtual Surface* getSurface(const uint id) const;
-    virtual SurfaceGroup* getSurfaceGroup(const uint id) const;
-    virtual LayerGroup* getLayerGroup(const uint id) const;
+    virtual ~Scene();
+
+    virtual Layer* createLayer(const uint id, int creatorPid);
+    virtual Surface *createSurface(const uint id, int creatorPid);
+    virtual LayerGroup *createLayerGroup(const uint id, int creatorPid);
+    virtual SurfaceGroup *createSurfaceGroup(const uint id, int creatorPid);
+
+    virtual bool removeLayer(Layer* layer);
+    virtual bool removeSurface(Surface* surface);
+    virtual void removeSurfaceNativeContent(Surface* surface);
+    virtual LmScreenList& getScreenList();
+    virtual LmScreen* getScreen(const uint id) const;
+    virtual Layer* getLayer(const uint id);
+    virtual Surface* getSurface(const uint id);
+    virtual SurfaceGroup* getSurfaceGroup(const uint id);
+    virtual LayerGroup* getLayerGroup(const uint id);
 
     virtual void getLayerIDs(uint* length, uint** array) const;
     virtual bool getLayerIDsOfScreen(const uint screenID, uint* length, uint** array) const;
@@ -74,28 +79,27 @@ public:
     virtual void lockScene();
     virtual void unlockScene();
 
-public:
-    // TODO: should be private -> not in ILayerList; clients should use only the interface
-    LayerList& getCurrentRenderOrder();
-    void removeSurfaceGroup(SurfaceGroup *surface);
-    void removeLayerGroup(LayerGroup *layer);
-    const SurfaceMap getAllSurfaces() const;
+    virtual LayerList& getCurrentRenderOrder(const uint id);
+    virtual void removeSurfaceGroup(SurfaceGroup *surface);
+    virtual void removeLayerGroup(LayerGroup *layer);
+    virtual const SurfaceMap getAllSurfaces() const;
+    virtual bool isLayerInCurrentRenderOrder(const uint id);
 
-private:
     const LayerMap getAllLayers() const;
+
+private:
     void removeLayerFromAllLayerGroups(Layer* layer);
-    void removeSurfaceFromAllLayers(Surface* surface);
     void removeSurfaceFromAllSurfaceGroups(Surface* surface);
 
 private:
-    CommandList m_toBeCommittedList;
     ShaderMap m_shaderMap;
     pthread_mutex_t m_layerListMutex;
     LayerGroupMap m_layerGroupMap;
     SurfaceGroupMap m_surfaceGroupMap;
     SurfaceMap m_surfaceMap;
     LayerMap m_layerMap;
-    LayerList m_currentRenderOrder;
+    LayerList m_nullRenderOrder;
+    LmScreenList m_screenList;
 };
 
 inline const LayerMap Scene::getAllLayers() const
@@ -103,9 +107,22 @@ inline const LayerMap Scene::getAllLayers() const
     return m_layerMap;
 }
 
-inline LayerList& Scene::getCurrentRenderOrder() // TODO: const
+inline LayerList& Scene::getCurrentRenderOrder(const uint id) // TODO: const
+{
+    LmScreen* screen = Scene::getScreen(id);
+    if (NULL != screen)
+    {
+        return screen->getCurrentRenderOrder();
+    }
+    else
+    {
+        return m_nullRenderOrder;
+    }
+}
+
+inline LmScreenList& Scene::getScreenList()
 {
-    return m_currentRenderOrder;
+    return m_screenList;
 }
 
 inline const SurfaceMap Scene::getAllSurfaces() const