From: Adeel Kazmi Date: Fri, 28 Jul 2023 13:58:05 +0000 (+0000) Subject: Merge "DALi Version 2.2.37" into devel/master X-Git-Tag: dali_2.2.38~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f423d8fa4c2e06bb3b3973b2e5fd585fc1cdd1c9;hp=38d72089af857e5b8682bb8137ddc3cc270fbf17;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Merge "DALi Version 2.2.37" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp index c6a8711..9583e09 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp @@ -1961,6 +1961,80 @@ int UtcDaliImageVisualSetInvalidRemoteImage(void) END_TEST; } +int UtcDaliImageVisualSetInvalidImageWithDisabledBroken(void) +{ + ToolkitTestApplication application; + tet_infoline("Request image visual with invalid images - should draw broken.png"); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK(factory); + + // Load invalid file + Property::Map propertyMap; + propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, "InvalidImage.png"); + + Visual::Base visual = factory.CreateVisual(propertyMap); + DALI_TEST_CHECK(visual); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + DummyControl actor = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual); + + actor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); + + application.GetScene().Add(actor); + + application.SendNotification(); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION); + DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION); + + application.GetScene().Remove(actor); + DALI_TEST_CHECK(actor.GetRendererCount() == 0u); + textureTrace.Reset(); + + // Load invalid file with disabled broken + propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, "InvalidImage.png"); + propertyMap.Insert(Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE, false); + + visual = factory.CreateVisual(propertyMap); + DALI_TEST_CHECK(visual); + + actor = DummyControl::New(); + DummyControlImpl& dummyImpl2 = static_cast(actor.GetImplementation()); + dummyImpl2.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual); + + actor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); + + application.GetScene().Add(actor); + + application.SendNotification(); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION); + DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION); + + application.GetScene().Remove(actor); + DALI_TEST_CHECK(actor.GetRendererCount() == 0u); + + END_TEST; +} + int UtcDaliImageVisualAlphaMask01(void) { ToolkitTestApplication application; diff --git a/build/tizen/dali-physics/CMakeLists.txt b/build/tizen/dali-physics/CMakeLists.txt index f835962..d6dbad2 100644 --- a/build/tizen/dali-physics/CMakeLists.txt +++ b/build/tizen/dali-physics/CMakeLists.txt @@ -8,7 +8,7 @@ set(${name}_VERSION_MINOR 0) set(${name}_VERSION_PATCH 0) set(${name}_VERSION ${${name}_VERSION_MAJOR}.${${name}_VERSION_MINOR}.${${name}_VERSION_PATCH} ) -SET(DALI_SCENE3D_VERSION ${${name}_VERSION} ) +SET(DALI_PHYSICS_VERSION ${${name}_VERSION} ) if(CMAKE_BUILD_TYPE MATCHES Debug) add_definitions("-DDEBUG_ENABLED") @@ -76,8 +76,19 @@ if (ENABLE_PKG_CONFIGURE) ) endif() +if( INSTALL_CMAKE_MODULES ) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}-2d-config.cmake " + include(CMakeFindDependencyMacro) + include(\${CMAKE_CURRENT_LIST_DIR}/${name}-2d-targets.cmake) + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}-2d-config.cmake DESTINATION share/${name}-2d) - + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}-3d-config.cmake " + include(CMakeFindDependencyMacro) + include(\${CMAKE_CURRENT_LIST_DIR}/${name}-3d-targets.cmake) + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}-3d-config.cmake DESTINATION share/${name}-3d) +endif() diff --git a/dali-physics/third-party/bullet3/CMakeLists.txt b/dali-physics/third-party/bullet3/CMakeLists.txt index 1f331c9..b504089 100644 --- a/dali-physics/third-party/bullet3/CMakeLists.txt +++ b/dali-physics/third-party/bullet3/CMakeLists.txt @@ -96,6 +96,8 @@ else() target_compile_options(bullet3 PRIVATE -w) endif() +target_compile_options(bullet3 PRIVATE -fvisibility=default) + target_link_libraries(bullet3 ${COVERAGE}) if(ENABLE_PKG_CONFIGURE) @@ -121,9 +123,18 @@ endif(ENABLE_PKG_CONFIGURE) install( TARGETS bullet3 DESTINATION ${LIB_DIR} - EXPORT Bullet3Targets + EXPORT bullet3-targets ) +if(INSTALL_CMAKE_MODULES) + install( + EXPORT bullet3-targets + NAMESPACE bullet3:: + FILE bullet3-targets.cmake + DESTINATION share/bullet3 + ) +endif() + if(BULLET3_BUILD_SHARED AND MSVC) install(FILES $ DESTINATION lib) endif() @@ -140,3 +151,11 @@ foreach(SUB ${BULLET_SUBMODULES}) FILES_MATCHING PATTERN "*.h" ) endforeach() + +if(INSTALL_CMAKE_MODULES) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bullet3-config.cmake " + include(CMakeFindDependencyMacro) + include(\${CMAKE_CURRENT_LIST_DIR}/bullet3-targets.cmake) + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bullet3-config.cmake DESTINATION share/bullet3) +endif() \ No newline at end of file diff --git a/dali-physics/third-party/chipmunk2d/src/CMakeLists.txt b/dali-physics/third-party/chipmunk2d/src/CMakeLists.txt index 1c45355..34b30eb 100644 --- a/dali-physics/third-party/chipmunk2d/src/CMakeLists.txt +++ b/dali-physics/third-party/chipmunk2d/src/CMakeLists.txt @@ -55,6 +55,7 @@ if(BUILD_SHARED) SOVERSION ${CHIPMUNK_VERSION_MAJOR} VERSION ${CHIPMUNK_VERSION}) endif(NOT ANDROID) + target_compile_options(chipmunk PRIVATE -fvisibility=default) if(ANDROID OR UNIX) # need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically target_link_libraries(chipmunk m ${COVERAGE}) @@ -62,9 +63,11 @@ if(BUILD_SHARED) if(ANDROID) target_link_libraries(chipmunk ${LOGLIB}) endif(ANDROID) - install(TARGETS chipmunk RUNTIME DESTINATION ${BIN_INSTALL_DIR} + install(TARGETS chipmunk EXPORT chipmunk-targets + RUNTIME DESTINATION ${BIN_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + ) endif(BUILD_SHARED) if(BUILD_STATIC) @@ -78,12 +81,13 @@ if(BUILD_STATIC) endif(MSVC) # Sets chipmunk_static to output "libchipmunk.a" not "libchipmunk_static.a" set_target_properties(chipmunk_static PROPERTIES OUTPUT_NAME chipmunk) + target_compile_options(chipmunk PRIVATE -fvisibility=default) target_link_libraries(chipmunk m ${COVERAGE}) if(ANDROID) target_link_libraries(chipmunk ${LOGLIB}) endif(ANDROID) if(INSTALL_STATIC) - install(TARGETS chipmunk_static ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS chipmunk_static EXPORT chipmunk-targets ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) endif(INSTALL_STATIC) endif(BUILD_STATIC) @@ -91,6 +95,21 @@ if(BUILD_SHARED OR INSTALL_STATIC) # FIXME: change to PUBLIC_HEADER to allow building frameworks install(FILES ${chipmunk_public_header} DESTINATION include/chipmunk) install(FILES ${chipmunk_constraint_header} DESTINATION include/chipmunk/constraints) + + if(INSTALL_CMAKE_MODULES) + install( + EXPORT chipmunk-targets + NAMESPACE chipmunk:: + FILE chipmunk-targets.cmake + DESTINATION share/chipmunk + ) + + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chipmunk-config.cmake " + include(CMakeFindDependencyMacro) + include(\${CMAKE_CURRENT_LIST_DIR}/chipmunk-targets.cmake) + ") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chipmunk-config.cmake DESTINATION share/chipmunk) + endif() endif(BUILD_SHARED OR INSTALL_STATIC) if (ENABLE_PKG_CONFIGURE) diff --git a/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h b/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h index 9e6d199..3c0e7d6 100644 --- a/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h +++ b/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h @@ -155,7 +155,15 @@ enum Type * So we change its value to MASKING_ON_RENDERING even if the visual sets the MASKING_TYPE as MASKING_ON_LOADING when it uses external texture. * @note It is used in the ImageVisual and AnimatedImageVisual. The default is MASKING_ON_LOADING. */ - MASKING_TYPE = ORIENTATION_CORRECTION + 12 + MASKING_TYPE = ORIENTATION_CORRECTION + 12, + + /** + * @brief Whether to enable broken image in image visual. + * Some of visual don't need to show broken image(ex. placeholder) + * Disable broken image for these visuals. + * default is true. + */ + ENABLE_BROKEN_IMAGE = ORIENTATION_CORRECTION + 14 }; } //namespace Property diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index 5f58fe3..87ab126 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -611,6 +611,7 @@ void ImageView::CreatePlaceholderImage() propertyMap.Insert(Toolkit::ImageVisual::Property::URL, mPlaceholderUrl); //propertyMap.Insert(Toolkit::ImageVisual::Property::LOAD_POLICY, Toolkit::ImageVisual::LoadPolicy::IMMEDIATE); // TODO: need to enable this property propertyMap.Insert(Toolkit::ImageVisual::Property::RELEASE_POLICY, Toolkit::ImageVisual::ReleasePolicy::DESTROYED); + propertyMap.Insert(Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE, false); mPlaceholderVisual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap); if(mPlaceholderVisual) { diff --git a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp index b548e6c..11c9105 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp +++ b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp @@ -1047,7 +1047,7 @@ void TextureManager::AsyncLoadComplete(const TextureManager::TextureId& textureI } else { - RequestRemove(textureInfo.textureId, nullptr); + Remove(textureInfo.textureId); } } } diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 8adcb32..18cf2b4 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -168,7 +168,8 @@ ImageVisual::ImageVisual(VisualFactoryCache& factoryCache, mAtlasRectSize(0, 0), mLoadState(TextureManager::LoadState::NOT_STARTED), mAttemptAtlasing(false), - mOrientationCorrection(true) + mOrientationCorrection(true), + mEnableBrokenImage(true) { EnablePreMultipliedAlpha(mFactoryCache.GetPreMultiplyOnLoad()); } @@ -266,6 +267,10 @@ void ImageVisual::DoSetProperties(const Property::Map& propertyMap) { DoSetProperty(Toolkit::DevelImageVisual::Property::MASKING_TYPE, keyValue.second); } + else if(keyValue.first == ENABLE_BROKEN_IMAGE) + { + DoSetProperty(Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE, keyValue.second); + } else if(keyValue.first == LOAD_POLICY_NAME) { DoSetProperty(Toolkit::ImageVisual::Property::LOAD_POLICY, keyValue.second); @@ -438,6 +443,16 @@ void ImageVisual::DoSetProperty(Property::Index index, const Property::Value& va break; } + case Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE: + { + bool enableBrokenImage(mEnableBrokenImage); + if(value.Get(enableBrokenImage)) + { + mEnableBrokenImage = enableBrokenImage; + } + break; + } + case Toolkit::ImageVisual::Property::RELEASE_POLICY: { int releasePolicy = 0; @@ -762,17 +777,7 @@ void ImageVisual::DoSetOnScene(Actor& actor) } else if(mLoadState == TextureManager::LoadState::LOAD_FAILED) { - Vector2 imageSize = Vector2::ZERO; - if(actor) - { - imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); - mPlacementActorSize = imageSize; - } - - mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); - actor.AddRenderer(mImpl->mRenderer); - mPlacementActor.Reset(); - + ShowBrokenImage(); ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); } } @@ -785,14 +790,7 @@ void ImageVisual::DoSetOffScene(Actor& actor) actor.RemoveRenderer(mImpl->mRenderer); if(mReleasePolicy == Toolkit::ImageVisual::ReleasePolicy::DETACHED) { - RemoveTexture(); // If INVALID_TEXTURE_ID then removal will be attempted on atlas - mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING; - - TextureSet textureSet = TextureSet::New(); - mImpl->mRenderer.SetTextures(textureSet); - ComputeTextureSize(); - - mLoadState = TextureManager::LoadState::NOT_STARTED; + ResetRenderer(); } mPlacementActor.Reset(); @@ -912,18 +910,7 @@ void ImageVisual::LoadComplete(bool loadingSuccess, TextureInformation textureIn Actor actor = mPlacementActor.GetHandle(); if(!loadingSuccess) { - Vector2 imageSize = Vector2::ZERO; - if(actor) - { - imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); - mPlacementActorSize = imageSize; - } - else - { - imageSize = mPlacementActorSize; - } - - mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); + ShowBrokenImage(); textureInformation.textureSet = mImpl->mRenderer.GetTextures(); } else @@ -947,13 +934,13 @@ void ImageVisual::LoadComplete(bool loadingSuccess, TextureInformation textureIn UpdateShader(); } } - } - if(actor) - { - actor.AddRenderer(mImpl->mRenderer); - // reset the weak handle so that the renderer only get added to actor once - mPlacementActor.Reset(); + if(actor) + { + actor.AddRenderer(mImpl->mRenderer); + // reset the weak handle so that the renderer only get added to actor once + mPlacementActor.Reset(); + } } } @@ -1190,6 +1177,44 @@ void ImageVisual::CheckMaskTexture() } } +void ImageVisual::ResetRenderer() +{ + RemoveTexture(); // If INVALID_TEXTURE_ID then removal will be attempted on atlas + mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING; + + TextureSet textureSet = TextureSet::New(); + mImpl->mRenderer.SetTextures(textureSet); + ComputeTextureSize(); + + mLoadState = TextureManager::LoadState::NOT_STARTED; +} + +void ImageVisual::ShowBrokenImage() +{ + if(mEnableBrokenImage) + { + Actor actor = mPlacementActor.GetHandle(); + + Vector2 imageSize = Vector2::ZERO; + if(actor) + { + imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); + mPlacementActorSize = imageSize; + } + + mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); + if(actor) + { + actor.AddRenderer(mImpl->mRenderer); + mPlacementActor.Reset(); + } + } + else + { + ResetRenderer(); + } +} + } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/visuals/image/image-visual.h b/dali-toolkit/internal/visuals/image/image-visual.h index f5bf6fe..1bd414b 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.h +++ b/dali-toolkit/internal/visuals/image/image-visual.h @@ -322,6 +322,17 @@ private: */ void CheckMaskTexture(); + /** + * @brief Reset Renderer using empty texture + * For drawing empty visual, reset the renderer. + */ + void ResetRenderer(); + + /** + * @brief Show broken image when image loading is failed. + */ + void ShowBrokenImage(); + private: Vector4 mPixelArea; WeakHandle mPlacementActor; @@ -348,6 +359,7 @@ private: bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture bool mOrientationCorrection; ///< true if the image will have it's orientation corrected. bool mNeedYuvToRgb{false}; ///< true if we need to convert yuv to rgb. + bool mEnableBrokenImage; }; } // namespace Internal diff --git a/dali-toolkit/internal/visuals/visual-string-constants.cpp b/dali-toolkit/internal/visuals/visual-string-constants.cpp index ac898d7..ec888ce 100644 --- a/dali-toolkit/internal/visuals/visual-string-constants.cpp +++ b/dali-toolkit/internal/visuals/visual-string-constants.cpp @@ -123,6 +123,7 @@ const char* const ALPHA_MASK_URL("alphaMaskUrl"); const char* const REDRAW_IN_SCALING_DOWN_NAME("redrawInScalingDown"); const char* const MASKING_TYPE_NAME("maskingType"); const char* const MASK_TEXTURE_RATIO_NAME("maskTextureRatio"); +const char* const ENABLE_BROKEN_IMAGE("enableBrokenImage"); // Text visual const char* const TEXT_PROPERTY("text"); diff --git a/dali-toolkit/internal/visuals/visual-string-constants.h b/dali-toolkit/internal/visuals/visual-string-constants.h index 0bb5840..29d75a9 100644 --- a/dali-toolkit/internal/visuals/visual-string-constants.h +++ b/dali-toolkit/internal/visuals/visual-string-constants.h @@ -107,6 +107,7 @@ extern const char* const ALPHA_MASK_URL; extern const char* const REDRAW_IN_SCALING_DOWN_NAME; extern const char* const MASKING_TYPE_NAME; extern const char* const MASK_TEXTURE_RATIO_NAME; +extern const char* const ENABLE_BROKEN_IMAGE; // Text visual extern const char* const TEXT_PROPERTY;