ScreenDump: WindowSystems: add screenId in doScreenShot function
authorEugen Friedrich <efriedrich@de.adit-jv.com>
Wed, 3 Jul 2013 14:26:24 +0000 (16:26 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 5 Jul 2013 10:56:48 +0000 (12:56 +0200)
ScreenId is important if window system supports more than one screen
so the requested screen could be dumped.

Signed-off-by: Eugen Friedrich <efriedrich@de.adit-jv.com>
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp

index 6c5354d..4c8965e 100644 (file)
@@ -42,7 +42,7 @@ public:
     virtual bool start(int maxIterationDurationInMS) = 0;
     virtual void stop() = 0;
     virtual void allocatePlatformSurface(Surface *surface) = 0;
-    virtual void doScreenShot(std::string fileName) = 0;
+    virtual void doScreenShot(std::string fileName, const uint screen_id) = 0;
     virtual void doScreenShotOfLayer(std::string fileName, const uint id) = 0;
     virtual void doScreenShotOfSurface(std::string fileName, const uint id, const uint layer_id) = 0;
     virtual void finishFrame() { }
index f7542a4..72d3bf9 100644 (file)
@@ -85,7 +85,7 @@ public:
     struct wl_display* getNativeDisplayHandle();
     virtual void allocatePlatformSurface(Surface *surface);
     virtual void deallocatePlatformSurface(Surface *surface);
-    void doScreenShot(std::string fileName);
+    void doScreenShot(std::string fileName, const uint screen_id);
     void doScreenShotOfLayer(std::string fileName, const uint id);
     void doScreenShotOfSurface(std::string fileName, const uint id, const uint layer_id);
     int getWindowWidth() const;
@@ -119,6 +119,7 @@ protected:
     WaylandWindowSystemStates m_systemState;
     uint m_manageConnectionId;
     std::string m_screenShotFile;
+    uint m_screenShotScreenID;
     uint m_screenShotSurfaceID;
     uint m_screenShotLayerID;
     bool m_debugMode;
index c52f2ad..798f716 100644 (file)
@@ -62,13 +62,14 @@ public:
     Window getCompositorNativeWindowHandle();
     virtual void allocatePlatformSurface(Surface *surface);
     virtual void deallocatePlatformSurface(Surface *surface);
-    void doScreenShot(std::string fileName);
+    void doScreenShot(std::string fileName, const uint screen_id);
     void doScreenShotOfLayer(std::string fileName, const uint id);
     void doScreenShotOfSurface(std::string fileName, const uint id, const uint layer_id);
     int getIterationCounter();
 private:
     ScreenShotType takeScreenshot;
     std::string screenShotFile;
+    uint screenShotScreenID;
     uint screenShotSurfaceID;
     uint screenShotLayerID;
     const char* displayname;
index 8bfc306..286dd71 100644 (file)
@@ -149,6 +149,7 @@ WaylandBaseWindowSystem::WaylandBaseWindowSystem(const char* displayname, int wi
 , m_systemState(IDLE_STATE)
 , m_manageConnectionId(256)
 , m_screenShotFile()
+, m_screenShotScreenID(0)
 , m_screenShotSurfaceID(0)
 , m_screenShotLayerID(0)
 , m_debugMode(false)
@@ -447,13 +448,17 @@ void WaylandBaseWindowSystem::Screenshot()
     if (m_takeScreenshot == ScreenshotOfDisplay)
     {
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot");
+        graphicSystem->switchScreen(m_screenShotScreenID);
+
         RedrawAllLayers(true, false); // Do clear, Don't swap
     }
     else if (m_takeScreenshot == ScreenshotOfLayer)
     {
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot of layer");
         Layer* layer = m_pScene->getLayer(m_screenShotLayerID);
+        graphicSystem->switchScreen(layer->getContainingScreenId());
 
+        graphicSystem->clearBackground();
         if (layer != NULL)
         {
             graphicSystem->renderSWLayer(layer, true); // Do clear
@@ -464,6 +469,7 @@ void WaylandBaseWindowSystem::Screenshot()
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot of surface");
         Layer* layer = m_pScene->getLayer(m_screenShotLayerID);
         Surface* surface = m_pScene->getSurface(m_screenShotSurfaceID);
+        graphicSystem->switchScreen(layer->getContainingScreenId());
 
         graphicSystem->clearBackground();
         if (layer != NULL && surface != NULL)
@@ -1274,10 +1280,11 @@ void WaylandBaseWindowSystem::deallocatePlatformSurface(Surface* surface)
     LOG_DEBUG("WaylandBaseWindowSystem", "deallocatePlatformSurface end");
 }
 
-void WaylandBaseWindowSystem::doScreenShot(std::string fileName)
+void WaylandBaseWindowSystem::doScreenShot(std::string fileName, const uint screen_id)
 {
     m_takeScreenshot = ScreenshotOfDisplay;
     m_screenShotFile = fileName;
+    m_screenShotScreenID = screen_id;
 }
 
 void WaylandBaseWindowSystem::doScreenShotOfLayer(std::string fileName, const uint id)
index 4668e41..cd6d5d4 100644 (file)
@@ -1265,10 +1265,11 @@ void X11WindowSystem::deallocatePlatformSurface(Surface* surface)
     LOG_DEBUG("X11WindowSystem", "deallocatePlatformSurface end");
 }
 
-void X11WindowSystem::doScreenShot(std::string fileName)
+void X11WindowSystem::doScreenShot(std::string fileName, const uint screen_id)
 {
     takeScreenshot = ScreenshotOfDisplay;
     screenShotFile = fileName;
+    screenShotScreenID = screen_id;
 }
 
 void X11WindowSystem::doScreenShotOfLayer(std::string fileName, const uint id)