From 1b05937f81661c41db0c26a55011d316bc461b47 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 27 Apr 2020 12:55:28 +0900 Subject: [PATCH 01/16] DALi Version 1.5.9 Change-Id: I06066578477de54f63d067cd16ce2ba1f384579b --- dali/public-api/dali-adaptor-version.cpp | 2 +- packaging/dali-adaptor.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index d5c97a2..e4a7e7e 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int ADAPTOR_MAJOR_VERSION = 1; const unsigned int ADAPTOR_MINOR_VERSION = 5; -const unsigned int ADAPTOR_MICRO_VERSION = 8; +const unsigned int ADAPTOR_MICRO_VERSION = 9; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 879b25c..7bfdf6e 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.5.8 +Version: 1.5.9 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From d25af24c1a49084f60d79181a9b4d304ce5579f9 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Fri, 27 Mar 2020 15:06:31 +0900 Subject: [PATCH 02/16] Make Capture api common. - Current implementation, Capture can be used only in the wearable profile Change-Id: I269e5e5b604b6deba97980ce53493fd0ae9039c0 Signed-off-by: Seungho, Baek --- build/tizen/profiles/wearable-profile.cmake | 1 + .../capture-impl.cpp} | 76 +++------------------- .../tizen-wearable => common}/capture-impl.h | 30 +-------- dali/internal/system/file.list | 10 +-- .../capture}/capture.cpp | 2 +- dali/public-api/capture/capture.h | 4 +- dali/public-api/file.list | 64 +++++++++--------- 7 files changed, 47 insertions(+), 140 deletions(-) rename dali/internal/system/{tizen-wayland/tizen-wearable/capture-impl-tizen.cpp => common/capture-impl.cpp} (79%) mode change 100755 => 100644 rename dali/internal/system/{tizen-wayland/tizen-wearable => common}/capture-impl.h (90%) mode change 100755 => 100644 rename dali/{internal/system/tizen-wayland/tizen-wearable => public-api/capture}/capture.cpp (96%) diff --git a/build/tizen/profiles/wearable-profile.cmake b/build/tizen/profiles/wearable-profile.cmake index 8488967..3682664 100644 --- a/build/tizen/profiles/wearable-profile.cmake +++ b/build/tizen/profiles/wearable-profile.cmake @@ -30,6 +30,7 @@ SET( SOURCES ${adaptor_styling_common_src_files} ${adaptor_system_common_src_files} ${adaptor_system_linux_src_files} + ${adaptor_system_tizen_wayland_src_files} ${adaptor_system_tizen_wearable_src_files} ${adaptor_text_common_src_files} ${adaptor_resampler_src_files} diff --git a/dali/internal/system/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp b/dali/internal/system/common/capture-impl.cpp old mode 100755 new mode 100644 similarity index 79% rename from dali/internal/system/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp rename to dali/internal/system/common/capture-impl.cpp index 0c9487e..1ba6f58 --- a/dali/internal/system/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp +++ b/dali/internal/system/common/capture-impl.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include @@ -46,8 +46,7 @@ namespace Adaptor Capture::Capture() : mTimer(), mPath(), - mNativeImageSourcePtr( NULL ), - mTbmSurface( NULL ) + mNativeImageSourcePtr( NULL ) { } @@ -55,13 +54,13 @@ Capture::Capture( Dali::CameraActor cameraActor ) : mCameraActor( cameraActor ), mTimer(), mPath(), - mNativeImageSourcePtr( NULL ), - mTbmSurface( NULL ) + mNativeImageSourcePtr( NULL ) { } Capture::~Capture() { + DeleteNativeImageSource(); } CapturePtr Capture::New() @@ -98,62 +97,16 @@ Dali::Capture::CaptureFinishedSignalType& Capture::FinishedSignal() return mFinishedSignal; } -void Capture::CreateSurface( const Vector2& size ) -{ - DALI_ASSERT_ALWAYS(!mTbmSurface && "mTbmSurface is already created."); - - mTbmSurface = tbm_surface_create( size.width, size.height, TBM_FORMAT_RGBA8888 ); -} - -void Capture::DeleteSurface() -{ - DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty."); - - tbm_surface_destroy( mTbmSurface ); - mTbmSurface = NULL; -} - -void Capture::ClearSurface( const Vector2& size ) -{ - DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty."); - - tbm_surface_info_s surface_info; - - if( tbm_surface_map( mTbmSurface, TBM_SURF_OPTION_WRITE, &surface_info ) == TBM_SURFACE_ERROR_NONE ) - { - //DALI_ASSERT_ALWAYS(surface_info.bpp == 32 && "unsupported tbm format"); - - unsigned char* ptr = surface_info.planes[0].ptr; - memset( ptr, 0, surface_info.size ); // TODO: support color - - if( tbm_surface_unmap( mTbmSurface ) != TBM_SURFACE_ERROR_NONE ) - { - DALI_LOG_ERROR( "Fail to unmap tbm_surface\n" ); - } - } - else - { - DALI_ASSERT_ALWAYS(0 && "tbm_surface_map failed"); - } -} - -bool Capture::IsSurfaceCreated() -{ - return mTbmSurface != 0; -} - -void Capture::CreateNativeImageSource() +void Capture::CreateNativeImageSource( const Vector2& size ) { Dali::Adaptor& adaptor = Dali::Adaptor::Get(); DALI_ASSERT_ALWAYS(adaptor.IsAvailable() && "Dali::Adaptor is not available."); - DALI_ASSERT_ALWAYS(mTbmSurface && "mTbmSurface is empty."); - DALI_ASSERT_ALWAYS(!mNativeImageSourcePtr && "NativeImageSource is already created."); // create the NativeImageSource object with our surface - mNativeImageSourcePtr = Dali::NativeImageSource::New( mTbmSurface ); + mNativeImageSourcePtr = Dali::NativeImageSource::New( size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT ); } void Capture::DeleteNativeImageSource() @@ -277,10 +230,7 @@ bool Capture::IsRenderTaskSetup() void Capture::SetupResources( const Dali::Vector2& size, const Dali::Vector4& clearColor, Dali::Actor source ) { - CreateSurface( size ); - ClearSurface( size ); - - CreateNativeImageSource(); + CreateNativeImageSource( size ); CreateFrameBuffer(); @@ -298,16 +248,6 @@ void Capture::UnsetResources() { DeleteFrameBuffer(); } - - if( IsNativeImageSourceCreated() ) - { - DeleteNativeImageSource(); - } - - if( IsSurfaceCreated() ) - { - DeleteSurface(); - } } void Capture::OnRenderFinished( Dali::RenderTask& task ) @@ -319,7 +259,7 @@ void Capture::OnRenderFinished( Dali::RenderTask& task ) if( !Save() ) { state = Dali::Capture::FinishState::FAILED; - DALI_LOG_ERROR("Fail to Capture mTbmSurface[%p] Path[%s]", mTbmSurface, mPath.c_str()); + DALI_LOG_ERROR("Fail to Capture Path[%s]", mPath.c_str()); } Dali::Capture handle( this ); diff --git a/dali/internal/system/tizen-wayland/tizen-wearable/capture-impl.h b/dali/internal/system/common/capture-impl.h old mode 100755 new mode 100644 similarity index 90% rename from dali/internal/system/tizen-wayland/tizen-wearable/capture-impl.h rename to dali/internal/system/common/capture-impl.h index 4eae7f6..69d97e2 --- a/dali/internal/system/tizen-wayland/tizen-wearable/capture-impl.h +++ b/dali/internal/system/common/capture-impl.h @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include #include @@ -85,35 +84,9 @@ protected: private: /** - * @brief Create surface. - * - * @param[in] size of surface. - */ - void CreateSurface( const Dali::Vector2& size ); - - /** - * @brief Delete surface. - */ - void DeleteSurface(); - - /** - * @brief Clear surface with color. - * - * @param[in] size of clear aread. - */ - void ClearSurface( const Dali::Vector2& size ); - - /** - * @brief Query whether surface is created or not. - * - * @return True is surface is created. - */ - bool IsSurfaceCreated(); - - /** * @brief Create native image source. */ - void CreateNativeImageSource(); + void CreateNativeImageSource( const Dali::Vector2& size ); /** * @brief Delete native image source. @@ -218,7 +191,6 @@ private: Dali::Capture::CaptureFinishedSignalType mFinishedSignal; std::string mPath; Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image - tbm_surface_h mTbmSurface; }; } // End of namespace Adaptor diff --git a/dali/internal/system/file.list b/dali/internal/system/file.list index 3c5be55..42bef31 100644 --- a/dali/internal/system/file.list +++ b/dali/internal/system/file.list @@ -2,6 +2,7 @@ # module: system, backend: common SET( adaptor_system_common_src_files ${adaptor_system_dir}/common/abort-handler.cpp + ${adaptor_system_dir}/common/capture-impl.cpp ${adaptor_system_dir}/common/color-controller-impl.cpp ${adaptor_system_dir}/common/command-line-options.cpp ${adaptor_system_dir}/common/configuration-manager.cpp @@ -50,16 +51,7 @@ SET( adaptor_system_tizen_wayland_src_files # module: system, backend: tizen-wearable SET( adaptor_system_tizen_wearable_src_files - ${adaptor_system_dir}/common/shared-file.cpp - ${adaptor_system_dir}/common/trigger-event.cpp - ${adaptor_system_dir}/common/trigger-event-factory.cpp - ${adaptor_system_dir}/tizen-wayland/logging-tizen.cpp - ${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture.cpp - ${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp ${adaptor_system_dir}/tizen-wayland/tizen-wearable/watch-time.cpp - ${adaptor_system_dir}/tizen-wayland/system-settings-tizen.cpp - ${adaptor_system_dir}/tizen-wayland/widget-application-impl-tizen.cpp - ${adaptor_system_dir}/tizen-wayland/widget-controller-tizen.cpp ) # module: system, backend: ubuntu-x11 diff --git a/dali/internal/system/tizen-wayland/tizen-wearable/capture.cpp b/dali/public-api/capture/capture.cpp similarity index 96% rename from dali/internal/system/tizen-wayland/tizen-wearable/capture.cpp rename to dali/public-api/capture/capture.cpp index 156b206..1cc768c 100644 --- a/dali/internal/system/tizen-wayland/tizen-wearable/capture.cpp +++ b/dali/public-api/capture/capture.cpp @@ -19,7 +19,7 @@ #include // INTERNAL HEADER -#include +#include namespace Dali { diff --git a/dali/public-api/capture/capture.h b/dali/public-api/capture/capture.h index 5119203..c58dd1c 100755 --- a/dali/public-api/capture/capture.h +++ b/dali/public-api/capture/capture.h @@ -2,7 +2,7 @@ #define DALI_CAPTURE_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ class Capture; /** * @brief Capture snapshots the current scene and save as a file. * - * @SINCE_1_3_4 + * @SINCE_1_3.4 * * Applications should follow the example below to create capture : * diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 219b9c4..71866f1 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -1,55 +1,57 @@ SET( adaptor_public_api_src_files - ${adaptor_public_api_dir}/adaptor-framework/application.cpp - ${adaptor_public_api_dir}/adaptor-framework/key.cpp - ${adaptor_public_api_dir}/adaptor-framework/window.cpp - ${adaptor_public_api_dir}/adaptor-framework/timer.cpp - ${adaptor_public_api_dir}/adaptor-framework/tts-player.cpp - ${adaptor_public_api_dir}/adaptor-framework/native-image-source.cpp - ${adaptor_public_api_dir}/adaptor-framework/widget.cpp - ${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp - ${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp + ${adaptor_public_api_dir}/adaptor-framework/application.cpp + ${adaptor_public_api_dir}/adaptor-framework/key.cpp + ${adaptor_public_api_dir}/adaptor-framework/window.cpp + ${adaptor_public_api_dir}/adaptor-framework/timer.cpp + ${adaptor_public_api_dir}/adaptor-framework/tts-player.cpp + ${adaptor_public_api_dir}/adaptor-framework/native-image-source.cpp + ${adaptor_public_api_dir}/adaptor-framework/widget.cpp + ${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp + ${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp + ${adaptor_public_api_dir}/capture/capture.cpp ${adaptor_public_api_dir}/dali-adaptor-version.cpp ) SET( public_api_header_files - ${adaptor_public_api_dir}/dali-adaptor-version.h + ${adaptor_public_api_dir}/dali-adaptor-version.h ${adaptor_public_api_dir}/dali-adaptor-common.h ) SET( public_api_adaptor_framework_header_files - ${adaptor_public_api_dir}/adaptor-framework/application.h - ${adaptor_public_api_dir}/adaptor-framework/application-configuration.h - ${adaptor_public_api_dir}/adaptor-framework/device-status.h - ${adaptor_public_api_dir}/adaptor-framework/input-method.h - ${adaptor_public_api_dir}/adaptor-framework/key.h - ${adaptor_public_api_dir}/adaptor-framework/key-grab.h - ${adaptor_public_api_dir}/adaptor-framework/style-change.h - ${adaptor_public_api_dir}/adaptor-framework/timer.h - ${adaptor_public_api_dir}/adaptor-framework/tts-player.h - ${adaptor_public_api_dir}/adaptor-framework/native-image-source.h - ${adaptor_public_api_dir}/adaptor-framework/window.h - ${adaptor_public_api_dir}/adaptor-framework/widget.h - ${adaptor_public_api_dir}/adaptor-framework/widget-application.h + ${adaptor_public_api_dir}/adaptor-framework/application.h + ${adaptor_public_api_dir}/adaptor-framework/application-configuration.h + ${adaptor_public_api_dir}/adaptor-framework/device-status.h + ${adaptor_public_api_dir}/adaptor-framework/input-method.h + ${adaptor_public_api_dir}/adaptor-framework/key.h + ${adaptor_public_api_dir}/adaptor-framework/key-grab.h + ${adaptor_public_api_dir}/adaptor-framework/style-change.h + ${adaptor_public_api_dir}/adaptor-framework/timer.h + ${adaptor_public_api_dir}/adaptor-framework/tts-player.h + ${adaptor_public_api_dir}/adaptor-framework/native-image-source.h + ${adaptor_public_api_dir}/adaptor-framework/window.h + ${adaptor_public_api_dir}/adaptor-framework/widget.h + ${adaptor_public_api_dir}/adaptor-framework/widget-application.h ${adaptor_public_api_dir}/adaptor-framework/widget-impl.h ) + +SET( public_dali_capture_header_files + ${adaptor_public_api_dir}/capture/capture.h +) + + # wearable and watch extra public headers SET( adaptor_dali_wearable_header_file ${adaptor_public_api_dir}/watch/dali-wearable.h ) + # wearable and watch extra public headers SET( public_dali_watch_header_files - ${adaptor_public_api_dir}/watch/watch-application.h + ${adaptor_public_api_dir}/watch/watch-application.h ${adaptor_public_api_dir}/watch/watch-time.h -) - -# wearable and watch extra public headers -SET( public_dali_capture_header_files - ${adaptor_public_api_dir}/capture/capture.h -) - +) \ No newline at end of file -- 2.7.4 From adaaa8ab9167fa63ffae1005969bfc745985cac1 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Mon, 6 Apr 2020 14:00:21 +0900 Subject: [PATCH 03/16] Make capture return Buffer. - If developer want to use saved buffer, Dali::Capture can return it. Change-Id: I03213cec5e54edf8f0e79f00e02a77f70fe16e51 Signed-off-by: Seungho, Baek --- dali/internal/system/common/capture-impl.cpp | 30 +++++++++++++++++++++------- dali/internal/system/common/capture-impl.h | 10 ++++++++-- dali/public-api/capture/capture.cpp | 7 ++++++- dali/public-api/capture/capture.h | 8 ++++++++ 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/dali/internal/system/common/capture-impl.cpp b/dali/internal/system/common/capture-impl.cpp index 1ba6f58..8dc77b9 100644 --- a/dali/internal/system/common/capture-impl.cpp +++ b/dali/internal/system/common/capture-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,8 @@ namespace Adaptor Capture::Capture() : mTimer(), mPath(), - mNativeImageSourcePtr( NULL ) + mNativeImageSourcePtr( NULL ), + mFileSave( false ) { } @@ -54,7 +55,8 @@ Capture::Capture( Dali::CameraActor cameraActor ) : mCameraActor( cameraActor ), mTimer(), mPath(), - mNativeImageSourcePtr( NULL ) + mNativeImageSourcePtr( NULL ), + mFileSave( false ) { } @@ -85,6 +87,10 @@ void Capture::Start( Dali::Actor source, const Dali::Vector2& size, const std::s Reference(); mPath = path; + if( mPath.size() > 0 ) + { + mFileSave = true; + } DALI_ASSERT_ALWAYS(source && "Source is NULL."); @@ -92,6 +98,13 @@ void Capture::Start( Dali::Actor source, const Dali::Vector2& size, const std::s SetupResources( size, clearColor, source ); } +Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const +{ + DALI_ASSERT_ALWAYS( mNativeImageSourcePtr && "mNativeImageSourcePtr is NULL."); + + return mNativeImageSourcePtr; +} + Dali::Capture::CaptureFinishedSignalType& Capture::FinishedSignal() { return mFinishedSignal; @@ -256,10 +269,13 @@ void Capture::OnRenderFinished( Dali::RenderTask& task ) mTimer.Stop(); - if( !Save() ) + if( mFileSave ) { - state = Dali::Capture::FinishState::FAILED; - DALI_LOG_ERROR("Fail to Capture Path[%s]", mPath.c_str()); + if( !SaveFile() ) + { + state = Dali::Capture::FinishState::FAILED; + DALI_LOG_ERROR( "Fail to Capture Path[%s]", mPath.c_str() ); + } } Dali::Capture handle( this ); @@ -286,7 +302,7 @@ bool Capture::OnTimeOut() return false; } -bool Capture::Save() +bool Capture::SaveFile() { DALI_ASSERT_ALWAYS(mNativeImageSourcePtr && "mNativeImageSourcePtr is NULL"); diff --git a/dali/internal/system/common/capture-impl.h b/dali/internal/system/common/capture-impl.h index 69d97e2..61e116a 100644 --- a/dali/internal/system/common/capture-impl.h +++ b/dali/internal/system/common/capture-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_CAPTURE_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,6 +71,11 @@ public: void Start( Dali::Actor source, const Dali::Vector2& size, const std::string &path, const Dali::Vector4& clearColor ); /** + * @copydoc Dali::Capture::GetNativeImageSource + */ + Dali::NativeImageSourcePtr GetNativeImageSource() const; + + /** * @copydoc Dali::Capture::FinishedSignal */ Dali::Capture::CaptureFinishedSignalType& FinishedSignal(); @@ -170,7 +175,7 @@ private: * * @return True is success to save, false is fail. */ - bool Save(); + bool SaveFile(); private: @@ -191,6 +196,7 @@ private: Dali::Capture::CaptureFinishedSignalType mFinishedSignal; std::string mPath; Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image + bool mFileSave; }; } // End of namespace Adaptor diff --git a/dali/public-api/capture/capture.cpp b/dali/public-api/capture/capture.cpp index 1cc768c..701db7d 100644 --- a/dali/public-api/capture/capture.cpp +++ b/dali/public-api/capture/capture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,6 +72,11 @@ void Capture::Start( Actor source, const Vector2& size, const std::string &path GetImpl( *this ).Start( source, size, path, Dali::Color::TRANSPARENT ); } +Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const +{ + return GetImpl( *this ).GetNativeImageSource(); +} + Capture::CaptureFinishedSignalType& Capture::FinishedSignal() { return GetImpl( *this ).FinishedSignal(); diff --git a/dali/public-api/capture/capture.h b/dali/public-api/capture/capture.h index c58dd1c..c1696f3 100755 --- a/dali/public-api/capture/capture.h +++ b/dali/public-api/capture/capture.h @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -192,6 +193,13 @@ public: void Start( Actor source, const Vector2& size, const std::string &path ); /** + * @brief Get NativeImageSourcePtr that is saved captured image. + * + * @SINCE_1_5_10 + */ + Dali::NativeImageSourcePtr GetNativeImageSource() const; + + /** * @brief Get finished signal. * * @SINCE_1_3_4 -- 2.7.4 From 476863fdf73040633854171723db3fa71bdb9b1a Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 6 May 2020 16:26:11 +0900 Subject: [PATCH 04/16] DALi Version 1.5.10 Change-Id: I40c566a6d9568f566f1b3819c59b0c1c24f7c552 --- dali/public-api/dali-adaptor-version.cpp | 2 +- packaging/dali-adaptor.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index e4a7e7e..1b2c65c 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int ADAPTOR_MAJOR_VERSION = 1; const unsigned int ADAPTOR_MINOR_VERSION = 5; -const unsigned int ADAPTOR_MICRO_VERSION = 9; +const unsigned int ADAPTOR_MICRO_VERSION = 10; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 7bfdf6e..7d218ed 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.5.9 +Version: 1.5.10 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From d9a356affd1eaa873d3c7e4d39e7ecf50eef13bd Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 30 Dec 2019 14:11:18 +0900 Subject: [PATCH 05/16] Add a method to NativeImageSourceQueue There is a case not to show an image which is enqueued previously. So added a method to ignore a source buffer Change-Id: I571af6aff235955d441eef644300033d888003f5 --- .../adaptor-framework/native-image-source-queue.cpp | 5 +++++ .../adaptor-framework/native-image-source-queue.h | 7 +++++++ .../native-image-source-queue-impl-android.cpp | 4 ++++ .../android/native-image-source-queue-impl-android.h | 5 +++++ .../imaging/common/native-image-source-queue-impl.h | 5 +++++ .../tizen/native-image-source-queue-impl-tizen.cpp | 20 ++++++++++++++++++++ .../tizen/native-image-source-queue-impl-tizen.h | 5 +++++ .../ubuntu-x11/native-image-source-queue-impl-x.cpp | 4 ++++ .../ubuntu-x11/native-image-source-queue-impl-x.h | 5 +++++ 9 files changed, 60 insertions(+) diff --git a/dali/devel-api/adaptor-framework/native-image-source-queue.cpp b/dali/devel-api/adaptor-framework/native-image-source-queue.cpp index 297fd2a..acb10d5 100755 --- a/dali/devel-api/adaptor-framework/native-image-source-queue.cpp +++ b/dali/devel-api/adaptor-framework/native-image-source-queue.cpp @@ -56,6 +56,11 @@ void NativeImageSourceQueue::SetSize( uint32_t width, uint32_t height ) return mImpl->SetSize( width, height ); } +void NativeImageSourceQueue::IgnoreSourceImage() +{ + mImpl->IgnoreSourceImage(); +} + bool NativeImageSourceQueue::GlExtensionCreate() { return mImpl->GlExtensionCreate(); diff --git a/dali/devel-api/adaptor-framework/native-image-source-queue.h b/dali/devel-api/adaptor-framework/native-image-source-queue.h index 32b08c3..0e02903 100755 --- a/dali/devel-api/adaptor-framework/native-image-source-queue.h +++ b/dali/devel-api/adaptor-framework/native-image-source-queue.h @@ -104,6 +104,13 @@ public: */ void SetSize( uint32_t width, uint32_t height ); + /** + * @brief Ignores a source image which is inserted to the queue. + * + * @note This can be called from worker threads. + */ + void IgnoreSourceImage(); + private: // native image /** diff --git a/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp b/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp index 7043979..45905bd 100644 --- a/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-queue-impl-android.cpp @@ -72,6 +72,10 @@ void NativeImageSourceQueueAndroid::SetSize( uint32_t width, uint32_t height ) mHeight = height; } +void NativeImageSourceQueueAndroid::IgnoreSourceImage() +{ +} + bool NativeImageSourceQueueAndroid::GlExtensionCreate() { return true; diff --git a/dali/internal/imaging/android/native-image-source-queue-impl-android.h b/dali/internal/imaging/android/native-image-source-queue-impl-android.h index e1cb045..be5b8b6 100644 --- a/dali/internal/imaging/android/native-image-source-queue-impl-android.h +++ b/dali/internal/imaging/android/native-image-source-queue-impl-android.h @@ -65,6 +65,11 @@ public: void SetSize( uint32_t width, uint32_t height ) override; /** + * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage + */ + void IgnoreSourceImage() override; + + /** * destructor */ ~NativeImageSourceQueueAndroid() override; diff --git a/dali/internal/imaging/common/native-image-source-queue-impl.h b/dali/internal/imaging/common/native-image-source-queue-impl.h index 889935e..eeb87f2 100755 --- a/dali/internal/imaging/common/native-image-source-queue-impl.h +++ b/dali/internal/imaging/common/native-image-source-queue-impl.h @@ -53,6 +53,11 @@ public: virtual void SetSize( uint32_t width, uint32_t height ) = 0; /** + * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage + */ + virtual void IgnoreSourceImage() = 0; + + /** * destructor */ virtual ~NativeImageSourceQueue() = default; diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp index e7fa554..f95ee1a 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp @@ -189,6 +189,26 @@ void NativeImageSourceQueueTizen::SetSize( uint32_t width, uint32_t height ) ResetEglImageList(); } +void NativeImageSourceQueueTizen::IgnoreSourceImage() +{ + Dali::Mutex::ScopedLock lock( mMutex ); + tbm_surface_h surface; + + if( tbm_surface_queue_can_acquire( mTbmQueue, 0 ) ) + { + if( tbm_surface_queue_acquire( mTbmQueue, &surface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) + { + DALI_LOG_ERROR( "NativeImageSourceQueueTizen::IgnoreSourceImage: Failed to aquire a tbm_surface\n" ); + return; + } + + if( tbm_surface_internal_is_valid( surface ) ) + { + tbm_surface_queue_release( mTbmQueue, surface ); + } + } +} + bool NativeImageSourceQueueTizen::GlExtensionCreate() { mEglImageExtensions = mEglGraphics->GetImageExtensions(); diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h index 88b27cb..7f16352 100755 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h @@ -69,6 +69,11 @@ public: void SetSize( uint32_t width, uint32_t height ) override; /** + * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage + */ + void IgnoreSourceImage() override; + + /** * destructor */ ~NativeImageSourceQueueTizen() override; diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp index 4bd539b..6488487 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp @@ -73,6 +73,10 @@ void NativeImageSourceQueueX::SetSize( uint32_t width, uint32_t height ) mHeight = height; } +void NativeImageSourceQueueX::IgnoreSourceImage() +{ +} + bool NativeImageSourceQueueX::GlExtensionCreate() { return true; diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h index c252bec..689f733 100755 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h @@ -65,6 +65,11 @@ public: void SetSize( uint32_t width, uint32_t height ) override; /** + * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage + */ + void IgnoreSourceImage() override; + + /** * destructor */ ~NativeImageSourceQueueX() override; -- 2.7.4 From 7d385ea9c1b7ca1df11dafebb2ba4919fb5b65d6 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 30 Dec 2019 14:13:47 +0900 Subject: [PATCH 06/16] (Vector) Add a method to ignore a rendered frame Change-Id: I6f8fdcb4a913e3439b45c13def5f6570a82dda74 --- .../adaptor-framework/vector-animation-renderer-plugin.h | 5 +++++ dali/devel-api/adaptor-framework/vector-animation-renderer.cpp | 5 +++++ dali/devel-api/adaptor-framework/vector-animation-renderer.h | 5 +++++ .../vector-animation/common/vector-animation-renderer-impl.cpp | 5 +++++ .../vector-animation/common/vector-animation-renderer-impl.h | 5 +++++ .../common/vector-animation-renderer-plugin-proxy.cpp | 8 ++++++++ .../common/vector-animation-renderer-plugin-proxy.h | 5 +++++ 7 files changed, 38 insertions(+) diff --git a/dali/devel-api/adaptor-framework/vector-animation-renderer-plugin.h b/dali/devel-api/adaptor-framework/vector-animation-renderer-plugin.h index c7b0011..d262cfc 100644 --- a/dali/devel-api/adaptor-framework/vector-animation-renderer-plugin.h +++ b/dali/devel-api/adaptor-framework/vector-animation-renderer-plugin.h @@ -129,6 +129,11 @@ public: virtual bool GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const = 0; /** + * @brief Ignores a rendered frame which is not shown yet. + */ + virtual void IgnoreRenderedFrame() = 0; + + /** * @brief Connect to this signal to be notified when the texture upload is completed. * * @return The signal to connect to. diff --git a/dali/devel-api/adaptor-framework/vector-animation-renderer.cpp b/dali/devel-api/adaptor-framework/vector-animation-renderer.cpp index 9cd05ad..d06aac5 100755 --- a/dali/devel-api/adaptor-framework/vector-animation-renderer.cpp +++ b/dali/devel-api/adaptor-framework/vector-animation-renderer.cpp @@ -104,6 +104,11 @@ bool VectorAnimationRenderer::GetMarkerInfo( const std::string& marker, uint32_t return GetImplementation( *this ).GetMarkerInfo( marker, startFrame, endFrame ); } +void VectorAnimationRenderer::IgnoreRenderedFrame() +{ + GetImplementation( *this ).IgnoreRenderedFrame(); +} + VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal() { return GetImplementation( *this ).UploadCompletedSignal(); diff --git a/dali/devel-api/adaptor-framework/vector-animation-renderer.h b/dali/devel-api/adaptor-framework/vector-animation-renderer.h index 0e2f14a..666f746 100755 --- a/dali/devel-api/adaptor-framework/vector-animation-renderer.h +++ b/dali/devel-api/adaptor-framework/vector-animation-renderer.h @@ -156,6 +156,11 @@ public: */ bool GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const; + /** + * @brief Ignores a rendered frame which is not shown yet. + */ + void IgnoreRenderedFrame(); + public: // Signals /** diff --git a/dali/internal/vector-animation/common/vector-animation-renderer-impl.cpp b/dali/internal/vector-animation/common/vector-animation-renderer-impl.cpp index 1b76ff3..9b1c9da 100644 --- a/dali/internal/vector-animation/common/vector-animation-renderer-impl.cpp +++ b/dali/internal/vector-animation/common/vector-animation-renderer-impl.cpp @@ -110,6 +110,11 @@ bool VectorAnimationRenderer::GetMarkerInfo( const std::string& marker, uint32_t return mPlugin.GetMarkerInfo( marker, startFrame, endFrame ); } +void VectorAnimationRenderer::IgnoreRenderedFrame() +{ + mPlugin.IgnoreRenderedFrame(); +} + Dali::VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal() { return mPlugin.UploadCompletedSignal(); diff --git a/dali/internal/vector-animation/common/vector-animation-renderer-impl.h b/dali/internal/vector-animation/common/vector-animation-renderer-impl.h index b635683..0d2a428 100755 --- a/dali/internal/vector-animation/common/vector-animation-renderer-impl.h +++ b/dali/internal/vector-animation/common/vector-animation-renderer-impl.h @@ -102,6 +102,11 @@ public: bool GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const; /** + * @copydoc Dali::VectorAnimationRenderer::IgnoreRenderedFrame() + */ + void IgnoreRenderedFrame(); + + /** * @copydoc Dali::VectorAnimationRenderer::UploadCompletedSignal() */ Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal(); diff --git a/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.cpp b/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.cpp index 6eae9bf..2a272c4 100644 --- a/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.cpp +++ b/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.cpp @@ -186,6 +186,14 @@ bool VectorAnimationRendererPluginProxy::GetMarkerInfo( const std::string& marke return false; } +void VectorAnimationRendererPluginProxy::IgnoreRenderedFrame() +{ + if( mPlugin ) + { + mPlugin->IgnoreRenderedFrame(); + } +} + VectorAnimationRendererPlugin::UploadCompletedSignalType& VectorAnimationRendererPluginProxy::UploadCompletedSignal() { if( mPlugin ) diff --git a/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h b/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h index 1480aca..d63faa3 100644 --- a/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h +++ b/dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h @@ -98,6 +98,11 @@ public: bool GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const; /** + * @copydoc Dali::VectorAnimationRendererPlugin::IgnoreRenderedFrame() + */ + void IgnoreRenderedFrame(); + + /** * @copydoc Dali::VectorAnimationRendererPlugin::UploadCompletedSignal() */ VectorAnimationRendererPlugin::UploadCompletedSignalType& UploadCompletedSignal(); -- 2.7.4 From f2a4ba7cc5b81699949218e352d88dd071e48f0a Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Fri, 10 Apr 2020 21:52:56 +0900 Subject: [PATCH 07/16] To set saved jpeg image quality of Capture - Adds parameter at the Capture::Start to control saved jpeg quality Change-Id: I9b0edc0e22e77672a7acf460303585ee4ebcdc3b Signed-off-by: Seungho, Baek --- dali/devel-api/adaptor-framework/bitmap-saver.cpp | 19 +++++++--- dali/devel-api/adaptor-framework/bitmap-saver.h | 25 ++++++++++++- .../native-image-source-devel.cpp | 5 +++ .../adaptor-framework/native-image-source-devel.h | 13 +++++++ .../android/native-image-source-impl-android.cpp | 14 -------- .../android/native-image-source-impl-android.h | 7 +--- .../imaging/common/native-image-source-impl.h | 41 ++++++++++++++++++---- .../tizen/native-image-source-impl-tizen.cpp | 24 +++---------- .../imaging/tizen/native-image-source-impl-tizen.h | 9 ++--- .../ubuntu-x11/native-image-source-impl-x.cpp | 14 -------- .../ubuntu-x11/native-image-source-impl-x.h | 7 +--- .../windows/native-image-source-impl-win.cpp | 14 -------- .../imaging/windows/native-image-source-impl-win.h | 7 +--- dali/internal/system/common/capture-impl.cpp | 15 ++++++-- dali/internal/system/common/capture-impl.h | 9 +++++ .../adaptor-framework/native-image-source.cpp | 4 +-- dali/public-api/capture/capture.cpp | 5 +++ dali/public-api/capture/capture.h | 15 +++++++- 18 files changed, 143 insertions(+), 104 deletions(-) diff --git a/dali/devel-api/adaptor-framework/bitmap-saver.cpp b/dali/devel-api/adaptor-framework/bitmap-saver.cpp index c39bb70..68adfc7 100644 --- a/dali/devel-api/adaptor-framework/bitmap-saver.cpp +++ b/dali/devel-api/adaptor-framework/bitmap-saver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,13 +91,14 @@ bool EncodeToFormat( const unsigned char* pixelBuffer, FileFormat formatEncoding, std::size_t width, std::size_t height, - Pixel::Format pixelFormat ) + Pixel::Format pixelFormat, + const uint32_t quality ) { switch( formatEncoding ) { case JPG_FORMAT: { - return TizenPlatform::EncodeToJpeg( pixelBuffer, encodedPixels, width, height, pixelFormat ); + return TizenPlatform::EncodeToJpeg( pixelBuffer, encodedPixels, width, height, pixelFormat, quality ); break; } case PNG_FORMAT: @@ -122,10 +123,20 @@ bool EncodeToFile(const unsigned char* const pixelBuffer, const std::size_t width, const std::size_t height ) { + return EncodeToFile( pixelBuffer, filename, pixelFormat, width, height, DEFAULT_JPG_QUALITY ); +} + +bool EncodeToFile(const unsigned char* const pixelBuffer, + const std::string& filename, + const Pixel::Format pixelFormat, + const std::size_t width, + const std::size_t height, + const uint32_t quality ) +{ DALI_ASSERT_DEBUG(pixelBuffer != 0 && filename.size() > 4 && width > 0 && height > 0); Vector< unsigned char > pixbufEncoded; const FileFormat format = GetFormatFromFileName( filename ); - const bool encodeResult = EncodeToFormat( pixelBuffer, pixbufEncoded, format, width, height, pixelFormat ); + const bool encodeResult = EncodeToFormat( pixelBuffer, pixbufEncoded, format, width, height, pixelFormat, quality ); if(!encodeResult) { DALI_LOG_ERROR("Encoding pixels failed\n"); diff --git a/dali/devel-api/adaptor-framework/bitmap-saver.h b/dali/devel-api/adaptor-framework/bitmap-saver.h index e1f6ab7..1a5a8b1 100755 --- a/dali/devel-api/adaptor-framework/bitmap-saver.h +++ b/dali/devel-api/adaptor-framework/bitmap-saver.h @@ -2,7 +2,7 @@ #define DALI_ADAPTOR_BITMAP_SAVER_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,8 @@ namespace Dali { +static constexpr uint32_t DEFAULT_JPG_QUALITY = 100; + /** * Store the given pixel data to a file. * The suffix of the filename determines what type of file will be stored, @@ -46,6 +48,27 @@ DALI_ADAPTOR_API bool EncodeToFile(const unsigned char* const pixelBuffer, const std::size_t width, const std::size_t height); +/** + * Store the given pixel data to a file. + * The suffix of the filename determines what type of file will be stored, + * currently only jpeg and png formats are supported. + * + * @param[in] pixelBuffer Pointer to the pixel data + * @param[in] filename Filename to save + * @param[in] pixelFormat The format of the buffer's pixels + * @param[in] width The width of the image in pixels + * @param[in] height The height of the image in pixels + * @param[in] quality The value to control image quality for jpeg file format in the range [1, 100] + * + * @return true if the file was saved + */ +DALI_ADAPTOR_API bool EncodeToFile(const unsigned char* const pixelBuffer, + const std::string& filename, + const Pixel::Format pixelFormat, + const std::size_t width, + const std::size_t height, + const uint32_t quality); + } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/native-image-source-devel.cpp b/dali/devel-api/adaptor-framework/native-image-source-devel.cpp index 3072690..3250d44 100755 --- a/dali/devel-api/adaptor-framework/native-image-source-devel.cpp +++ b/dali/devel-api/adaptor-framework/native-image-source-devel.cpp @@ -28,6 +28,11 @@ namespace Dali namespace DevelNativeImageSource { +bool EncodeToFile( NativeImageSource& image, const std::string& filename, const uint32_t quality ) +{ + return Dali::Internal::Adaptor::NativeImageSource::GetImplementation( image ).EncodeToFile( filename, quality ); +} + uint8_t* AcquireBuffer( NativeImageSource& image, uint16_t& width, uint16_t& height, uint16_t& stride ) { return Dali::Internal::Adaptor::NativeImageSource::GetImplementation( image ).AcquireBuffer( width, height, stride ); diff --git a/dali/devel-api/adaptor-framework/native-image-source-devel.h b/dali/devel-api/adaptor-framework/native-image-source-devel.h index 0c470c8..eeea436 100755 --- a/dali/devel-api/adaptor-framework/native-image-source-devel.h +++ b/dali/devel-api/adaptor-framework/native-image-source-devel.h @@ -27,6 +27,19 @@ namespace DevelNativeImageSource { /** + * @brief Converts the current pixel contents to either a JPEG or PNG format + * and write that to the filesystem. + * + * @param[in] image The instance of NativeImageSource. + * @param[in] filename Identify the filesystem location at which to write the encoded image. + * The extension determines the encoding used. + * The two valid encoding are (".jpeg"|".jpg") and ".png". + * @param[in] quality The value to control image quality for jpeg file format in the range [1, 100] + * @return @c true if the pixels were written, and @c false otherwise + */ +DALI_ADAPTOR_API bool EncodeToFile( NativeImageSource& image, const std::string& filename, const uint32_t quality ); + +/** * @brief Acquire buffer and information of an internal native image. * * AcquireBuffer() and ReleaseBuffer() are a pair. diff --git a/dali/internal/imaging/android/native-image-source-impl-android.cpp b/dali/internal/imaging/android/native-image-source-impl-android.cpp index 53fdc8c..19312b5 100755 --- a/dali/internal/imaging/android/native-image-source-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-impl-android.cpp @@ -29,7 +29,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include @@ -191,19 +190,6 @@ bool NativeImageSourceAndroid::GetPixels(std::vector& pixbuf, uns return success; } -bool NativeImageSourceAndroid::EncodeToFile(const std::string& filename) const -{ - std::vector< unsigned char > pixbuf; - unsigned int width(0), height(0); - Pixel::Format pixelFormat; - - if( GetPixels( pixbuf, width, height, pixelFormat ) ) - { - return Dali::EncodeToFile( &pixbuf[0], filename, pixelFormat, width, height ); - } - return false; -} - void NativeImageSourceAndroid::SetSource( Any source ) { if( mPixmap ) diff --git a/dali/internal/imaging/android/native-image-source-impl-android.h b/dali/internal/imaging/android/native-image-source-impl-android.h index 7d941ca..3b68f1c 100755 --- a/dali/internal/imaging/android/native-image-source-impl-android.h +++ b/dali/internal/imaging/android/native-image-source-impl-android.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,11 +69,6 @@ public: bool GetPixels(std::vector &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const override; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - bool EncodeToFile(const std::string& filename) const override; - - /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) */ void SetSource( Any source ) override; diff --git a/dali/internal/imaging/common/native-image-source-impl.h b/dali/internal/imaging/common/native-image-source-impl.h index d5f292f..0833f51 100755 --- a/dali/internal/imaging/common/native-image-source-impl.h +++ b/dali/internal/imaging/common/native-image-source-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -37,6 +38,8 @@ class NativeImageSource { public: + static constexpr uint32_t DEFAULT_QUALITY = 100; + /** * Create a new NativeImageSource internally. * Depending on hardware the width and height may have to be a power of two. @@ -61,11 +64,6 @@ public: virtual bool GetPixels(std::vector &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const = 0; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - virtual bool EncodeToFile(const std::string& filename) const = 0; - - /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) */ virtual void SetSource( Any source ) = 0; @@ -130,6 +128,37 @@ public: */ virtual bool ReleaseBuffer() = 0; + /** + * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) + */ + inline bool EncodeToFile( const std::string& filename ) const + { + return EncodeToFile( filename, DEFAULT_QUALITY ); + } + + /** + * @brief Converts the current pixel contents to either a JPEG or PNG format + * and write that to the filesystem. + * + * @param[in] filename Identify the filesystem location at which to write the encoded image. + * The extension determines the encoding used. + * The two valid encoding are (".jpeg"|".jpg") and ".png". + * @param[in] quality The quality of encoded jpeg image + * @return @c true if the pixels were written, and @c false otherwise + */ + inline bool EncodeToFile( const std::string& filename, const uint32_t quality ) const + { + std::vector< uint8_t > pixbuf; + uint32_t width( 0 ), height( 0 ); + Pixel::Format pixelFormat; + + if( GetPixels( pixbuf, width, height, pixelFormat ) ) + { + return Dali::EncodeToFile( &pixbuf[0], filename, pixelFormat, width, height, quality ); + } + return false; + } + public: inline static Internal::Adaptor::NativeImageSource& GetImplementation( Dali::NativeImageSource& image ) { return *image.mImpl; } }; diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp index 2682522..096944c 100755 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -30,9 +30,6 @@ #include #include -// Allow this to be encoded and saved: -#include - namespace Dali { @@ -301,10 +298,10 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig { cOffset = c*4; offset = cOffset + r*stride; - *(bufptr+cOffset) = ptr[offset]; - *(bufptr+cOffset+1) = ptr[offset+3]; - *(bufptr+cOffset+2) = ptr[offset+2]; - *(bufptr+cOffset+3) = ptr[offset+1]; + *(bufptr+cOffset) = ptr[offset+2]; + *(bufptr+cOffset+1) = ptr[offset+1]; + *(bufptr+cOffset+2) = ptr[offset]; + *(bufptr+cOffset+3) = ptr[offset+3]; } } break; @@ -333,19 +330,6 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig return false; } -bool NativeImageSourceTizen::EncodeToFile(const std::string& filename) const -{ - std::vector< unsigned char > pixbuf; - unsigned int width(0), height(0); - Pixel::Format pixelFormat; - - if(GetPixels(pixbuf, width, height, pixelFormat)) - { - return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height); - } - return false; -} - void NativeImageSourceTizen::SetSource( Any source ) { Dali::Mutex::ScopedLock lock( mMutex ); diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h index d40142c..9264a25 100755 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_TIZEN_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,12 +69,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const override; - - /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - bool EncodeToFile(const std::string& filename) const override; + bool GetPixels(std::vector &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp index 51c89d3..c222d3b 100755 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include namespace Dali @@ -264,19 +263,6 @@ bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& return success; } -bool NativeImageSourceX::EncodeToFile(const std::string& filename) const -{ - std::vector< unsigned char > pixbuf; - unsigned int width(0), height(0); - Pixel::Format pixelFormat; - - if(GetPixels(pixbuf, width, height, pixelFormat)) - { - return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height); - } - return false; -} - void NativeImageSourceX::SetSource( Any source ) { mPixmap = GetPixmapFromAny( source ); diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h index 5306938..1f37eaa 100755 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,11 +69,6 @@ public: bool GetPixels(std::vector &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const override; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - bool EncodeToFile(const std::string& filename) const override; - - /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) */ void SetSource( Any source ) override; diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.cpp b/dali/internal/imaging/windows/native-image-source-impl-win.cpp index 12db4fd..aabcdff 100755 --- a/dali/internal/imaging/windows/native-image-source-impl-win.cpp +++ b/dali/internal/imaging/windows/native-image-source-impl-win.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include namespace Dali @@ -119,19 +118,6 @@ bool NativeImageSourceWin::GetPixels(std::vector& pixbuf, unsigned& wid return success; } -bool NativeImageSourceWin::EncodeToFile(const std::string& filename) const -{ - std::vector< uint8_t > pixbuf; - uint32_t width(0), height(0); - Pixel::Format pixelFormat; - - if(GetPixels(pixbuf, width, height, pixelFormat)) - { - return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height); - } - return false; -} - void NativeImageSourceWin::SetSource( Any source ) { mPixmap = GetPixmapFromAny( source ); diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.h b/dali/internal/imaging/windows/native-image-source-impl-win.h index 6fe3fab..bc2a257 100755 --- a/dali/internal/imaging/windows/native-image-source-impl-win.h +++ b/dali/internal/imaging/windows/native-image-source-impl-win.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,11 +64,6 @@ public: bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const override; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - bool EncodeToFile(const std::string& filename) const override; - - /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) */ void SetSource( Any source ) override; diff --git a/dali/internal/system/common/capture-impl.cpp b/dali/internal/system/common/capture-impl.cpp index 8dc77b9..2724dd2 100644 --- a/dali/internal/system/common/capture-impl.cpp +++ b/dali/internal/system/common/capture-impl.cpp @@ -28,6 +28,7 @@ // INTERNAL INCLUDES #include +#include namespace { @@ -44,7 +45,8 @@ namespace Adaptor { Capture::Capture() -: mTimer(), +: mQuality( DEFAULT_QUALITY ), + mTimer(), mPath(), mNativeImageSourcePtr( NULL ), mFileSave( false ) @@ -52,7 +54,8 @@ Capture::Capture() } Capture::Capture( Dali::CameraActor cameraActor ) -: mCameraActor( cameraActor ), +: mQuality( DEFAULT_QUALITY ), + mCameraActor( cameraActor ), mTimer(), mPath(), mNativeImageSourcePtr( NULL ), @@ -79,6 +82,12 @@ CapturePtr Capture::New( Dali::CameraActor cameraActor ) return pWorker; } +void Capture::Start( Dali::Actor source, const Dali::Vector2& size, const std::string &path, const Dali::Vector4& clearColor, const uint32_t quality ) +{ + mQuality = quality; + Start( source, size, path, clearColor ); +} + void Capture::Start( Dali::Actor source, const Dali::Vector2& size, const std::string &path, const Dali::Vector4& clearColor ) { DALI_ASSERT_ALWAYS(path.size() > 4 && "Path is invalid."); @@ -306,7 +315,7 @@ bool Capture::SaveFile() { DALI_ASSERT_ALWAYS(mNativeImageSourcePtr && "mNativeImageSourcePtr is NULL"); - return mNativeImageSourcePtr->EncodeToFile( mPath ); + return Dali::DevelNativeImageSource::EncodeToFile( *mNativeImageSourcePtr, mPath, mQuality ); } } // End of namespace Adaptor diff --git a/dali/internal/system/common/capture-impl.h b/dali/internal/system/common/capture-impl.h index 61e116a..11c29e9 100644 --- a/dali/internal/system/common/capture-impl.h +++ b/dali/internal/system/common/capture-impl.h @@ -48,6 +48,9 @@ typedef IntrusivePtr CapturePtr; class Capture : public BaseObject, public ConnectionTracker { public: + + static constexpr uint32_t DEFAULT_QUALITY = 100; + /** * @brief Constructor. */ @@ -68,6 +71,11 @@ public: /** * @copydoc Dali::Capture::Start */ + void Start( Dali::Actor source, const Dali::Vector2& size, const std::string &path, const Dali::Vector4& clearColor, const uint32_t quality ); + + /** + * @copydoc Dali::Capture::Start + */ void Start( Dali::Actor source, const Dali::Vector2& size, const std::string &path, const Dali::Vector4& clearColor ); /** @@ -186,6 +194,7 @@ private: Capture& operator=( const Capture& rhs ); private: + uint32_t mQuality; Dali::Texture mNativeTexture; Dali::FrameBuffer mFrameBuffer; Dali::RenderTask mRenderTask; diff --git a/dali/public-api/adaptor-framework/native-image-source.cpp b/dali/public-api/adaptor-framework/native-image-source.cpp index 9672c60..5aa9262 100755 --- a/dali/public-api/adaptor-framework/native-image-source.cpp +++ b/dali/public-api/adaptor-framework/native-image-source.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ bool NativeImageSource::GetPixels( std::vector &pixbuf, unsigned bool NativeImageSource::EncodeToFile(const std::string& filename) const { - return mImpl->EncodeToFile(filename); + return mImpl->EncodeToFile( filename ); } void NativeImageSource::SetSource( Any source ) diff --git a/dali/public-api/capture/capture.cpp b/dali/public-api/capture/capture.cpp index 701db7d..ca7c098 100644 --- a/dali/public-api/capture/capture.cpp +++ b/dali/public-api/capture/capture.cpp @@ -62,6 +62,11 @@ Capture& Capture::operator=( const Capture& rhs ) return *this; } +void Capture::Start( Actor source, const Vector2& size, const std::string &path, const Vector4& clearColor, const uint32_t quality ) +{ + GetImpl( *this ).Start( source, size, path, clearColor, quality ); +} + void Capture::Start( Actor source, const Vector2& size, const std::string &path, const Vector4& clearColor ) { GetImpl( *this ).Start( source, size, path, clearColor ); diff --git a/dali/public-api/capture/capture.h b/dali/public-api/capture/capture.h index c1696f3..29ee5b5 100755 --- a/dali/public-api/capture/capture.h +++ b/dali/public-api/capture/capture.h @@ -171,6 +171,19 @@ public: /** * @brief Start capture and save the image as a file. * + * @SINCE_1_5.11 + * + * @param[in] source source actor to be used for capture. + * @param[in] size captured size. + * @param[in] path image file path to be saved as a file. + * @param[in] clearColor background color of captured scene + * @param[in] quality The value to control image quality for jpeg file format in the range [1, 100] + */ + void Start( Actor source, const Vector2& size, const std::string &path, const Vector4& clearColor, const uint32_t quality ); + + /** + * @brief Start capture and save the image as a file. + * * @SINCE_1_3_4 * * @param[in] source source actor to be used for capture. @@ -195,7 +208,7 @@ public: /** * @brief Get NativeImageSourcePtr that is saved captured image. * - * @SINCE_1_5_10 + * @SINCE_1_5.10 */ Dali::NativeImageSourcePtr GetNativeImageSource() const; -- 2.7.4 From ff1abb7322ef1c905e1305f467aafd26fba63caa Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 13 May 2020 10:55:07 +0900 Subject: [PATCH 08/16] DALi Version 1.5.11 Change-Id: I3c23a90ef5119b3f37827eb06b2bc9f90fca1f6a --- dali/public-api/dali-adaptor-version.cpp | 2 +- packaging/dali-adaptor.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index 1b2c65c..74fe424 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int ADAPTOR_MAJOR_VERSION = 1; const unsigned int ADAPTOR_MINOR_VERSION = 5; -const unsigned int ADAPTOR_MICRO_VERSION = 10; +const unsigned int ADAPTOR_MICRO_VERSION = 11; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 7d218ed..ec8c451 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.5.10 +Version: 1.5.11 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From 929fb81b0d1c8c11fe36fbda7c008dd8a45ec098 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 12 May 2020 14:26:44 +0900 Subject: [PATCH 09/16] Check if mGraphics is valid Change-Id: Idc8ffbfa10edb25f6d6779134e6b40c672fc6741 --- .../window-system/common/window-render-surface.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index f86d7c2..e1a344f 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -204,9 +204,10 @@ void WindowRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpi void WindowRenderSurface::InitializeGraphics() { - mGraphics = &mAdaptor->GetGraphicsInterface(); + DALI_ASSERT_ALWAYS( mGraphics && "Graphics interface is not created" ); + auto eglGraphics = static_cast(mGraphics); mEGL = &eglGraphics->GetEglInterface(); @@ -258,13 +259,15 @@ void WindowRenderSurface::DestroySurface() DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter ); auto eglGraphics = static_cast(mGraphics); + if( eglGraphics ) + { + DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() ); - DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() ); - - Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - eglImpl.DestroySurface( mEGLSurface ); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + eglImpl.DestroySurface( mEGLSurface ); - mWindowBase->DestroyEglWindow(); + mWindowBase->DestroyEglWindow(); + } } bool WindowRenderSurface::ReplaceGraphicsSurface() -- 2.7.4 From 2c1c4c9299b63497462ed6fe0c3b9ce092a82d13 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 13 May 2020 16:30:29 +0900 Subject: [PATCH 10/16] Remove EGL surface in the update thread Change-Id: I251f2b89e02e883839964c80c2b80704a95ebf8d --- .../adaptor-framework/scene-holder-impl.cpp | 2 + dali/internal/adaptor/common/adaptor-impl.cpp | 15 ++-- dali/internal/adaptor/common/adaptor-impl.h | 13 ++-- .../common/combined-update-render-controller.cpp | 90 +++++++++++++++++----- .../common/combined-update-render-controller.h | 28 +++++-- .../adaptor/common/thread-controller-interface.h | 11 +-- dali/internal/system/common/thread-controller.cpp | 10 +-- dali/internal/system/common/thread-controller.h | 11 +-- dali/internal/window-system/common/window-impl.cpp | 7 -- .../window-system/common/window-render-surface.cpp | 11 +-- 10 files changed, 132 insertions(+), 66 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 2440b35..7162a1c 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -133,6 +133,8 @@ SceneHolder::~SceneHolder() mAdaptor->RemoveObserver( *mLifeCycleObserver.get() ); mAdaptor->RemoveWindow( this ); + mAdaptor->DeleteSurface( *mSurface.get() ); + mAdaptor = nullptr; } diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index e06310a..132e82e 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -555,6 +555,16 @@ void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::Rende } } +void Adaptor::DeleteSurface( Dali::RenderSurfaceInterface& surface ) +{ + // Flush the event queue to give the update-render thread chance + // to start processing messages for new camera setup etc as soon as possible + ProcessCoreEvents(); + + // This method blocks until the render thread has finished rendering the current surface. + mThreadController->DeleteSurface( &surface ); +} + Dali::RenderSurfaceInterface& Adaptor::GetSurface() const { return *mWindows.front()->GetSurface(); @@ -1039,11 +1049,6 @@ bool Adaptor::IsMultipleWindowSupported() const return mConfigurationManager->IsMultipleWindowSupported(); } -bool Adaptor::IsRenderingWindows() const -{ - return ( mThreadController && mThreadController->IsRenderingWindows() ); -} - void Adaptor::RequestUpdateOnce() { if( mThreadController ) diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index c2a9ad4..d0d2379 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -292,6 +292,12 @@ public: // AdaptorInternalServices implementation bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow ); /** + * @brief Deletes the rendering surface + * @param[in] surface to delete + */ + void DeleteSurface( Dali::RenderSurfaceInterface& surface ); + + /** * @brief Retrieve the window that the given actor is added to. * * @param[in] actor The actor @@ -443,13 +449,6 @@ public: */ bool IsMultipleWindowSupported() const; - /** - * @brief Checks whether the windows are being rendered in the render thread. - * - * @return true if the windows are being rendered in the render thread, or false if not. - */ - bool IsRenderingWindows() const; - public: //AdaptorInternalServices /** diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index 80bc0a3..7343b43 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -115,12 +115,12 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS mPendingRequestUpdate( FALSE ), mUseElapsedTimeAfterWait( FALSE ), mNewSurface( NULL ), + mDeletedSurface( nullptr ), mPostRendering( FALSE ), mSurfaceResized( FALSE ), mForceClear( FALSE ), mUploadWithoutRendering( FALSE ), - mFirstFrameAfterResume( FALSE ), - mIsRenderingWindows( false ) + mFirstFrameAfterResume( FALSE ) { LOG_EVENT_TRACE; @@ -324,6 +324,29 @@ void CombinedUpdateRenderController::ReplaceSurface( Dali::RenderSurfaceInterfac } } +void CombinedUpdateRenderController::DeleteSurface( Dali::RenderSurfaceInterface* surface ) +{ + LOG_EVENT_TRACE; + + if( mUpdateRenderThread ) + { + LOG_EVENT( "Starting to delete the surface, event-thread blocked" ); + + // Start replacing the surface. + { + ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); + mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will delete the surface now + mDeletedSurface = surface; + mUpdateRenderThreadWaitCondition.Notify( lock ); + } + + // Wait until the surface has been deleted + sem_wait( &mEventThreadSemaphore ); + + LOG_EVENT( "Surface deleted, event-thread continuing" ); + } +} + void CombinedUpdateRenderController::WaitForGraphicsInitialization() { LOG_EVENT_TRACE; @@ -663,8 +686,6 @@ void CombinedUpdateRenderController::UpdateRenderThread() AddPerformanceMarker( PerformanceInterface::RENDER_START ); - mIsRenderingWindows = true; - // Upload shared resources mCore.PreRender( renderStatus, mForceClear, mUploadWithoutRendering ); @@ -676,33 +697,42 @@ void CombinedUpdateRenderController::UpdateRenderThread() for( auto&& window : windows ) { - if ( window && !window->IsBeingDeleted() ) - { - Dali::Integration::Scene scene = window->GetScene(); - Dali::RenderSurfaceInterface* windowSurface = window->GetSurface(); + Dali::Integration::Scene scene = window->GetScene(); + Dali::RenderSurfaceInterface* windowSurface = window->GetSurface(); - if ( scene && windowSurface ) - { - windowSurface->InitializeGraphics(); + if ( scene && windowSurface ) + { + windowSurface->InitializeGraphics(); - // Render off-screen frame buffers first if any - mCore.RenderScene( scene, true ); + // Render off-screen frame buffers first if any + mCore.RenderScene( scene, true ); - // Switch to the EGL context of the surface - windowSurface->PreRender( surfaceResized ); // Switch GL context + // Switch to the EGL context of the surface + windowSurface->PreRender( surfaceResized ); // Switch GL context - // Render the surface - mCore.RenderScene( scene, false ); + // Render the surface + mCore.RenderScene( scene, false ); - windowSurface->PostRender( false, false, surfaceResized ); // Swap Buffer - } + windowSurface->PostRender( false, false, surfaceResized ); // Swap Buffer } } } mCore.PostRender( mUploadWithoutRendering ); - mIsRenderingWindows = false; + ////////////////////////////// + // DELETE SURFACE + ////////////////////////////// + + Dali::RenderSurfaceInterface* deletedSurface = ShouldSurfaceBeDeleted(); + if( DALI_UNLIKELY( deletedSurface ) ) + { + LOG_UPDATE_RENDER_TRACE_FMT( "Deleting Surface" ); + + deletedSurface->DestroySurface(); + + SurfaceDeleted(); + } AddPerformanceMarker( PerformanceInterface::RENDER_END ); @@ -788,12 +818,14 @@ bool CombinedUpdateRenderController::UpdateRenderReady( bool& useElapsedTime, bo ( mUpdateRenderThreadCanSleep && ! updateRequired && ! mPendingRequestUpdate ) ) && // Ensure we wait if we're supposed to be sleeping AND do not require another update ! mDestroyUpdateRenderThread && // Ensure we don't wait if the update-render-thread is supposed to be destroyed ! mNewSurface && // Ensure we don't wait if we need to replace the surface + ! mDeletedSurface && // Ensure we don't wait if we need to delete the surface ! mSurfaceResized ) // Ensure we don't wait if we need to resize the surface { LOG_UPDATE_RENDER( "WAIT: mUpdateRenderRunCount: %d", mUpdateRenderRunCount ); LOG_UPDATE_RENDER( " mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate ); LOG_UPDATE_RENDER( " mDestroyUpdateRenderThread: %d", mDestroyUpdateRenderThread ); LOG_UPDATE_RENDER( " mNewSurface: %d", mNewSurface ); + LOG_UPDATE_RENDER( " mDeletedSurface: %d", mDeletedSurface ); LOG_UPDATE_RENDER( " mSurfaceResized: %d", mSurfaceResized ); // Reset the time when the thread is waiting, so the sleep-until time for @@ -813,6 +845,7 @@ bool CombinedUpdateRenderController::UpdateRenderReady( bool& useElapsedTime, bo LOG_COUNTER_UPDATE_RENDER( "mUpdateRenderThreadCanSleep: %d, updateRequired: %d, mPendingRequestUpdate: %d", mUpdateRenderThreadCanSleep, updateRequired, mPendingRequestUpdate ); LOG_COUNTER_UPDATE_RENDER( "mDestroyUpdateRenderThread: %d", mDestroyUpdateRenderThread ); LOG_COUNTER_UPDATE_RENDER( "mNewSurface: %d", mNewSurface ); + LOG_COUNTER_UPDATE_RENDER( "mDeletedSurface: %d", mDeletedSurface ); LOG_COUNTER_UPDATE_RENDER( "mSurfaceResized: %d", mSurfaceResized ); mUseElapsedTimeAfterWait = FALSE; @@ -846,6 +879,22 @@ void CombinedUpdateRenderController::SurfaceReplaced() sem_post( &mEventThreadSemaphore ); } +Dali::RenderSurfaceInterface* CombinedUpdateRenderController::ShouldSurfaceBeDeleted() +{ + ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); + + Dali::RenderSurfaceInterface* deletedSurface = mDeletedSurface; + mDeletedSurface = NULL; + + return deletedSurface; +} + +void CombinedUpdateRenderController::SurfaceDeleted() +{ + // Just increment the semaphore + sem_post( &mEventThreadSemaphore ); +} + bool CombinedUpdateRenderController::ShouldSurfaceBeResized() { ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); @@ -907,6 +956,7 @@ void CombinedUpdateRenderController::PostRenderWaitForCompletion() ConditionalWait::ScopedLock lock( mUpdateRenderThreadWaitCondition ); while( mPostRendering && ! mNewSurface && // We should NOT wait if we're replacing the surface + ! mDeletedSurface && // We should NOT wait if we're deleting the surface ! mDestroyUpdateRenderThread ) { mUpdateRenderThreadWaitCondition.Wait( lock ); diff --git a/dali/internal/adaptor/common/combined-update-render-controller.h b/dali/internal/adaptor/common/combined-update-render-controller.h index ca22517..54cc67d 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -128,6 +128,11 @@ public: virtual void ReplaceSurface( Dali::RenderSurfaceInterface* surface ); /** + * @copydoc ThreadControllerInterface::DeleteSurface() + */ + virtual void DeleteSurface( Dali::RenderSurfaceInterface* surface ); + + /** * @copydoc ThreadControllerInterface::ResizeSurface() */ virtual void ResizeSurface(); @@ -152,11 +157,6 @@ public: */ virtual void AddSurface( Dali::RenderSurfaceInterface* surface ); - /** - * @copydoc ThreadControllerInterface::IsRenderingWindows() - */ - bool IsRenderingWindows() const override { return mIsRenderingWindows; } - private: // Undefined copy constructor. @@ -250,6 +250,21 @@ private: void SurfaceReplaced(); /** + * Checks to see if the surface needs to be deleted. + * This will lock the mutex in mUpdateRenderThreadWaitCondition. + * + * @return Pointer to the deleted surface, nullptr otherwise + */ + Dali::RenderSurfaceInterface* ShouldSurfaceBeDeleted(); + + /** + * Called by the Update/Render thread after a surface has been deleted. + * + * This will lock the mutex in mEventThreadWaitCondition + */ + void SurfaceDeleted(); + + /** * Checks to see if the surface needs to be resized. * This will lock the mutex in mUpdateRenderThreadWaitCondition. * @@ -365,6 +380,7 @@ private: volatile unsigned int mUseElapsedTimeAfterWait; ///< Whether we should use the elapsed time after waiting (set by the event-thread, read by the update-render-thread). Dali::RenderSurfaceInterface* volatile mNewSurface; ///< Will be set to the new-surface if requested (set by the event-thread, read & cleared by the update-render thread). + Dali::RenderSurfaceInterface* volatile mDeletedSurface; ///< Will be set to the deleted surface if requested (set by the event-thread, read & cleared by the update-render thread). volatile unsigned int mPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread). volatile unsigned int mSurfaceResized; ///< Will be set to resize the surface (set by the event-thread, read & cleared by the update-render thread). @@ -373,8 +389,6 @@ private: volatile unsigned int mUploadWithoutRendering; ///< Will be set to upload the resource only (with no rendering) volatile unsigned int mFirstFrameAfterResume; ///< Will be set to check the first frame after resume (for log) - - std::atomic mIsRenderingWindows; ///< This is set only from the render thread and read only from the event thread }; } // namespace Adaptor diff --git a/dali/internal/adaptor/common/thread-controller-interface.h b/dali/internal/adaptor/common/thread-controller-interface.h index 94276ff..6b9055b 100644 --- a/dali/internal/adaptor/common/thread-controller-interface.h +++ b/dali/internal/adaptor/common/thread-controller-interface.h @@ -93,6 +93,12 @@ public: virtual void ReplaceSurface( Dali::RenderSurfaceInterface* surface ) = 0; /** + * Deletes the surface. + * @param[in] surface The surface to be deleted + */ + virtual void DeleteSurface( Dali::RenderSurfaceInterface* surface ) = 0; + + /** * Resize the surface. */ virtual void ResizeSurface() = 0; @@ -118,11 +124,6 @@ public: */ virtual void AddSurface( Dali::RenderSurfaceInterface* surface ) = 0; - /** - * @copydoc Dali::Adaptor::IsRenderingWindows() - */ - virtual bool IsRenderingWindows() const = 0; - protected: /** diff --git a/dali/internal/system/common/thread-controller.cpp b/dali/internal/system/common/thread-controller.cpp index 605c76d..a9054ec 100644 --- a/dali/internal/system/common/thread-controller.cpp +++ b/dali/internal/system/common/thread-controller.cpp @@ -90,6 +90,11 @@ void ThreadController::ReplaceSurface( Dali::RenderSurfaceInterface* newSurface mThreadControllerInterface->ReplaceSurface( newSurface ); } +void ThreadController::DeleteSurface( Dali::RenderSurfaceInterface* surface ) +{ + mThreadControllerInterface->DeleteSurface( surface ); +} + void ThreadController::ResizeSurface() { mThreadControllerInterface->ResizeSurface(); @@ -115,11 +120,6 @@ void ThreadController::AddSurface( Dali::RenderSurfaceInterface* newSurface ) mThreadControllerInterface->AddSurface( newSurface ); } -bool ThreadController::IsRenderingWindows() const -{ - return mThreadControllerInterface->IsRenderingWindows(); -} - } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/system/common/thread-controller.h b/dali/internal/system/common/thread-controller.h index 471a5f9..c4f3961 100644 --- a/dali/internal/system/common/thread-controller.h +++ b/dali/internal/system/common/thread-controller.h @@ -112,6 +112,12 @@ public: void ReplaceSurface( Dali::RenderSurfaceInterface* surface ); /** + * Deletes the surface. + * @param surface The surface to be deleted + */ + void DeleteSurface( Dali::RenderSurfaceInterface* surface ); + + /** * Resize the surface. */ void ResizeSurface(); @@ -138,11 +144,6 @@ public: */ void AddSurface( Dali::RenderSurfaceInterface* surface ); - /** - * @copydoc Dali::Adaptor::IsRenderingWindows() - */ - bool IsRenderingWindows() const; - private: // Undefined copy constructor. diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index a0fd809..5321782 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -99,13 +99,6 @@ Window::Window() Window::~Window() { - mIsBeingDeleted = true; - - while ( mAdaptor && mAdaptor->IsRenderingWindows() ) - { - std::this_thread::yield(); // to allow other threads to run - } - if ( mEventHandler ) { mEventHandler->RemoveObserver( *this ); diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index e1a344f..c95d508 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -85,11 +85,6 @@ WindowRenderSurface::~WindowRenderSurface() { delete mRotationTrigger; } - - if ( mEGLSurface ) - { - DestroySurface(); - } } void WindowRenderSurface::Initialize( Any surface ) @@ -264,7 +259,13 @@ void WindowRenderSurface::DestroySurface() DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() ); Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + eglImpl.DestroySurface( mEGLSurface ); + mEGLSurface = nullptr; + + // Destroy context also + eglImpl.DestroyContext( mEGLContext ); + mEGLContext = nullptr; mWindowBase->DestroyEglWindow(); } -- 2.7.4 From 5eb3f7ce1e8d9adf2a22cce8d2038c56ea6b1c35 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 19 May 2020 11:34:18 +0900 Subject: [PATCH 11/16] DALi Version 1.5.12 Change-Id: I029b1724e9f2d129302369c887f7df5df7ce5ead --- dali/public-api/dali-adaptor-version.cpp | 2 +- packaging/dali-adaptor.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index 74fe424..798b45d 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int ADAPTOR_MAJOR_VERSION = 1; const unsigned int ADAPTOR_MINOR_VERSION = 5; -const unsigned int ADAPTOR_MICRO_VERSION = 11; +const unsigned int ADAPTOR_MICRO_VERSION = 12; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index ec8c451..8e175b1 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.5.11 +Version: 1.5.12 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From b365f6dc05ad57f29a4f49e0eaaae0c17fca15ec Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 13 May 2020 17:05:56 +0900 Subject: [PATCH 12/16] Delete EglGraphics and shutdown EGL Change-Id: Iaaa267481aad15172f8e9e26fd9cc85384dfbb83 --- dali/internal/adaptor/common/adaptor-impl.cpp | 10 ++++++---- dali/internal/adaptor/common/adaptor-impl.h | 2 +- .../adaptor/common/combined-update-render-controller.cpp | 5 ++++- dali/internal/graphics/common/graphics-interface.h | 11 +++++------ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 132e82e..1b56e54 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -159,10 +159,11 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" ); - mGraphics = &( graphicsFactory.Create() ); + mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() ); mGraphics->Initialize( mEnvironmentOptions ); - auto eglGraphics = static_cast( mGraphics ); // This interface is temporary until Core has been updated to match + GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match + auto eglGraphics = static_cast( graphics ); // This will only be created once eglGraphics->Create(); @@ -710,7 +711,7 @@ Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface() GraphicsInterface& Adaptor::GetGraphicsInterface() { DALI_ASSERT_DEBUG( mGraphics && "Graphics interface not created" ); - return *mGraphics; + return *( mGraphics.get() ); } Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface() @@ -801,7 +802,8 @@ Any Adaptor::GetGraphicsDisplay() if (mGraphics) { - auto eglGraphics = static_cast( mGraphics ); // This interface is temporary until Core has been updated to match + GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match + auto eglGraphics = static_cast( graphics ); EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); display = eglImpl.GetDisplay(); diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index d0d2379..9e4c079 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -664,7 +664,7 @@ private: // Data Dali::Integration::Core* mCore; ///< Dali Core ThreadController* mThreadController; ///< Controls the threads - GraphicsInterface* mGraphics; ///< Graphics interface + std::unique_ptr< GraphicsInterface > mGraphics; ///< Graphics interface Dali::DisplayConnection* mDisplayConnection; ///< Display connection WindowContainer mWindows; ///< A container of all the Windows that are currently created diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index 7343b43..5c5840a 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -794,7 +794,7 @@ void CombinedUpdateRenderController::UpdateRenderThread() } } - // Inform core of context destruction & shutdown EGL + // Inform core of context destruction mCore.ContextDestroyed(); currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface(); if( currentSurface ) @@ -803,6 +803,9 @@ void CombinedUpdateRenderController::UpdateRenderThread() currentSurface = nullptr; } + // Shutdown EGL + eglInterface->TerminateGles(); + LOG_UPDATE_RENDER( "THREAD DESTROYED" ); // Uninstall the logging function diff --git a/dali/internal/graphics/common/graphics-interface.h b/dali/internal/graphics/common/graphics-interface.h index 5e80ef7..93c1b2f 100644 --- a/dali/internal/graphics/common/graphics-interface.h +++ b/dali/internal/graphics/common/graphics-interface.h @@ -48,6 +48,11 @@ public: }; /** + * Destructor + */ + virtual ~GraphicsInterface() {} + + /** * Initialize the graphics interface * @param[in] environmentOptions The environment options. */ @@ -76,12 +81,6 @@ public: return mStencilBufferRequired; }; -protected: - /** - * Virtual protected destructor - no deletion through this interface - */ - virtual ~GraphicsInterface() {}; - protected: -- 2.7.4 From 0990dc7fd3da818a61bdcabda0db6fd0546fbd28 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Tue, 12 May 2020 16:07:41 +0100 Subject: [PATCH 13/16] Suppress unnecessary error output while creating system cache directory Change-Id: Iaf8e312bcd04567dea4d79b8a5d3d828c3301fa8 --- dali/internal/adaptor/common/adaptor-impl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 1b56e54..737845d 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -20,6 +20,8 @@ #include // EXTERNAL INCLUDES +#include +#include #include #include #include @@ -300,11 +302,11 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: std::string systemCachePath = GetSystemCachePath(); if( ! systemCachePath.empty() ) { - const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() ); - if (-1 == dir_err) + const int dir_err = mkdir( systemCachePath.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH ); + if ( 0 != dir_err && errno != EEXIST ) { - printf( "Error creating system cache directory: %s!\n", systemCachePath.c_str() ); - exit(1); + DALI_LOG_ERROR( "Error creating system cache directory: %s!\n", systemCachePath.c_str() ); + exit( 1 ); } } -- 2.7.4 From a21c5a4f16b568667a04c108d5bb7944fb29566d Mon Sep 17 00:00:00 2001 From: Dongsug Song Date: Thu, 16 Apr 2020 20:39:32 +0900 Subject: [PATCH 14/16] Add GetNativeId() in Window Change-Id: I9724842abf0f84f0633a19bb173993357081feee --- dali/devel-api/adaptor-framework/window-devel.cpp | 5 +++++ dali/devel-api/adaptor-framework/window-devel.h | 7 +++++++ dali/internal/window-system/common/window-impl.cpp | 5 +++++ dali/internal/window-system/common/window-impl.h | 5 +++++ 4 files changed, 22 insertions(+) mode change 100644 => 100755 dali/devel-api/adaptor-framework/window-devel.cpp mode change 100644 => 100755 dali/devel-api/adaptor-framework/window-devel.h mode change 100644 => 100755 dali/internal/window-system/common/window-impl.cpp mode change 100644 => 100755 dali/internal/window-system/common/window-impl.h diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp old mode 100644 new mode 100755 index e2f503e..b9fadbb --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -143,6 +143,11 @@ void SetAvailableOrientations( Window window, const Dali::Vector& orientations ); +/** + * @brief Gets current window ID. + * + * @param[in] window The window instance + */ +DALI_ADAPTOR_API int32_t GetNativeId( Window window ); + } // namespace DevelWindow } // namespace Dali diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp old mode 100644 new mode 100755 index 5321782..b21ca77 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -910,6 +910,11 @@ void Window::SetAvailableOrientations( const Dali::VectorGetNativeWindowId(); +} + } // Adaptor } // Internal diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h old mode 100644 new mode 100755 index 0d4a4e1..ca1d3bf --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -371,6 +371,11 @@ public: // Dali::Internal::Adaptor::SceneHolder */ bool IsVisible() const override; + /** + * @copydoc Dali::DevelWindow::GetNativeId() + */ + int32_t GetNativeId() const; + private: /** -- 2.7.4 From c7c6a3ee926cd930127933d8b7eaa0b0156de1ee Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Tue, 19 May 2020 13:46:03 +0100 Subject: [PATCH 15/16] Change to use properties instead of Setter/Getter APIs of Dali::Actor Change-Id: Ie0b83100d4a442758eb8a20fb4a9c949e8d79bb9 --- automated-tests/src/dali-adaptor/utc-Dali-PixelBuffer.cpp | 2 +- .../accessibility/tizen-wayland/atspi/accessibility-impl.cpp | 6 +++--- dali/internal/network/common/automation.cpp | 4 ++-- dali/internal/system/common/capture-impl.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/automated-tests/src/dali-adaptor/utc-Dali-PixelBuffer.cpp b/automated-tests/src/dali-adaptor/utc-Dali-PixelBuffer.cpp index 709b2c9..055d4be 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-PixelBuffer.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-PixelBuffer.cpp @@ -243,7 +243,7 @@ int UtcDaliPixelBufferConvert(void) Actor a = Actor::New(); a.AddRenderer(r); a.SetSize(10, 10); - a.SetParentOrigin(ParentOrigin::CENTER); + a.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); Stage::GetCurrent().Add(a); application.SendNotification(); diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp b/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp index 30b9179..382e08b 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp +++ b/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp @@ -605,9 +605,9 @@ public: Dali::Rect<> GetExtents( Dali::Accessibility::CoordType ctype ) override { Vector2 screenPosition = actor.GetProperty( Dali::DevelActor::Property::SCREEN_POSITION ).Get< Vector2 >(); - Vector3 size = actor.GetCurrentSize() * actor.GetCurrentWorldScale(); + Vector3 size = actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) * actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ); bool positionUsesAnchorPoint = actor.GetProperty( Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >(); - Vector3 anchorPointOffSet = size * ( positionUsesAnchorPoint ? actor.GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); + Vector3 anchorPointOffSet = size * ( positionUsesAnchorPoint ? actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ) : AnchorPoint::TOP_LEFT ); Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y ); return { position.x, position.y, size.x, size.y }; @@ -646,7 +646,7 @@ public: } std::string GetName() override { - return actor.GetName(); + return actor.GetProperty< std::string >( Dali::Actor::Property::NAME ); } std::string GetDescription() override { diff --git a/dali/internal/network/common/automation.cpp b/dali/internal/network/common/automation.cpp index ce17605..7c5be2b 100644 --- a/dali/internal/network/common/automation.cpp +++ b/dali/internal/network/common/automation.cpp @@ -334,8 +334,8 @@ std::string DumpJson( Dali::Actor actor, int level ) { // All the information about this actor std::ostringstream msg; - msg << "{ " << Quote( "Name" ) << " : " << Quote( actor.GetName() ) << ", " << Quote( "level" ) << " : " << level << ", " << Quote( "id" ) << " : " << actor.GetId() << ", " << Quote( "IsVisible" ) - << " : " << actor.IsVisible() << ", " << Quote( "IsSensitive" ) << " : " << actor.IsSensitive(); + msg << "{ " << Quote( "Name" ) << " : " << Quote( actor.GetProperty< std::string >( Actor::Property::NAME ) ) << ", " << Quote( "level" ) << " : " << level << ", " << Quote( "id" ) << " : " << actor.GetId() << ", " << Quote( "IsVisible" ) + << " : " << actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) << ", " << Quote( "IsSensitive" ) << " : " << actor.GetProperty< bool >( Actor::Property::SENSITIVE ); msg << ", " << Quote( "properties" ) << ": [ "; diff --git a/dali/internal/system/common/capture-impl.cpp b/dali/internal/system/common/capture-impl.cpp index 2724dd2..253a3fd 100644 --- a/dali/internal/system/common/capture-impl.cpp +++ b/dali/internal/system/common/capture-impl.cpp @@ -188,8 +188,8 @@ void Capture::SetupRenderTask( Dali::Actor source, const Dali::Vector4& clearCol if( !mCameraActor ) { mCameraActor = Dali::CameraActor::New( stageSize ); - mCameraActor.SetParentOrigin( ParentOrigin::CENTER ); - mCameraActor.SetAnchorPoint( AnchorPoint::CENTER ); + mCameraActor.SetProperty( Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mCameraActor.SetProperty( Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); } stage.Add( mCameraActor ); -- 2.7.4 From 0a78f1b0563524a5de557399d99d5e576e0f4f54 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 26 May 2020 17:59:56 +0900 Subject: [PATCH 16/16] DALi Version 1.5.13 Change-Id: I031ff8ed49101a770ce7d65869660f10502efa1b --- dali/public-api/dali-adaptor-version.cpp | 2 +- packaging/dali-adaptor.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index 798b45d..5a65498 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int ADAPTOR_MAJOR_VERSION = 1; const unsigned int ADAPTOR_MINOR_VERSION = 5; -const unsigned int ADAPTOR_MICRO_VERSION = 12; +const unsigned int ADAPTOR_MICRO_VERSION = 13; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 8e175b1..c5a2b63 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.5.12 +Version: 1.5.13 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4