Scene& scene = *(executor->getScene());
ExecutionResult result = ExecutionFailed;
- Layer *layer = scene.createLayer(*m_idReturn);
+ Layer *layer = scene.createLayer(*m_idReturn, getSenderPid());
if (layer)
{
*m_idReturn = layer->getID();
Scene& scene = *(executor->getScene());
ExecutionResult result = ExecutionFailed;
- LayerGroup *layergroup = scene.createLayerGroup(*m_idReturn);
+ LayerGroup *layergroup = scene.createLayerGroup(*m_idReturn, getSenderPid());
if (layergroup)
{
Scene& scene = *(executor->getScene());
ExecutionResult result = ExecutionFailed;
- Surface* surface = scene.createSurface(*m_idReturn);
+ Surface* surface = scene.createSurface(*m_idReturn, getSenderPid());
if (surface)
{
Scene& scene = *(executor->getScene());
ExecutionResult result = ExecutionFailed;
- SurfaceGroup *surfacegroup = scene.createSurfaceGroup(*m_idReturn);
+ SurfaceGroup *surfacegroup = scene.createSurfaceGroup(*m_idReturn, getSenderPid());
if (surfacegroup)
{
DefaultValue<Scene*>::Set((Scene*) &this->layerlist);
// Sets the default return value for type Bar.
DefaultValue<std::list<int> >::Set(defaultlist);
- DefaultValue<SurfaceGroup*>::Set(new SurfaceGroup());
+ DefaultValue<SurfaceGroup*>::Set(new SurfaceGroup(0));
EXPECT_CALL(this->layerlist, getSurfaceGroup(Eq(84567u) )).Times(1);
ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListSurfacesOfSurfacegroup uint32:84567")).c_str()));
// Sets the default return value for type Bar.
DefaultValue<Scene*>::Set((Scene*) &this->layerlist);
DefaultValue<std::list<int> >::Set(defaultlist);
- DefaultValue<LayerGroup*>::Set(new LayerGroup());
+ DefaultValue<LayerGroup*>::Set(new LayerGroup(0));
EXPECT_CALL(this->layerlist, getLayerGroup(Eq(345u) )).Times(1);
ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListLayersOfLayergroup uint32:345")).c_str()));
TEST_F(DBUSCommunicatorTest, listSurfaceoflayer) {
Scene scene;
- DefaultValue<Layer*>::Set(scene.createLayer(234));
+ DefaultValue<Layer*>::Set(scene.createLayer(234, 0));
DefaultValue<Scene*>::Set((Scene*) &layerlist);
EXPECT_CALL(this->layerlist, getLayer(Eq(234u) )).Times(1);
ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListSurfaceofLayer uint32:234")).c_str()));
Scene scene;
unsigned int newID = 0;
DefaultValue<Scene*>::Set((Scene*) &layerlist);
- DefaultValue<Surface*>::Set(scene.createSurface(newID));
+ DefaultValue<Surface*>::Set(scene.createSurface(newID, 0));
EXPECT_CALL(this->layerlist, getSurface(Eq(876u) )).Times(1);
ASSERT_NE(-1, system((DBUSCOMMAND + std::string("GetPropertiesOfSurface uint32:876")).c_str()));
}
TEST_F(DBUSCommunicatorTest, getPropertiesOflayer) {
Scene scene;
- DefaultValue<Layer*>::Set(scene.createLayer(0));
+ DefaultValue<Layer*>::Set(scene.createLayer(0, 0));
DefaultValue<Scene*>::Set((Scene*) &layerlist);
EXPECT_CALL(this->layerlist, getLayer(Eq(876u) )).Times(1);
ASSERT_NE(-1, system((DBUSCOMMAND + std::string("GetPropertiesOfLayer uint32:876")).c_str()));
gettimeofday(&tv0, NULL);
if (this->debugMode)
{
- defaultLayer = this->m_pScene->createLayer(0);
+ defaultLayer = this->m_pScene->createLayer(0, 0);
defaultLayer->setOpacity(1.0);
defaultLayer->setDestinationRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight));
defaultLayer->setSourceRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight));
if (this->debugMode)
{
LOG_DEBUG("X11WindowSystem", "CreateNotify Event");
- Surface* s = this->m_pScene->createSurface(0);
+ Surface* s = this->m_pScene->createSurface(0, 0);
s->setOpacity(1.0);
this->NewWindow(s, event.xcreatewindow.window);
defaultLayer->addSurface(s);
class GraphicalGroup : public GraphicalObject
{
public:
- GraphicalGroup()
- : GraphicalObject(thetype, 1.0, true)
+ GraphicalGroup(int creatorPid)
+ : GraphicalObject(thetype, 1.0, true, creatorPid)
{
list = std::list<T*>();
}
- GraphicalGroup(int externalId)
- : GraphicalObject(externalId, thetype, 1.0, true)
+ GraphicalGroup(int externalId, int creatorPid)
+ : GraphicalObject(externalId, thetype, 1.0, true, creatorPid)
{
list = std::list<T*>();
}
{
public:
- GraphicalObject(ObjectType type, double opacity, bool visibility);
+ GraphicalObject(ObjectType type, double opacity, bool visibility, int creatorPid);
- GraphicalObject(int externalId,ObjectType type, double opacity, bool visibility);
+ GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility, int creatorPid);
virtual ~GraphicalObject() {}
*/
void removeNotification(t_ilm_client_handle client);
+ /**
+ * @brief get list of client that registered to a notification for this object
+ */
ApplicationReferenceList& getNotificationClients();
+ /**
+ * @brief get process id of process that created this object
+ */
+ int getCreatorPid();
+
public:
static const unsigned int INVALID_ID;
private:
static unsigned int nextGraphicId[TypeMax];
+ int createdByPid;
};
-inline GraphicalObject::GraphicalObject(ObjectType type, double opacity, bool visibility)
+inline GraphicalObject::GraphicalObject(ObjectType type, double opacity, bool visibility, int creatorPid)
: type(type)
, renderPropertyChanged(false)
, damaged(false)
, chromaKeyGreen(0)
, chromaKeyBlue(0)
, graphicInternalId(nextGraphicId[type]++)
+, createdByPid(creatorPid)
{
graphicExternalId = graphicInternalId;
}
-inline GraphicalObject::GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility)
+inline GraphicalObject::GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility, int creatorPid)
: type(type)
, renderPropertyChanged(false)
, damaged(false)
, chromaKeyBlue(0)
, graphicInternalId(nextGraphicId[type]++)
, graphicExternalId(externalId)
+, createdByPid(creatorPid)
{
}
class GraphicalSurface : public GraphicalObject
{
public:
- GraphicalSurface(ObjectType type);
+ GraphicalSurface(ObjectType type, int creatorPid);
- GraphicalSurface(int externalId,ObjectType type);
+ GraphicalSurface(int externalId, ObjectType type, int creatorPid);
virtual ~GraphicalSurface() {}
OrientationType m_orientation; // Rotation of the graphical content
Rectangle m_sourceViewport;
Rectangle m_destinationViewport;
-
};
-inline GraphicalSurface::GraphicalSurface(ObjectType type)
-: GraphicalObject(type, 1.0, false)
+inline GraphicalSurface::GraphicalSurface(ObjectType type, int creatorPid)
+: GraphicalObject(type, 1.0, false, creatorPid)
, OriginalSourceWidth(0)
, OriginalSourceHeight(0)
, m_orientation(Zero)
{
}
-inline GraphicalSurface::GraphicalSurface(int externalId,ObjectType type)
-: GraphicalObject(externalId,type,1.0,false)
+inline GraphicalSurface::GraphicalSurface(int externalId, ObjectType type, int creatorPid)
+: GraphicalObject(externalId, type, 1.0, false, creatorPid)
, OriginalSourceWidth(0)
, OriginalSourceHeight(0)
, m_orientation(Zero)
#define _IAPPLICATION_REFERENCE_H_
#include <locale>
#include <string.h>
+#include <stdlib.h>
+
/**
* Abstract Base Class for all Application References
*/
* Constructor: Contructs a Object with the provided Application id and SerialId
*
*/
- IApplicationReference(char* applicationUid, unsigned int processId);
- virtual ~IApplicationReference() {}
+ IApplicationReference(char* processName, unsigned int processId);
+ ~IApplicationReference();
- virtual char* getApplicationUid();
- static long generateApplicationHash(char* applicationUid);
- virtual long getApplicationHash();
- virtual unsigned int getProcessId();
+ const char* getProcessName();
+ unsigned int getProcessId();
protected:
- char* m_applicationUid;
+ char* m_processName;
unsigned int m_processId;
};
-inline IApplicationReference::IApplicationReference(char* applicationUid, unsigned int processId)
-: m_applicationUid(applicationUid)
+inline IApplicationReference::IApplicationReference(char* processName, unsigned int processId)
+: m_processName(strdup(processName))
, m_processId(processId)
{
}
-inline char* IApplicationReference::getApplicationUid()
+inline IApplicationReference::~IApplicationReference()
{
- return m_applicationUid;
+ if (m_processName)
+ {
+ free(m_processName);
+ }
}
inline unsigned int IApplicationReference::getProcessId()
return m_processId;
}
-inline long IApplicationReference::getApplicationHash()
-{
- return generateApplicationHash(m_applicationUid);
-}
-inline long IApplicationReference::generateApplicationHash(char* applicationUid)
+inline const char* IApplicationReference::getProcessName()
{
- std::locale loc;
- const std::collate<char>& colHash = std::use_facet<std::collate<char> >(loc);
- long result = colHash.hash(applicationUid,applicationUid+strlen(applicationUid));
- return result;
+ return m_processName;
}
+
#endif /* _IAPPLICATION_REFERENCE_H_ */
virtual void removeApplicationReference(t_ilm_client_handle client) = 0;
/**
- * \brief get pid of a connected applications
+ * \brief get pid of a connected application
* \ingroup ServiceAPI
* \param[in] client client handle to get process id for
*/
virtual t_ilm_uint getSenderPid(t_ilm_client_handle client) = 0;
/**
+ * \brief get name of a connected application
+ * \ingroup ServiceAPI
+ * \param[in] client client handle to get process name for
+ */
+ virtual const char* getSenderName(t_ilm_client_handle client) = 0;
+
+ /**
+ * \brief get name of a connected application
+ * \ingroup ServiceAPI
+ * \param[in] pid process id to get process name for
+ */
+ virtual const char* getSenderName(unsigned int pid) = 0;
+
+ /**
* \brief get capabilities of layer type
* \ingroup ServiceAPI
* \param[in] layertype layer type
* \param[in] id id of layer
* \return pointer to layer
*/
- virtual Layer* createLayer(const uint id) = 0;
+ virtual Layer* createLayer(const uint id, int creatorPid) = 0;
/**
* \brief Creates a new surface within the scene.
* \param[in] id id of surface
* \return pointer to surface
*/
- virtual Surface* createSurface(const uint id) = 0;
+ virtual Surface* createSurface(const uint id, int creatorPid) = 0;
/**
* \brief Create a new layer group within the scene.
* \param[in] id id of the layer group
* \return pointer to layer group
*/
- virtual LayerGroup* createLayerGroup(const uint id) = 0;
+ virtual LayerGroup* createLayerGroup(const uint id, int creatorPid) = 0;
/**
* \brief Create a new surface group within the scene.
* \param[in] id id of the new surface group
* \return pointer to surface group
*/
- virtual SurfaceGroup* createSurfaceGroup(const uint id) = 0;
+ virtual SurfaceGroup* createSurfaceGroup(const uint id, int creatorPid) = 0;
/**
* \brief Remove a layer from the scene.
friend class Scene;
public:
- Layer();
- Layer(int id);
+ Layer(int creatorPid);
+ Layer(int id, int creatorPid);
virtual ~Layer() {}
uint m_capabilities;
};
-inline Layer::Layer()
-: GraphicalSurface(TypeLayer)
+inline Layer::Layer(int creatorPid)
+: GraphicalSurface(TypeLayer, creatorPid)
, m_layerType(Software_2D)
, m_capabilities(0)
{
}
-inline Layer::Layer(int id)
-: GraphicalSurface(id, TypeLayer)
+inline Layer::Layer(int id, int creatorPid)
+: GraphicalSurface(id, TypeLayer, creatorPid)
, m_layerType(Software_2D)
, m_capabilities(0)
{
#include "NotificationQueue.h"
#include "Scene.h"
+typedef std::map<unsigned int, const char*> PidToProcessNameTable;
+
class ICommand;
class IRenderer;
class ICommunicator;
virtual void addApplicationReference(t_ilm_client_handle client, IApplicationReference* reference);
virtual void removeApplicationReference(t_ilm_client_handle client);
virtual t_ilm_uint getSenderPid(t_ilm_client_handle client);
+ const char* getSenderName(t_ilm_client_handle client);
+ const char* getSenderName(unsigned int pid);
virtual bool startManagement(const int width, const int height, const char* displayName);
virtual bool stopManagement();
SceneProviderList* m_pSceneProviderList;
NotificationQueue m_clientNotificationQueue;
ApplicationReferenceMap* m_pApplicationReferenceMap;
+ PidToProcessNameTable m_pidToProcessNameTable;
};
inline Scene* Layermanager::getScene(void)
Scene();
virtual ~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 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);
int updateCounter;
int drawCounter;
- Surface()
- : GraphicalSurface(TypeSurface)
+ Surface(int creatorPid)
+ : GraphicalSurface(TypeSurface, creatorPid)
, platform(NULL)
, frameCounter(0)
, updateCounter(0)
pthread_mutex_init(&m_inputAcceptMutex, NULL);
}
- Surface(int id)
- : GraphicalSurface(id, TypeSurface)
+ Surface(int id, int creatorPid)
+ : GraphicalSurface(id, TypeSurface, creatorPid)
, platform(NULL)
, frameCounter(0)
, updateCounter(0)
#include "IRenderer.h"
#include "ISceneProvider.h"
+static const char* NO_SENDER_NAME = "unknown";
+
Layermanager::Layermanager()
{
m_pScene = new Scene();
{
if (client && reference)
{
- LOG_INFO("LayerManagerService", "Connect from application handle:" << client << ", pid:" << reference->getProcessId());
+ m_pidToProcessNameTable[reference->getProcessId()] = reference->getProcessName();
(*m_pApplicationReferenceMap)[client]=reference;
+ unsigned int pid = getSenderPid(client);
+ LOG_INFO("LayerManagerService", "Connect from application " << getSenderName(client) << "(" << pid << ")");
}
}
{
if (client)
{
- LOG_INFO("LayerManagerService", "Disconnect from application with handle:" << client << ", pid:" << getSenderPid(client));
+ unsigned int pid = getSenderPid(client);
+ LOG_INFO("LayerManagerService", "Disconnect from application " << getSenderName(client) << "(" << pid << ")");
m_pApplicationReferenceMap->erase(client);
+ m_pidToProcessNameTable.erase(pid);
}
}
return result;
}
+const char* Layermanager::getSenderName(t_ilm_client_handle client)
+{
+ const char* result = NO_SENDER_NAME;
+ IApplicationReference* app = (*m_pApplicationReferenceMap)[client];
+ if (app)
+ {
+ result = app->getProcessName();
+ }
+ return result;
+}
+
+const char* Layermanager::getSenderName(unsigned int pid)
+{
+ const char* result = m_pidToProcessNameTable[pid];
+ if (!result)
+ {
+ result = NO_SENDER_NAME;
+ }
+ return result;
+}
+
void Layermanager::addCommunicator(ICommunicator* communicator)
{
signalRendererRedraw();
}
- LOG_INFO("LayerManagerService", "executed: " << commandToBeExecuted->getString()
+ unsigned int commandPid = commandToBeExecuted->getSenderPid();
+ LOG_INFO("LayerManagerService", "executed " << commandToBeExecuted->getString()
+ << " from " << getSenderName(commandPid) << "(" << commandPid << ")"
<< ((status == ExecutionSuccess || status == ExecutionSuccessRedraw) ? "+" : "-"));
return (status == ExecutionSuccess || status == ExecutionSuccessRedraw);
sizeAfter = m_pScene->m_toBeCommittedList.size();
m_pScene->unlockScene();
- LOG_DEBUG("LayerManagerService", "enqueued: " << commandToBeExecuted->getString()
+ unsigned int commandPid = commandToBeExecuted->getSenderPid();
+ LOG_DEBUG("LayerManagerService", "enqueued " << commandToBeExecuted->getString()
+ << " from " << getSenderName(commandPid) << "(" << commandPid << ")"
<< ((sizeAfter == sizeBefore + 1) ? "+" : "-"));
// if queue size increased by 1, enqueue command was successful
pthread_mutex_destroy(&m_layerListMutex);
}
-Layer* Scene::createLayer(const uint layerId)
+Layer* Scene::createLayer(const uint layerId, int creatorPid)
{
Layer* newLayer = NULL;
if (layerId == GraphicalObject::INVALID_ID)
{
LOG_DEBUG("Scene", "createLayer: creating new layer");
- newLayer = new Layer();
+ newLayer = new Layer(creatorPid);
uint newLayerId = newLayer->getID();
m_layerMap[newLayerId] = newLayer;
}
if (0 == m_layerMap.count(layerId))
{
LOG_DEBUG("Scene", "createLayer: unknown layer id provided; creating new layer");
- newLayer = new Layer(layerId);
+ newLayer = new Layer(layerId, creatorPid);
uint newLayerId = newLayer->getID();
m_layerMap[newLayerId] = newLayer;
}
return newLayer;
}
-Surface* Scene::createSurface(const uint surfaceId)
+Surface* Scene::createSurface(const uint surfaceId, int creatorPid)
{
Surface* newSurface = NULL;
if (surfaceId == GraphicalObject::INVALID_ID)
{
- newSurface = new Surface();
+ newSurface = new Surface(creatorPid);
uint newSurfaceId = newSurface->getID();
m_surfaceMap[newSurfaceId] = newSurface;
}
{
if (0 == m_surfaceMap.count(surfaceId))
{
- newSurface = new Surface(surfaceId);
+ newSurface = new Surface(surfaceId, creatorPid);
uint newSurfaceId = newSurface->getID();
m_surfaceMap[newSurfaceId] = newSurface;
}
return newSurface;
}
-SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId)
+SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId, int creatorPid)
{
SurfaceGroup* newSurfaceGroup = NULL;
if (surfaceGroupId == GraphicalObject::INVALID_ID)
{
- newSurfaceGroup = new SurfaceGroup();
+ newSurfaceGroup = new SurfaceGroup(creatorPid);
uint newSurfaceGroupId = newSurfaceGroup->getID();
m_surfaceGroupMap[newSurfaceGroupId] = newSurfaceGroup;
}
{
if (0 == m_surfaceGroupMap.count(surfaceGroupId))
{
- newSurfaceGroup = new SurfaceGroup(surfaceGroupId);
+ newSurfaceGroup = new SurfaceGroup(surfaceGroupId, creatorPid);
uint newSurfaceGroupId = newSurfaceGroup->getID();
m_surfaceGroupMap[newSurfaceGroupId] = newSurfaceGroup;
}
return newSurfaceGroup;
}
-LayerGroup* Scene::createLayerGroup(const uint layerGroupId)
+LayerGroup* Scene::createLayerGroup(const uint layerGroupId, int creatorPid)
{
LayerGroup* newLayerGroup = NULL;
if (layerGroupId == GraphicalObject::INVALID_ID)
{
- newLayerGroup = new LayerGroup();
+ newLayerGroup = new LayerGroup(creatorPid);
uint newLayerGroupId = newLayerGroup->getID();
m_layerGroupMap[newLayerGroupId] = newLayerGroup;
}
{
if (0 == m_layerGroupMap.count(layerGroupId))
{
- newLayerGroup = new LayerGroup(layerGroupId);
+ newLayerGroup = new LayerGroup(layerGroupId, creatorPid);
uint newLayerGroupId = newLayerGroup->getID();
m_layerGroupMap[newLayerGroupId] = newLayerGroup;
}
public:
void SetUp()
{
- m_pLayerGroup = new GraphicalGroup<Layer, TypeLayer>();
- m_pSurfaceGroup = new GraphicalGroup<Surface, TypeSurface>();
+ m_pLayerGroup = new GraphicalGroup<Layer, TypeLayer>(0);
+ m_pSurfaceGroup = new GraphicalGroup<Surface, TypeSurface>(0);
ASSERT_TRUE(m_pLayerGroup);
ASSERT_TRUE(m_pSurfaceGroup);
}
GraphicalGroup<Layer, TypeLayer>* pLayerGroup = 0;
/// create graphical group of type layer (= layer group)
- pLayerGroup = new GraphicalGroup<Layer, TypeLayer>();
+ pLayerGroup = new GraphicalGroup<Layer, TypeLayer>(0);
/// make sure, layer group was created
ASSERT_TRUE(pLayerGroup);
GraphicalGroup<Surface, TypeSurface>* pSurfaceGroup = 0;
/// create graphical group of type surface (= surface group)
- pSurfaceGroup = new GraphicalGroup<Surface, TypeSurface>();
+ pSurfaceGroup = new GraphicalGroup<Surface, TypeSurface>(0);
/// make sure, surface group was created
ASSERT_TRUE(pSurfaceGroup);
TEST_F(GraphicalGroupTest, setVisibility_Layer)
{
/// create 3 layers
- Layer l1, l2, l3;
+ Layer l1(0), l2(0), l3(0);
/// set 2 layers to visible, one to invisible
l1.setVisibility(true);
TEST_F(GraphicalGroupTest, setVisibility_Surface)
{
/// create 3 surfaces
- Surface l1, l2, l3;
+ Surface l1(0), l2(0), l3(0);
/// set 2 surfaces to visible, one to invisible
l1.setVisibility(true);
TEST_F(GraphicalGroupTest, setOpacity_Layer)
{
/// create 3 layers
- Layer l1, l2, l3;
+ Layer l1(0), l2(0), l3(0);
/// set different opacity for each of the 3 layers
l1.setOpacity(0.3);
TEST_F(GraphicalGroupTest, setOpacity_Surface)
{
/// create 3 surfaces
- Surface l1, l2, l3;
+ Surface l1(0), l2(0), l3(0);
/// set different opacity for each of the 3 surfaces
l1.setOpacity(0.3);
EXPECT_EQ(0u, m_pLayerGroup->getList().size());
/// add 3 layers to graphical group
- Layer l1, l2, l3;
+ Layer l1(0), l2(0), l3(0);
m_pLayerGroup->addElement(&l1);
m_pLayerGroup->addElement(&l2);
m_pLayerGroup->addElement(&l3);
EXPECT_EQ(0u, m_pSurfaceGroup->getList().size());
/// add 3 surfaces to graphical group
- Surface l1, l2, l3;
+ Surface l1(0), l2(0), l3(0);
m_pSurfaceGroup->addElement(&l1);
m_pSurfaceGroup->addElement(&l2);
m_pSurfaceGroup->addElement(&l3);
EXPECT_EQ(0u, m_pLayerGroup->getList().size());
/// add 1 layer to graphical group
- Layer l1;
+ Layer l1(0);
m_pLayerGroup->addElement(&l1);
/// make sure, list not contains 1 element
EXPECT_EQ(1u, m_pLayerGroup->getList().size());
/// add 2 layers to graphical group
- Layer l2, l3;
+ Layer l2(0), l3(0);
m_pLayerGroup->addElement(&l2);
m_pLayerGroup->addElement(&l3);
EXPECT_EQ(0u, m_pSurfaceGroup->getList().size());
/// add 1 surface to graphical group
- Surface l1;
+ Surface l1(0);
m_pSurfaceGroup->addElement(&l1);
/// make sure, list not contains 1 element
EXPECT_EQ(1u, m_pSurfaceGroup->getList().size());
/// add 2 surfaces to graphical group
- Surface l2, l3;
+ Surface l2(0), l3(0);
m_pSurfaceGroup->addElement(&l2);
m_pSurfaceGroup->addElement(&l3);
EXPECT_EQ(0u, m_pLayerGroup->getList().size());
/// add 3 layers to graphical group
- Layer l1, l2, l3;
+ Layer l1(0), l2(0), l3(0);
m_pLayerGroup->addElement(&l1);
m_pLayerGroup->addElement(&l2);
m_pLayerGroup->addElement(&l3);
EXPECT_EQ(0u, m_pSurfaceGroup->getList().size());
/// add 3 surfaces to graphical group
- Surface l1, l2, l3;
+ Surface l1(0), l2(0), l3(0);
m_pSurfaceGroup->addElement(&l1);
m_pSurfaceGroup->addElement(&l2);
m_pSurfaceGroup->addElement(&l3);
public:
void SetUp()
{
- m_pSurface = new GraphicalObject(TypeSurface, 1.0, true);
- m_pLayer = new GraphicalObject(TypeLayer, 1.0, true);
+ m_pSurface = new GraphicalObject(TypeSurface, 1.0, true, 0);
+ m_pLayer = new GraphicalObject(TypeLayer, 1.0, true, 0);
ASSERT_TRUE(m_pSurface);
ASSERT_TRUE(m_pLayer);
}
unsigned int expectedVisibility = 1;
/// Create graphical object of type layer without specific id
- GraphicalObject layer(TypeLayer, expectedOpacity, expectedVisibility);
+ GraphicalObject layer(TypeLayer, expectedOpacity, expectedVisibility, 0);
/// make sure, layer has a valid id assigned
EXPECT_NE(GraphicalObject::INVALID_ID, layer.getID());
unsigned char chromaKeyBlue = 111;
/// Create graphical object of type surface without specific id
- GraphicalObject surface(TypeSurface, expectedOpacity, expectedVisibility);
+ GraphicalObject surface(TypeSurface, expectedOpacity, expectedVisibility, 0);
/// make sure, surface has a valid id assigned
EXPECT_NE(GraphicalObject::INVALID_ID, surface.getID());
unsigned char chromaKeyBlue = 111;
/// Create graphical object of type layer without specific id
- GraphicalObject layer(expectedId, TypeLayer, expectedOpacity, expectedVisibility);
+ GraphicalObject layer(expectedId, TypeLayer, expectedOpacity, expectedVisibility, 0);
/// make sure, layer has a expected id assigned
EXPECT_EQ(expectedId, layer.getID());
unsigned char chromaKeyBlue = 111;
/// Create graphical object of type surface without specific id
- GraphicalObject surface(expectedId, TypeSurface, expectedOpacity, expectedVisibility);
+ GraphicalObject surface(expectedId, TypeSurface, expectedOpacity, expectedVisibility, 0);
/// make sure, surface has a expected id assigned
EXPECT_EQ(expectedId, surface.getID());
EXPECT_NE(GraphicalObject::INVALID_ID, m_pLayer->getID());
/// create graphical object of type layer with expected id
- GraphicalObject layer(expectedLayerId, TypeLayer, 1.0, 1);
+ GraphicalObject layer(expectedLayerId, TypeLayer, 1.0, 1, 0);
/// make sure, graphical object has expected id
EXPECT_EQ(expectedLayerId, layer.getID());
EXPECT_NE(GraphicalObject::INVALID_ID, m_pSurface->getID());
/// create graphical object of type surface with expected id
- GraphicalObject surface(expectedSurfaceId, TypeSurface, 1.0, 1);
+ GraphicalObject surface(expectedSurfaceId, TypeSurface, 1.0, 1, 0);
/// make sure, graphical object has expected id
EXPECT_EQ(expectedSurfaceId, surface.getID());
public:
void SetUp()
{
- m_pGraphicalSurface = new GraphicalSurface(TypeSurface);
+ m_pGraphicalSurface = new GraphicalSurface(TypeSurface, 0);
ASSERT_TRUE(m_pGraphicalSurface);
}
Layer* pLayer;
Surface* pSurface;
- pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY1_ID);
+ pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY1_ID, 0);
pLayer->OriginalSourceWidth = CPLX_SCREEN_WIDTH;
pLayer->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pLayer->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT));
/* Surface 10 : Background */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT));
pLayer->addSurface(pSurface);
/* Surface 20 : Menubar */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_MENUBAR_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_MENUBAR_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY1_MENUBAR_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY1_MENUBAR_WIDTH, CPLX_SCREEN_HEIGHT));
pLayer->addSurface(pSurface);
/* Surface 20 : Status */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_LAY1_STATUSBAR_HEIGHT));
Layer* pLayer;
Surface* pSurface;
- pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY2_ID);
+ pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY2_ID, 0);
pLayer->OriginalSourceWidth = CPLX_SCREEN_WIDTH;
pLayer->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pLayer->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT));
pLayer->setVisibility(true);
/* Surface 100 : Background */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_BACKGROUND_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_BACKGROUND_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT));
pLayer->addSurface(pSurface);
/* Surface 200 : Content */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_CONTENT_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY2_CONTENT_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_LAY2_CONTENT_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY2_CONTENT_WIDTH, CPLX_SCREEN_LAY2_CONTENT_HEIGHT));
pLayer->addSurface(pSurface);
/* Surface 300 : Popup */
- pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_POPUP_ID);
+ pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_POPUP_ID, 0);
pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY2_POPUP_WIDTH;
pSurface->OriginalSourceHeight = CPLX_SCREEN_LAY2_POPUP_HEIGHT;
pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY2_POPUP_WIDTH, CPLX_SCREEN_LAY2_POPUP_HEIGHT));
layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID);
// Let's create a new surface & add it to the top layer
- newSurf = m_pScene->createSurface(sid);
+ newSurf = m_pScene->createSurface(sid, 0);
newSurf->OriginalSourceWidth = sw;
newSurf->OriginalSourceHeight = sh;
newSurf->setSourceRegion(Rectangle(0, 0, sw, sh));
layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID);
// Let's create a new surface & add it to the top layer
- newSurf = m_pScene->createSurface(sid);
+ newSurf = m_pScene->createSurface(sid, 0);
newSurf->OriginalSourceWidth = sw;
newSurf->OriginalSourceHeight = sh;
newSurf->setSourceRegion(Rectangle(0, 0, sw, sh));
layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID);
// Let's create a new surface & add it to the top layer
- newSurf = m_pScene->createSurface(sid);
+ newSurf = m_pScene->createSurface(sid, 0);
newSurf->OriginalSourceWidth = sw;
newSurf->OriginalSourceHeight = sh;
newSurf->setSourceRegion(Rectangle(0, 0, sw, sh));
public:
void SetUp()
{
- m_pLayer = new Layer();
+ m_pLayer = new Layer(0);
ASSERT_TRUE(m_pLayer);
}
TEST_F(LayerTest, defaultConstructor)
{
- Layer layer;
+ Layer layer(0);
/// make sure, Layer was not added to any layer
//EXPECT_EQ(INVALID_ID, Layer.getContainingLayerId());
{
unsigned int expectedSurfaceId = 34;
Surface surface(expectedSurfaceId);
- Layer layer;
+ Layer layer(0);
/// make sure, layer contains no surfaces
SurfaceList& slist = m_pLayer->getAllSurfaces();
TEST_F(LayerTest, removeSurface)
{
- Surface s1, s2, s3;
+ Surface s1(0), s2(0), s3(0);
/// make sure, layer contains no surfaces
SurfaceList& slist = m_pLayer->getAllSurfaces();
TEST_F(LayerTest, getAllSurfaces)
{
- Surface s1, s2, s3, s4, s5;
+ Surface s1(0), s2(0), s3(0), s4(0), s5(0);
/// make sure, getAllSurfaces returns empty list, if layer contains no surfaces
SurfaceList& slist = m_pLayer->getAllSurfaces();
TEST_F(LayerTest, removeAllSurfaces)
{
- Surface s1, s2, s3, s4, s5;
+ Surface s1(0), s2(0), s3(0), s4(0), s5(0);
/// make sure, getAllSurfaces returns empty list, if layer contains no surfaces
SurfaceList& slist = m_pLayer->getAllSurfaces();
ASSERT_EQ((uint)0, size) << "Scene should contain 0 layers";
/// create layer with expected id
- pLayer = m_pScene->createLayer(expected);
+ pLayer = m_pScene->createLayer(expected, 0);
ASSERT_TRUE(pLayer) << "Layer was not created.";
/// make sure layer has expected id
ASSERT_EQ((uint)0, size) << "Scene should contain 0 layers";
/// create layer with invalid id
- pLayer = m_pScene->createLayer(GraphicalObject::INVALID_ID);
+ pLayer = m_pScene->createLayer(GraphicalObject::INVALID_ID, 0);
ASSERT_TRUE(pLayer) << "Layer was not created.";
/// make sure new layer has valid id
Layer* pLayer2;
/// create Layer with id 55
- pLayer1 = m_pScene->createLayer(expected);
+ pLayer1 = m_pScene->createLayer(expected, 0);
ASSERT_EQ(expected, pLayer1->getID());
/// make sure, scene contains one layer
ASSERT_EQ((uint)1, size) << "Scene should contain 1 layer";
/// try to create existing layer 55, handle to existing layer should be returned
- pLayer2 = m_pScene->createLayer(expected);
+ pLayer2 = m_pScene->createLayer(expected, 0);
ASSERT_EQ(expected, pLayer2->getID());
/// make sure, scene still contains one layer
ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces";
/// create surface with expected id
- pSurface = m_pScene->createSurface(expected);
+ pSurface = m_pScene->createSurface(expected, 0);
ASSERT_TRUE(pSurface) << "Surface was not created.";
/// make sure surface has expected id
ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces";
/// create surface with invalid id
- pSurface = m_pScene->createSurface(GraphicalObject::INVALID_ID);
+ pSurface = m_pScene->createSurface(GraphicalObject::INVALID_ID, 0);
ASSERT_TRUE(pSurface) << "Surface was not created.";
/// make sure new surface has valid id
ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces";
/// create surface with expected id
- pSurface1 = m_pScene->createSurface(expected);
+ pSurface1 = m_pScene->createSurface(expected, 0);
ASSERT_TRUE(pSurface1) << "Surface was not created.";
/// make sure surface has expected id
ASSERT_EQ((uint)1, size) << "Scene should contain 1 surface";
/// create surface with expected id again
- pSurface2 = m_pScene->createSurface(expected);
+ pSurface2 = m_pScene->createSurface(expected, 0);
ASSERT_TRUE(pSurface2) << "Surface was not created.";
/// make sure surface has expected id again
ASSERT_FALSE(pLayerGroup);
/// create expected layer group
- m_pScene->createLayerGroup(expectedId);
+ m_pScene->createLayerGroup(expectedId, 0);
/// make sure, expected layer group does exist
pLayerGroup = m_pScene->getLayerGroup(expectedId);
ASSERT_FALSE(pLayerGroup1);
/// create expected layer group, get 1st handle to group
- pLayerGroup1 = m_pScene->createLayerGroup(expectedLayerGroupId);
+ pLayerGroup1 = m_pScene->createLayerGroup(expectedLayerGroupId, 0);
ASSERT_TRUE(pLayerGroup1);
/// make sure, expected layer group does exist
EXPECT_TRUE(pLayerGroup1);
/// create expected layer group again, get 2nd handle to group
- pLayerGroup2 = m_pScene->createLayerGroup(expectedLayerGroupId);
+ pLayerGroup2 = m_pScene->createLayerGroup(expectedLayerGroupId, 0);
/// make sure, expected layer group does exist
ASSERT_TRUE(pLayerGroup2);
ASSERT_FALSE(pSurfaceGroup);
/// create expected Surface group, get 1st handle to group
- pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId);
+ pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0);
ASSERT_TRUE(pSurfaceGroup);
/// make sure, expected Surface group does exist
ASSERT_FALSE(pSurfaceGroup1);
/// create expected Surface group, get 1st handle to group
- pSurfaceGroup1 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId);
+ pSurfaceGroup1 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0);
ASSERT_TRUE(pSurfaceGroup1);
/// make sure, expected Surface group does exist
EXPECT_TRUE(pSurfaceGroup1);
/// create expected Surface group again, get 2nd handle to group
- pSurfaceGroup2 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId);
+ pSurfaceGroup2 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0);
/// make sure, expected Surface group does exist
ASSERT_TRUE(pSurfaceGroup2);
Layer* pLayer;
/// create layer
- pLayer = m_pScene->createLayer(expectedLayerId);
+ pLayer = m_pScene->createLayer(expectedLayerId, 0);
ASSERT_TRUE(pLayer);
/// make sure, layer exists
Surface* pSurface;
/// create Surface
- pSurface = m_pScene->createSurface(expectedSurfaceId);
+ pSurface = m_pScene->createSurface(expectedSurfaceId, 0);
ASSERT_TRUE(pSurface);
/// make sure, Surface exists
EXPECT_FALSE(m_pScene->getLayer(expectedLayerId));
/// create layer
- pLayer = m_pScene->createLayer(expectedLayerId);
+ pLayer = m_pScene->createLayer(expectedLayerId, 0);
ASSERT_TRUE(pLayer);
/// get layer
EXPECT_FALSE(m_pScene->getSurface(expectedSurfaceId));
/// create Surface
- pSurface = m_pScene->createSurface(expectedSurfaceId);
+ pSurface = m_pScene->createSurface(expectedSurfaceId, 0);
ASSERT_TRUE(pSurface);
/// get Surface
EXPECT_FALSE(m_pScene->getSurfaceGroup(expectedSurfaceGroupId));
/// create SurfaceGroup
- pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId);
+ pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0);
ASSERT_TRUE(pSurfaceGroup);
/// get SurfaceGroup
EXPECT_FALSE(m_pScene->getLayerGroup(expectedLayerGroupId));
/// create LayerGroup
- pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId);
+ pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId, 0);
ASSERT_TRUE(pLayerGroup);
/// get LayerGroup
ASSERT_EQ((uint)0, size);
/// create 4 layers in scene
- m_pScene->createLayer(layerId1);
- m_pScene->createLayer(layerId2);
- m_pScene->createLayer(layerId3);
- m_pScene->createLayer(layerId4);
+ m_pScene->createLayer(layerId1, 0);
+ m_pScene->createLayer(layerId2, 0);
+ m_pScene->createLayer(layerId3, 0);
+ m_pScene->createLayer(layerId4, 0);
/// make sure, scene contains these 4 layers
m_pScene->getLayerIDs(&size, &array);
ASSERT_EQ((uint)0, size);
/// create 4 layers in scene, but dont add them to render order
- l1 = m_pScene->createLayer(layerId1);
- l2 = m_pScene->createLayer(layerId2);
- l3 = m_pScene->createLayer(layerId3);
- l4 = m_pScene->createLayer(layerId4);
+ l1 = m_pScene->createLayer(layerId1, 0);
+ l2 = m_pScene->createLayer(layerId2, 0);
+ l3 = m_pScene->createLayer(layerId3, 0);
+ l4 = m_pScene->createLayer(layerId4, 0);
/// make sure, scene contains these 4 layers
m_pScene->getLayerIDs(&size, &array);
ASSERT_EQ((uint)0, size);
/// create 4 surfaces in scene
- m_pScene->createSurface(surfaceId1);
- m_pScene->createSurface(surfaceId2);
- m_pScene->createSurface(surfaceId3);
- m_pScene->createSurface(surfaceId4);
+ m_pScene->createSurface(surfaceId1, 0);
+ m_pScene->createSurface(surfaceId2, 0);
+ m_pScene->createSurface(surfaceId3, 0);
+ m_pScene->createSurface(surfaceId4, 0);
/// make sure, scene contains these 4 surfaces
m_pScene->getSurfaceIDs(&size, &array);
ASSERT_EQ((uint)0, size);
/// create 4 layergroups in scene
- m_pScene->createLayerGroup(layergroupId1);
- m_pScene->createLayerGroup(layergroupId2);
- m_pScene->createLayerGroup(layergroupId3);
- m_pScene->createLayerGroup(layergroupId4);
+ m_pScene->createLayerGroup(layergroupId1, 0);
+ m_pScene->createLayerGroup(layergroupId2, 0);
+ m_pScene->createLayerGroup(layergroupId3, 0);
+ m_pScene->createLayerGroup(layergroupId4, 0);
/// make sure, scene contains these 4 layergroups
m_pScene->getLayerGroupIDs(&size, &array);
ASSERT_EQ((uint)0, size);
/// create 4 surfacegroups in scene
- m_pScene->createSurfaceGroup(surfacegroupId1);
- m_pScene->createSurfaceGroup(surfacegroupId2);
- m_pScene->createSurfaceGroup(surfacegroupId3);
- m_pScene->createSurfaceGroup(surfacegroupId4);
+ m_pScene->createSurfaceGroup(surfacegroupId1, 0);
+ m_pScene->createSurfaceGroup(surfacegroupId2, 0);
+ m_pScene->createSurfaceGroup(surfacegroupId3, 0);
+ m_pScene->createSurfaceGroup(surfacegroupId4, 0);
/// make sure, scene contains these 4 surfacegroups
m_pScene->getSurfaceGroupIDs(&size, &array);
SurfaceGroup* pSurfaceGroup;
/// create expected Surface group
- pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId);
+ pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0);
ASSERT_TRUE(pSurfaceGroup);
/// make sure, expected Surface group does exist
LayerGroup* pLayerGroup;
/// create expected Layer group
- pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId);
+ pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId, 0);
ASSERT_TRUE(pLayerGroup);
/// make sure, expected Layer group does exist
ASSERT_EQ((uint)0, m_pScene->getAllSurfaces().size());
/// add 3 surfaces to scene
- s1 = m_pScene->createSurface(expectedId1);
- s2 = m_pScene->createSurface(expectedId2);
- s3 = m_pScene->createSurface(expectedId3);
+ s1 = m_pScene->createSurface(expectedId1, 0);
+ s2 = m_pScene->createSurface(expectedId2, 0);
+ s3 = m_pScene->createSurface(expectedId3, 0);
/// get all surfaces
const SurfaceMap& smap1 = m_pScene->getAllSurfaces();
Layer* l1;
/// create layer in scene, but dont add it to render order
- l1 = m_pScene->createLayer(layerId1);
+ l1 = m_pScene->createLayer(layerId1, 0);
/// make sure, scene contains the new layers
m_pScene->getLayerIDs(&size, &array);
public:
void SetUp()
{
- m_pSurface = new Surface();
+ m_pSurface = new Surface(0);
ASSERT_TRUE(m_pSurface);
}
TEST_F(SurfaceTest, defaultConstructor)
{
- Surface surface;
+ Surface surface(0);
/// make sure, surface was not added to any layer
EXPECT_EQ(GraphicalObject::INVALID_ID, surface.getContainingLayerId());