Aurum: apply auto rotation for screenshot 25/294425/3
authorHosang Kim <hosang12.kim@samsung.com>
Mon, 19 Jun 2023 05:54:27 +0000 (14:54 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Thu, 22 Jun 2023 05:47:45 +0000 (05:47 +0000)
Change-Id: Ibfaf2ba8321c1125c0cbcdd5b32eb6676d9fe57b

libaurum/inc/Impl/MockDeviceImpl.h
libaurum/inc/Impl/TizenDeviceImpl.h
libaurum/inc/Interface/IDevice.h
libaurum/inc/UiDevice.h
libaurum/src/Impl/MockDeviceImpl.cc
libaurum/src/Impl/TizenDeviceImpl.cc
libaurum/src/UiDevice.cc

index e387a8e1243ae89d7dea2110146106edfb06ee92..655ff7cafa178fe92db74de962b7b704f5a77dc6 100644 (file)
@@ -160,7 +160,7 @@ public:
      * @brief TBD
      * @since_tizen 7.0
      */
-    bool takeScreenshot(std::string path, bool asPixels, void **pixels) override;
+    bool takeScreenshot(std::string path, bool asPixels, void **pixels, int angle = 0) override;
 
     /**
      * @brief TBD
index e73a564b93bb6d7d802e8ec9c048b2761e411d3e..df9970abf2834ad47ce466c00c3da07e7fa79265 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <set>
 #include <efl_util.h>
+#include <efl_util_screenshot_extension.h>
 #include <shared_mutex>
 
 using namespace Aurum;
@@ -120,7 +121,7 @@ public:
     /**
      * @copydoc IDevice::takeScreenshot()
      */
-    bool takeScreenshot(std::string path, bool asPixels, void **pixels) override;
+    bool takeScreenshot(std::string path, bool asPixels, void **pixels, int angle = 0) override;
 
     /**
      * @copydoc IDevice::getSystemTime()
index 5dc6314e1681de14d6328129b9258dffe3a51eea..6338fa52eb82e5964ee95c5950cba57bac7d9e7d 100644 (file)
@@ -266,12 +266,13 @@ public:
      * @param[in] path where the image file should be written to
      * @param[in] asPixels asPixels wheter to receive screen pixel data
      * @param[in] pixels pixel pixel buffer data pointer
+     * @param[in] angle rotation angle of current screen
      *
      * @return true if screen shot is created successfully, false otherwise
      *
-     * @since_tizen 6.5
+     * @since_tizen 8.0
      */
-    virtual bool takeScreenshot(std::string path, bool asPixels, void **pixels) = 0;
+    virtual bool takeScreenshot(std::string path, bool asPixels, void **pixels, int angle = 0) = 0;
 
     /**
      * @brief Gets device system time.
index fd30c7aeb89b87bd160191ff44a145c4c359f356..27b234b10e09b4403c0898b310e3b5737084dfca 100644 (file)
@@ -254,12 +254,13 @@ public:
      * @param[in] path where the image file should be written to
      * @param[in] asPixels asPixels wheter to receive screen pixel data
      * @param[in] pixels pixel pixel buffer data pointer
+     * @param[in] angle rotation angle of current screen
      *
      * @return true if screen shot is created successfully, false otherwise
      *
-     * @since_tizen 7.0
+     * @since_tizen 8.0
      */
-    bool takeScreenshot(std::string path, bool asPixels, void **pixels) override;
+    bool takeScreenshot(std::string path, bool asPixels, void **pixels, int angle = 0) override;
 
     /**
      * @brief Gets device system time.
index 1f4c8dd5d903cc0d26d9ea3cbe82cfabaeaac683..6c72a243a5f0dd28dade8571d1ffe9e71541a53c 100644 (file)
@@ -195,7 +195,7 @@ bool MockDeviceImpl::repeatKeyCode(std::string keycode, int intervalMs, int dura
     return false;
 }
 
-bool MockDeviceImpl::takeScreenshot(std::string path, bool asPixels, void **pixels)
+bool MockDeviceImpl::takeScreenshot(std::string path, bool asPixels, void **pixels, int angle)
 {
     return true;
 }
index 768b63b5adcf5b45279e42130ba1d5bbac371f24..33f326693b11d2636bf45a428201dd2f0eac44ab 100644 (file)
@@ -307,19 +307,27 @@ bool TizenDeviceImpl::releaseKeyCode(std::string keycode)
     return result == EFL_UTIL_ERROR_NONE;
 }
 
-bool TizenDeviceImpl::takeScreenshot(std::string path, bool asPixels, void **pixels)
+bool TizenDeviceImpl::takeScreenshot(std::string path, bool asPixels, void **pixels, int angle)
 {
     efl_util_screenshot_h screenshot = NULL;
     tbm_surface_h tbm_surface = NULL;
 
     void *ptr = NULL;
-    const int WIDTH = mScreenSize.width;
-    const int HEIGHT = mScreenSize.height;
+    int WIDTH = 0;
+    int HEIGHT = 0;
+    if (angle == 90 || angle == 270) {
+        WIDTH = mScreenSize.height;
+        HEIGHT = mScreenSize.width;
+    } else {
+        WIDTH = mScreenSize.width;
+        HEIGHT = mScreenSize.height;
+    }
 
     CaptureMutex.lock();
     screenshot = efl_util_screenshot_initialize(WIDTH, HEIGHT);
 
     if (screenshot) {
+        efl_util_screenshot_set_auto_rotation(screenshot, EINA_TRUE);
         tbm_surface = efl_util_screenshot_take_tbm_surface(screenshot);
         if (tbm_surface) {
             if (asPixels) {
index e4164bd3e3e5df212307cc4edd2da4b471ab4eba..6286d56574b5cba6b296b38b68d8b6377780822b 100644 (file)
@@ -278,9 +278,10 @@ bool UiDevice::repeatKeyCode(std::string keycode, int intervalMs, int durationMs
     return result;
 }
 
-bool UiDevice::takeScreenshot(std::string path, bool asPixels, void **pixels)
+bool UiDevice::takeScreenshot(std::string path, bool asPixels, void **pixels, int angle)
 {
-    return mDeviceImpl->takeScreenshot(path, asPixels, pixels);
+    angle = getWindowAngle();
+    return mDeviceImpl->takeScreenshot(path, asPixels, pixels, angle);
 }
 
 long long UiDevice::getSystemTime(TimeRequestType type)
@@ -349,4 +350,4 @@ int UiDevice::getTargetAngle()
     if (wins.size() > 0) return wins[0]->getTargetAngle();
 
     return 0;
-}
\ No newline at end of file
+}