From 6e42c51e1381c4562339d79461a57071309cf3c6 Mon Sep 17 00:00:00 2001 From: Eugen Friedrich Date: Wed, 3 Jul 2013 16:26:24 +0200 Subject: [PATCH] ScreenDump: WindowSystems: add screenId in doScreenShot function ScreenId is important if window system supports more than one screen so the requested screen could be dumped. Signed-off-by: Eugen Friedrich --- .../Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h | 2 +- .../Graphic/include/WindowSystems/WaylandBaseWindowSystem.h | 3 ++- .../Renderers/Graphic/include/WindowSystems/X11WindowSystem.h | 3 ++- .../Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp | 9 ++++++++- .../Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h index 6c5354d..4c8965e 100644 --- a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h +++ b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h @@ -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() { } diff --git a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h index f7542a4..72d3bf9 100644 --- a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h +++ b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h @@ -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; diff --git a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h index c52f2ad..798f716 100644 --- a/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h +++ b/LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h @@ -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; diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp index 8bfc306..286dd71 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp @@ -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) diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index 4668e41..cd6d5d4 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -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) -- 2.7.4