From: Heeyong Song Date: Thu, 22 Jun 2023 04:17:13 +0000 (+0900) Subject: Add SetPartialUpdateEnabled to Window X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fresf%2Ffor%2Fdevel%2Fmaster;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Add SetPartialUpdateEnabled to Window Change-Id: Ic8ae7c4c1a76d9aa5dbd31e61485d7900c8dc13b --- diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.cpp index eb1ab88..d628f0d 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.cpp @@ -22,6 +22,7 @@ #include // INTERNAL INCLUDES +#include #include "mesh-builder.h" namespace Dali @@ -138,4 +139,29 @@ TextureSet CreateTextureSet(Pixel::Format format, int width, int height) return textureSet; } +void DirtyRectChecker(const std::vector>& damagedRects, std::multiset, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation) +{ + // Just check damagedRect contain all expectRectList. + DALI_TEST_GREATER(damagedRects.size() + 1u, expectedRectList.size(), testLocation); + + for(auto& rect : damagedRects) + { + auto iter = expectedRectList.find(rect); + if(iter != expectedRectList.end()) + { + expectedRectList.erase(iter); + } + else if(checkRectsExact) + { + std::ostringstream o; + o << rect << " exist in expectRectList" << std::endl; + fprintf(stderr, "Test failed in %s, checking %s", testLocation, o.str().c_str()); + tet_result(TET_FAIL); + } + } + + // Check all rects are matched + DALI_TEST_EQUALS(expectedRectList.empty(), true, testLocation); +} + } // namespace Dali diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.h index 94f1493..6571365 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-actor-utils.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include // For std::multiset #include namespace Dali @@ -63,6 +64,30 @@ Actor CreateRenderableActor2(TextureSet textures, const std::string& vertexShade Texture CreateTexture(TextureType::Type type, Pixel::Format format, int width, int height); TextureSet CreateTextureSet(Pixel::Format format, int width, int height); +// Check dirtyRect is equal with expected multiset. +// Note that the order of damagedRect is not important +struct RectSorter +{ + bool operator()(const Rect& lhs, const Rect& rhs) const + { + if(lhs.x != rhs.x) + { + return lhs.x < rhs.x; + } + if(lhs.y != rhs.y) + { + return lhs.y < rhs.y; + } + if(lhs.width != rhs.width) + { + return lhs.width < rhs.width; + } + return lhs.height < rhs.height; + } +}; + +void DirtyRectChecker(const std::vector>& damagedRects, std::multiset, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation); + } // namespace Dali #endif // DALI_TEST_ACTOR_UTILS_H diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index dd75c39..f1b62f8 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -190,8 +190,8 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std bool isSetWithScreenSize = false; if(mWindowWidth <= 0 || mWindowHeight <= 0) { - mWindowWidth = screenWidth; - mWindowHeight = screenHeight; + mWindowWidth = screenWidth; + mWindowHeight = screenHeight; isSetWithScreenSize = true; DALI_LOG_RELEASE_INFO("Window size is set with screen size(%d x %d)\n", mWindowWidth, mWindowHeight); } @@ -334,6 +334,16 @@ void Window::KeepRendering(float durationSeconds) mScene.KeepRendering(durationSeconds); } +void Window::SetPartialUpdateEnabled(bool enabled) +{ + mScene.SetPartialUpdateEnabled(enabled); +} + +bool Window::IsPartialUpdateEnabled() const +{ + return mScene.IsPartialUpdateEnabled(); +} + std::string Window::GetNativeResourceId() const { return mWindowBase->GetNativeWindowResourceId(); diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index da9336d..e78d32b 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -169,6 +169,16 @@ public: void KeepRendering(float durationSeconds); /** + * @copydoc Dali::Window::SetPartialUpdateEnabled() + */ + void SetPartialUpdateEnabled(bool enabled); + + /** + * @copydoc Dali::Window::IsPartialUpdateEnabled() + */ + bool IsPartialUpdateEnabled() const; + + /** * @brief Get window resource ID assigned by window manager * @return The resource ID of the window */ @@ -823,10 +833,10 @@ private: std::vector mAvailableAngles; int mPreferredAngle; - int mRotationAngle; ///< The angle of the rotation - int mWindowWidth; ///< The width of the window - int mWindowHeight; ///< The height of the window - int mNativeWindowId; ///< The Native Window Id + int mRotationAngle; ///< The angle of the rotation + int mWindowWidth; ///< The width of the window + int mWindowHeight; ///< The height of the window + int mNativeWindowId; ///< The Native Window Id EventHandlerPtr mEventHandler; ///< The window events handler OrientationMode mOrientationMode; ///< The physical screen mode is portrait or landscape @@ -856,7 +866,7 @@ private: bool mOpaqueState : 1; bool mWindowRotationAcknowledgement : 1; bool mFocused : 1; - bool mIsWindowRotating : 1; ///< The window rotating flag. + bool mIsWindowRotating : 1; ///< The window rotating flag. bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag. }; diff --git a/dali/public-api/adaptor-framework/window.cpp b/dali/public-api/adaptor-framework/window.cpp index 5e49474..069b57e 100644 --- a/dali/public-api/adaptor-framework/window.cpp +++ b/dali/public-api/adaptor-framework/window.cpp @@ -344,6 +344,16 @@ void Window::KeepRendering(float durationSeconds) GetImplementation(*this).KeepRendering(durationSeconds); } +void Window::SetPartialUpdateEnabled(bool enabled) +{ + GetImplementation(*this).SetPartialUpdateEnabled(enabled); +} + +bool Window::IsPartialUpdateEnabled() const +{ + return GetImplementation(*this).IsPartialUpdateEnabled(); +} + Window::KeyEventSignalType& Window::KeyEventSignal() { return GetImplementation(*this).KeyEventSignal(); diff --git a/dali/public-api/adaptor-framework/window.h b/dali/public-api/adaptor-framework/window.h index c66abe4..64d191a 100644 --- a/dali/public-api/adaptor-framework/window.h +++ b/dali/public-api/adaptor-framework/window.h @@ -581,7 +581,7 @@ public: RenderTaskList GetRenderTaskList(); /** - * @brief Keep rendering for at least the given amount of time. + * @brief Keeps rendering for at least the given amount of time. * * By default, Dali will stop rendering when no Actor positions are being set, and when no animations are running etc. * This method is useful to force screen refreshes. @@ -591,6 +591,24 @@ public: */ void KeepRendering(float durationSeconds); + /** + * @brief Sets whether the window will update partial area or full area. + * + * @SINCE_2_2.33 + * @param[in] enabled True if the window should update partial area + * @note This doesn't change the global value which is set by the environment variable. + * This works when partial update is enabled by the environment variable. If the partial update is disabled by the environment variable, it changes nothing. + */ + void SetPartialUpdateEnabled(bool enabled); + + /** + * @brief Queries whether the window will update partial area. + * + * @SINCE_2_2.33 + * @return True if the window should update partial area + */ + bool IsPartialUpdateEnabled() const; + public: // Signals /** * @brief The user should connect to this signal to get a timing when window gains focus or loses focus.