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 e387a8e..655ff7c 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 e73a564..df9970a 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 5dc6314..6338fa5 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 fd30c7a..27b234b 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 1f4c8dd..6c72a24 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 768b63b..33f3266 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 e4164bd..6286d56 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
+}