From f5b840650cb611623c6d781ff7e957f8053914ed Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Thu, 23 Apr 2020 12:30:12 +0900 Subject: [PATCH 01/16] Add a missing file Change-Id: I8716d5933e7bf0ef2dd68a795ad9cead0a4f87df --- .gitignore | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4cfd6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +.cproject +.project +.settings +.directory +Makefile.in +Makefile +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +dali.node +dali.doxy +install_manifest.txt +libdali-toolkit.so* +*~ +*.o +*.o.d +*.pc +*.lo +*.loT +*.la +*.so +*.orig +*.odt +*.fodt +*.test +*.example +*.a +*.apk +*.ap_ +*.class +*.classpath +*.dex +*.gcno +*.gcda +*.gcov +.deps +.libs +*.swp +/docs/generated/* +/build/tizen/doc +/build/tizen/.cov +/build/desktop +/packaging/home* +.vscode/ +core -- 2.7.4 From 695a986035fe9b7bb3a091527678ca3c66f362df Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 24 Apr 2020 12:29:17 +0900 Subject: [PATCH 02/16] Add missing files Change-Id: I7731bd3121749a023fa35e2d8f5e840142e3366b --- automated-tests/.gitignore | 6 ++++++ build/tizen/.gitignore | 2 ++ build/tizen/docs-internal/.gitignore | 3 +++ build/tizen/docs/.gitignore | 2 ++ 4 files changed, 13 insertions(+) create mode 100644 automated-tests/.gitignore create mode 100644 build/tizen/.gitignore create mode 100644 build/tizen/docs-internal/.gitignore create mode 100644 build/tizen/docs/.gitignore diff --git a/automated-tests/.gitignore b/automated-tests/.gitignore new file mode 100644 index 0000000..b12e784 --- /dev/null +++ b/automated-tests/.gitignore @@ -0,0 +1,6 @@ +*.xml +build +build.log +tct*core.h +CMakeLists.txt +results_xml.* diff --git a/build/tizen/.gitignore b/build/tizen/.gitignore new file mode 100644 index 0000000..f52387f --- /dev/null +++ b/build/tizen/.gitignore @@ -0,0 +1,2 @@ +build +dali.info diff --git a/build/tizen/docs-internal/.gitignore b/build/tizen/docs-internal/.gitignore new file mode 100644 index 0000000..4791915 --- /dev/null +++ b/build/tizen/docs-internal/.gitignore @@ -0,0 +1,3 @@ +build.*.log +dali-internal.doxy +dali-internal.doxy.bak diff --git a/build/tizen/docs/.gitignore b/build/tizen/docs/.gitignore new file mode 100644 index 0000000..52fdd1f --- /dev/null +++ b/build/tizen/docs/.gitignore @@ -0,0 +1,2 @@ +doxygen-errors.txt +dali.doxy.bak -- 2.7.4 From 764669569237e6fb7f3bddb1f9e77d60468bc922 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 24 Apr 2020 14:15:29 +0900 Subject: [PATCH 03/16] Add missing files Change-Id: I7c59ca2446bf0807c234caf9aa08720f00484538 --- automated-tests/src/CMakeLists.txt | 6 + .../src/dali-toolkit-internal/CMakeLists.txt | 108 +++++++++++++++ .../src/dali-toolkit-styling/CMakeLists.txt | 85 ++++++++++++ .../src/dali-toolkit-third-party/CMakeLists.txt | 71 ++++++++++ automated-tests/src/dali-toolkit/CMakeLists.txt | 147 +++++++++++++++++++++ docs/generated-internal/README.md | 25 ++++ 6 files changed, 442 insertions(+) create mode 100644 automated-tests/src/CMakeLists.txt create mode 100755 automated-tests/src/dali-toolkit-internal/CMakeLists.txt create mode 100644 automated-tests/src/dali-toolkit-styling/CMakeLists.txt create mode 100644 automated-tests/src/dali-toolkit-third-party/CMakeLists.txt create mode 100755 automated-tests/src/dali-toolkit/CMakeLists.txt create mode 100644 docs/generated-internal/README.md diff --git a/automated-tests/src/CMakeLists.txt b/automated-tests/src/CMakeLists.txt new file mode 100644 index 0000000..e4f0a2b --- /dev/null +++ b/automated-tests/src/CMakeLists.txt @@ -0,0 +1,6 @@ +IF( DEFINED MODULE ) + MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}") + ADD_SUBDIRECTORY(${MODULE}) +ELSE( DEFINED MODULE ) + MESSAGE(FATAL_ERROR "No module selected to build. Aborting...") +ENDIF( DEFINED MODULE ) diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt new file mode 100755 index 0000000..98172fb --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -0,0 +1,108 @@ +SET(PKG_NAME "dali-toolkit-internal") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit-internal") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-BidirectionalSupport.cpp + utc-Dali-ColorConversion.cpp + utc-Dali-Control-internal.cpp + utc-Dali-DebugRendering.cpp + utc-Dali-FeedbackStyle.cpp + utc-Dali-ItemView-internal.cpp + utc-Dali-LogicalModel.cpp + utc-Dali-PropertyHelper.cpp + utc-Dali-Text-CharacterSetConversion.cpp + utc-Dali-Text-Circular.cpp + utc-Dali-Text-Controller.cpp + utc-Dali-Text-Cursor.cpp + utc-Dali-Text-Layout.cpp + utc-Dali-Text-Markup.cpp + utc-Dali-Text-MultiLanguage.cpp + utc-Dali-Text-Segmentation.cpp + utc-Dali-Text-Shaping.cpp + utc-Dali-Text-Typesetter.cpp + utc-Dali-Text-ViewModel.cpp + utc-Dali-TextField-internal.cpp + utc-Dali-TextureManager.cpp + utc-Dali-Visuals-internal.cpp + utc-Dali-VisualModel.cpp + utc-Dali-VisualUrl.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-options.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp + ../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp + dali-toolkit-test-utils/toolkit-text-utils.cpp + dali-toolkit-test-utils/dummy-visual.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali-adaptor + dali-toolkit +) + +ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror -DDEBUG_ENABLED ) +ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} ) + +ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" ) + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ../../../ + ${${CAPI_LIB}_INCLUDE_DIRS} + ../dali-toolkit/dali-toolkit-test-utils + dali-toolkit-test-utils +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + -lpthread --coverage +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit-styling/CMakeLists.txt b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt new file mode 100644 index 0000000..32b7233 --- /dev/null +++ b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt @@ -0,0 +1,85 @@ +SET(PKG_NAME "dali-toolkit-styling") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit-styling") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-StyleManager.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-color-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-options.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-sound-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-virtual-keyboard.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp + ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali-toolkit +) + +ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror ) +ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} ) + +ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" ) + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ../../../ + ${${CAPI_LIB}_INCLUDE_DIRS} + ${DALI_ADAPTOR_INCLUDE_DIRS} + ../dali-toolkit/dali-toolkit-test-utils +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + -lpthread -ldl --coverage +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt new file mode 100644 index 0000000..3a9f9b2 --- /dev/null +++ b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt @@ -0,0 +1,71 @@ +SET(PKG_NAME "dali-toolkit-third-party") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit-third-party") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-Flexbox-Layout.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp +) + + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali-adaptor + dali-toolkit +) + +# Locate GTest +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +FIND_PACKAGE(GTest REQUIRED) + +#ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror ) +# ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} ) +# This works for a homogenous C++ project, but not for mixed C++/C project +# On CMake >= 3.3, could use +# ADD_COMPILE_OPTIONS( "$<$:${${CAPI_LIB}_CFLAGS_OTHER}>" ) +# However, we need to support CMake 2.8, so instead, fall back to setting the CXX_FLAGS directly: +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror" ) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${CAPI_LIB}_CFLAGS_OTHER}" ) + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ../../../ + ../../../dali-toolkit/third-party + ${${CAPI_LIB}_INCLUDE_DIRS} + ../dali-toolkit/dali-toolkit-test-utils + ${GTEST_INCLUDE_DIRS} +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + -lpthread --coverage + ${GTEST_LIBRARIES} +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt new file mode 100755 index 0000000..de0513d --- /dev/null +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -0,0 +1,147 @@ +SET(PKG_NAME "dali-toolkit") + +SET(EXEC_NAME "tct-${PKG_NAME}-core") +SET(RPM_NAME "core-${PKG_NAME}-tests") + +SET(CAPI_LIB "dali-toolkit") + +# List of test case sources (Only these get parsed for test cases) +SET(TC_SOURCES + utc-Dali-Alignment.cpp + utc-Dali-AnimatedImageVisual.cpp + utc-Dali-AnimatedVectorImageVisual.cpp + utc-Dali-ArcVisual.cpp + utc-Dali-BloomView.cpp + utc-Dali-BubbleEmitter.cpp + utc-Dali-Builder.cpp + utc-Dali-CheckBoxButton.cpp + utc-Dali-ConfirmationPopup.cpp + utc-Dali-CubeTransitionEffect.cpp + utc-Dali-EffectsView.cpp + utc-Dali-FlexContainer.cpp + utc-Dali-FlexNode.cpp + utc-Dali-GaussianBlurView.cpp + utc-Dali-ImageView.cpp + utc-Dali-ImageVisual.cpp + utc-Dali-JsonParser.cpp + utc-Dali-KeyInputFocusManager.cpp + utc-Dali-PageTurnView.cpp + utc-Dali-Scene3dView.cpp + utc-Dali-ScrollBar.cpp + utc-Dali-ScrollView.cpp + utc-Dali-ShaderEffects.cpp + utc-Dali-ShadowView.cpp + utc-Dali-Slider.cpp + utc-Dali-TableView.cpp + utc-Dali-TextEditor.cpp + utc-Dali-TextField.cpp + utc-Dali-TextLabel.cpp + utc-Dali-TextSelectionPopup.cpp + utc-Dali-TextSelectionPopupMirroringLTR.cpp + utc-Dali-TextSelectionPopupMirroringRTL.cpp + utc-Dali-TextureManager.cpp + utc-Dali-ToolBar.cpp + utc-Dali-Tooltip.cpp + utc-Dali-TransitionData.cpp + utc-Dali-Button.cpp + utc-Dali-Control.cpp + utc-Dali-ControlImpl.cpp + utc-Dali-AccessibilityManager.cpp + utc-Dali-ItemLayout.cpp + utc-Dali-ItemView.cpp + utc-Dali-KeyboardFocusManager.cpp + utc-Dali-Magnifier.cpp + utc-Dali-NavigationView.cpp + utc-Dali-Popup.cpp + utc-Dali-ProgressBar.cpp + utc-Dali-PushButton.cpp + utc-Dali-RadioButton.cpp + utc-Dali-ToggleButton.cpp + utc-Dali-ScrollViewEffect.cpp + utc-Dali-SuperBlurView.cpp + utc-Dali-Toolkit.cpp + utc-Dali-Model3dView.cpp + utc-Dali-Visual.cpp + utc-Dali-VisualFactory.cpp + utc-Dali-ImageAtlas.cpp + utc-Dali-VideoView.cpp + utc-Dali-WebView.cpp + utc-Dali-AsyncImageLoader.cpp + utc-Dali-SyncImageLoader.cpp + utc-Dali-ControlWrapper.cpp + utc-Dali-DragAndDropDetector.cpp +) + +# Append list of test harness files (Won't get parsed for test cases) +LIST(APPEND TC_SOURCES + dali-toolkit-test-utils/toolkit-adaptor.cpp + dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp + dali-toolkit-test-utils/toolkit-application.cpp + dali-toolkit-test-utils/toolkit-clipboard.cpp + dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + dali-toolkit-test-utils/toolkit-event-thread-callback.cpp + dali-toolkit-test-utils/toolkit-environment-variable.cpp + dali-toolkit-test-utils/toolkit-input-method-context.cpp + dali-toolkit-test-utils/toolkit-input-method-options.cpp + dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp + dali-toolkit-test-utils/toolkit-orientation.cpp + dali-toolkit-test-utils/toolkit-physical-keyboard.cpp + dali-toolkit-test-utils/toolkit-style-monitor.cpp + dali-toolkit-test-utils/toolkit-test-application.cpp + dali-toolkit-test-utils/toolkit-timer.cpp + dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp + dali-toolkit-test-utils/toolkit-tts-player.cpp + dali-toolkit-test-utils/toolkit-native-image-source.cpp + dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp + dali-toolkit-test-utils/toolkit-video-player.cpp + dali-toolkit-test-utils/toolkit-web-engine.cpp + dali-toolkit-test-utils/toolkit-window.cpp + dali-toolkit-test-utils/toolkit-scene-holder.cpp + dali-toolkit-test-utils/dali-test-suite-utils.cpp + dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp + dali-toolkit-test-utils/dummy-control.cpp + dali-toolkit-test-utils/mesh-builder.cpp + dali-toolkit-test-utils/test-actor-utils.cpp + dali-toolkit-test-utils/test-animation-data.cpp + dali-toolkit-test-utils/test-application.cpp + dali-toolkit-test-utils/test-button.cpp + dali-toolkit-test-utils/test-harness.cpp + dali-toolkit-test-utils/test-gesture-generator.cpp + dali-toolkit-test-utils/test-gl-abstraction.cpp + dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + dali-toolkit-test-utils/test-platform-abstraction.cpp + dali-toolkit-test-utils/test-render-controller.cpp + dali-toolkit-test-utils/test-trace-call-stack.cpp + dali-toolkit-test-utils/test-native-image.cpp +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + dali-core + dali-adaptor + dali-toolkit +) + +ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror -DDEBUG_ENABLED) +ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} ) + +ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" ) + +FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}") +ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) + +INCLUDE_DIRECTORIES( + ../../../ + ${${CAPI_LIB}_INCLUDE_DIRS} + dali-toolkit-test-utils +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + -lpthread --coverage +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${EXEC_NAME} +) diff --git a/docs/generated-internal/README.md b/docs/generated-internal/README.md new file mode 100644 index 0000000..f8acdfb --- /dev/null +++ b/docs/generated-internal/README.md @@ -0,0 +1,25 @@ +Deep internal documentation for DALi Toolkit. + +Generate the documentation here as follows: + + # Go to dali-toolkit/build/tizen/docs-internal/ + cd ../../build/tizen/docs-internal/ + # Start doxygen: + ./build.sh + +Note, the doxfile assumes you have your DALi repositories checked-out +side by side with the following structure: + + . + ├── dali + ├── dali-adaptor + └── dali-toolkit + +If you have used different names or structure, you will need to adjust +the value of the `INPUT` variable in the doxyfile: + + build/tizen/docs-internal/dali_internal.doxy + + + + -- 2.7.4 From e2d8604dd9d2ea5ce677fba0a0a13c9538316d4b Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 24 Apr 2020 14:26:59 +0900 Subject: [PATCH 04/16] Add missing files Change-Id: Iff4378f5fbc81bfd2820695839fb98f97c43d71a --- docs/content/example-code/.gitignore | 6 ++++++ docs/generated-internal/.gitignore | 1 + 2 files changed, 7 insertions(+) create mode 100644 docs/content/example-code/.gitignore create mode 100644 docs/generated-internal/.gitignore diff --git a/docs/content/example-code/.gitignore b/docs/content/example-code/.gitignore new file mode 100644 index 0000000..06994ce --- /dev/null +++ b/docs/content/example-code/.gitignore @@ -0,0 +1,6 @@ +/CMakeFiles +/cmake_install.cmake +/build +*.example +/Makefile +/CMakeCache.txt diff --git a/docs/generated-internal/.gitignore b/docs/generated-internal/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/docs/generated-internal/.gitignore @@ -0,0 +1 @@ +* -- 2.7.4 From ef138b878026858748f6303d91845c6a94adcb34 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Thu, 16 Apr 2020 12:47:47 +0900 Subject: [PATCH 05/16] Add Pixel format for depth and stencil - add cases on the switch to control pixel enum Change-Id: Ib9c88d92926263e24fbd18c9bbed17ee76559a71 Signed-off-by: Seungho, Baek --- build/tizen/docs/dali.doxy.in | 6 ++++-- dali-toolkit/internal/visuals/npatch-loader.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/tizen/docs/dali.doxy.in b/build/tizen/docs/dali.doxy.in index 2124ce7..7f304a8 100644 --- a/build/tizen/docs/dali.doxy.in +++ b/build/tizen/docs/dali.doxy.in @@ -355,7 +355,7 @@ ALIASES += SINCE_1_1="@since 1.1" ALIASES += SINCE_1_2="@since 1.2" ALIASES += SINCE_1_3="@since 1.3" ALIASES += SINCE_1_4="@since 1.4" -ALIASES += SINCE_1_9="@since 1.9" +ALIASES += SINCE_1_5="@since 1.5" # Extra tags for Tizen 3.0 ALIASES += SINCE_1_2_2="@since 1.2.2" @@ -373,6 +373,7 @@ ALIASES += SINCE_1_3_15="@since 1.3.15" #Extra tags for Tizen 5.5 ALIASES += SINCE_1_3_31="@since 1.3.31" +ALIASES += SINCE_1_5_9="@since 1.5.9" ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 1.0" ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 1.1" @@ -401,7 +402,7 @@ ALIASES += REMARK_RAWVIDEO="" #ALIASES += SINCE_1_2="\par Since:\n 4.0, DALi version 1.2" #ALIASES += SINCE_1_3="\par Since:\n 5.0, DALi version 1.3" #ALIASES += SINCE_1_4="\par Since:\n 5.5, DALi version 1.4" -#ALIASES += SINCE_1_9="\par Since:\n 6.0, DALi version 1.9" +#ALIASES += SINCE_1_5="\par Since:\n 6.0, DALi version 1.5" ## Extra tags for Tizen 3.0 #ALIASES += SINCE_1_2_2="\par Since:\n 3.0, DALi version 1.2.2" @@ -419,6 +420,7 @@ ALIASES += REMARK_RAWVIDEO="" #Extra tags for Tizen 5.5 #ALIASES += SINCE_1_3_31="\par Since:\n 5.5, DALi version 1.3.31" +#ALIASES += SINCE_1_5_9="\par Since:\n 5.5, DALi version 1.5.9" ## DALi has no deprecated API in Tizen 2.4 because it's DALi's first release. ## Thus deprecated APIs in DALi 1.0.xx will be deprecated in Tizen 3.0. diff --git a/dali-toolkit/internal/visuals/npatch-loader.cpp b/dali-toolkit/internal/visuals/npatch-loader.cpp index 6745adf..0c6409d 100644 --- a/dali-toolkit/internal/visuals/npatch-loader.cpp +++ b/dali-toolkit/internal/visuals/npatch-loader.cpp @@ -147,6 +147,9 @@ void GetRedOffsetAndMask( Dali::Pixel::Format pixelFormat, int& byteOffset, int& } case Dali::Pixel::RGB16F: case Dali::Pixel::RGB32F: + case Dali::Pixel::DEPTH_UNSIGNED_INT: + case Dali::Pixel::DEPTH_FLOAT: + case Dali::Pixel::DEPTH_STENCIL: { DALI_LOG_ERROR("Pixel format not compatible.\n"); byteOffset=0; -- 2.7.4 From c7405ffc304c9828997c67cbe16e3bb63f95169c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 14 Apr 2020 15:31:07 +0900 Subject: [PATCH 06/16] Fix corner radius shader of the ImageVisual It didn't work for premultiplied-alpha images. Change-Id: I69d612112cb0f1ef132979ce830c8466a639c6f7 --- dali-toolkit/internal/visuals/image-visual-shader-factory.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/internal/visuals/image-visual-shader-factory.cpp b/dali-toolkit/internal/visuals/image-visual-shader-factory.cpp index 7fe979f..d9f273c 100644 --- a/dali-toolkit/internal/visuals/image-visual-shader-factory.cpp +++ b/dali-toolkit/internal/visuals/image-visual-shader-factory.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. @@ -143,7 +143,7 @@ const char* VERTEX_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER( {\n vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n - vRectSize = visualSize / 2.0 - cornerRadius;\n + vRectSize = visualSize * 0.5 - cornerRadius;\n vPosition = aPosition* visualSize;\n return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n }\n @@ -164,12 +164,15 @@ const char* FRAGMENT_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER( uniform lowp vec4 uColor;\n uniform lowp vec3 mixColor;\n uniform mediump float cornerRadius;\n + uniform lowp float preMultipliedAlpha;\n \n void main()\n {\n mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - cornerRadius;\n + mediump float opacity = 1.0 - smoothstep( -1.0, 1.0, dist );\n gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n - gl_FragColor.a *= smoothstep( 1.0, -1.0, dist );\n + gl_FragColor.a *= opacity;\n + gl_FragColor.rgb *= mix( 1.0, opacity, preMultipliedAlpha );\n }\n ); -- 2.7.4 From 6c93277576af090570c5fe086011e14a91016e98 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Mon, 13 Apr 2020 10:04:47 +0900 Subject: [PATCH 07/16] text tiling If the length of text is very long and exceeds maxTextureSize, it cannot be displayed on the screen. So tiling is required. I implement tiling by attaching multiple renderers. And the MAX_TEXT_LENGTH limit is removed. sample) std::ifstream file; file.open(PATH[0]); std::stringstream ss; ss << file.rdbuf(); file.close(); ScrollView scroller = ScrollView::New(); scroller.SetPosition( 100.f, 100.f); scroller.SetSize(500.f, 1000.f); scroller.SetAnchorPoint(AnchorPoint::TOP_LEFT); scroller.SetParentOrigin(ParentOrigin::TOP_LEFT); scroller.SetAxisAutoLock(true); TextLabel textLabel = TextLabel::New( ); textLabel.SetProperty( TextLabel::Property::TEXT, ss.str() ); textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); textLabel.SetParentOrigin(ParentOrigin::TOP_LEFT); textLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "TOP" ); textLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); textLabel.SetProperty( TextLabel::Property::ELLIPSIS, false ); textLabel.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 16); textLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); scroller.Add( textLabel ); stage.Add( scroller ); Change-Id: I65082244a801ba697fd9ab0b598c82e702c2a948 --- .../utc-Dali-Text-Controller.cpp | 29 --- .../src/dali-toolkit/utc-Dali-TextLabel.cpp | 46 ++++ dali-toolkit/internal/text/text-controller.cpp | 10 +- dali-toolkit/internal/visuals/text/text-visual.cpp | 285 +++++++++++++++------ dali-toolkit/internal/visuals/text/text-visual.h | 91 ++++++- 5 files changed, 339 insertions(+), 122 deletions(-) mode change 100644 => 100755 dali-toolkit/internal/visuals/text/text-visual.h diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 7275618..3e53b67 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -1151,35 +1151,6 @@ int UtcDaliTextControllerSelectEvent(void) } -int UtcDaliTextControllerMaxLengthSetText(void) -{ - tet_infoline(" UtcDaliTextControllerMaxLengthSetText"); - ToolkitTestApplication application; - - // Creates a text controller. - ControllerPtr controller = Controller::New(); - - ConfigureTextLabel( controller ); - - const Length MAX_TEXT_LENGTH = 1024u * 32u; - - // make over length world - int maxLength = ( 1024u * 32u ) + 10u; - char world[maxLength] = { 'a' }; - - // Set the text - std::string text( world, maxLength ); - controller->SetText( text ); - - // check text length - controller->GetText( text ); - Length textSize = text.size(); - - DALI_TEST_EQUALS( MAX_TEXT_LENGTH, textSize, TEST_LOCATION ); - - END_TEST; -} - int UtcDaliTextControllerRemoveTextChangeEventData(void) { tet_infoline(" UtcDaliTextControllerRemoveTextChangeEventData"); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index d8c5f70..9f9ce5f 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include using namespace Dali; @@ -1535,3 +1536,48 @@ int UtcDaliToolkitTextlabelTextFit(void) END_TEST; } + +int UtcDaliToolkitTextlabelMaxTextureSet(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet"); + + DevelText::BitmapFontDescription fontDescription; + fontDescription.name = "Digits"; + fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } ); + + TextAbstraction::BitmapFont bitmapFont; + DevelText::CreateBitmapFont( fontDescription, bitmapFont ); + + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); + fontClient.GetFontId( bitmapFont ); + + TextLabel label = TextLabel::New(); + label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" ); + label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); + label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." ); + label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f ); + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); + + Property::Map underlineMapSet; + underlineMapSet.Clear(); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::RED ); + underlineMapSet.Insert( "height", 1 ); + label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + + Stage::GetCurrent().Add( label ); + + application.SendNotification(); + application.Render(); + + const int maxTextureSize = Dali::GetMaxTextureSize(); + // Whether the rendered text is greater than maxTextureSize + DALI_TEST_CHECK( label.GetCurrentSize().height > maxTextureSize ); + + // Check if the number of renderers is greater than 1. + DALI_TEST_CHECK( label.GetRendererCount() > 1u ); + + END_TEST; +} diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 0407147..8aaefae 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -62,7 +62,6 @@ const char * const PLACEHOLDER_FONT_STYLE = "fontStyle"; const char * const PLACEHOLDER_POINT_SIZE = "pointSize"; const char * const PLACEHOLDER_PIXEL_SIZE = "pixelSize"; const char * const PLACEHOLDER_ELLIPSIS = "ellipsis"; -const unsigned int MAX_TEXT_LENGTH = 1024u * 32u; float ConvertToEven( float value ) { @@ -321,7 +320,7 @@ bool Controller::IsSmoothHandlePanEnabled() const void Controller::SetMaximumNumberOfCharacters( Length maxCharacters ) { - mImpl->mMaximumNumberOfCharacters = std::min( maxCharacters, MAX_TEXT_LENGTH ); + mImpl->mMaximumNumberOfCharacters = maxCharacters; } int Controller::GetMaximumNumberOfCharacters() @@ -702,13 +701,6 @@ void Controller::SetText( const std::string& text ) utf8 = reinterpret_cast( text.c_str() ); } - // Limit the text size. If the text size is too large, crash or deadlock will occur. - if( textSize > MAX_TEXT_LENGTH ) - { - DALI_LOG_WARNING( "The text size is too large(%d), limit the length to 32,768u\n", textSize ); - textSize = MAX_TEXT_LENGTH; - } - // Convert text into UTF-32 Vector& utf32Characters = mImpl->mModel->mLogicalModel->mText; utf32Characters.Resize( textSize ); diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index e0b16e9..9ddbf3b 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include // INTERNAL HEADER #include @@ -453,21 +456,32 @@ void TextVisual::DoSetOnStage( Actor& actor ) // Renderer needs textures and to be added to control mRendererUpdateNeeded = true; + mRendererList.push_back( mImpl->mRenderer ); + UpdateRenderer(); } -void TextVisual::DoSetOffStage( Actor& actor ) +void TextVisual::RemoveRenderer( Actor& actor ) { - if( mImpl->mRenderer ) + for( RendererContainer::iterator iter = mRendererList.begin(); iter != mRendererList.end(); ++iter) { - // Removes the renderer from the actor. - actor.RemoveRenderer( mImpl->mRenderer ); + Renderer renderer = (*iter); + if( renderer ) + { + // Removes the renderer from the actor. + actor.RemoveRenderer( renderer ); + } + } + // Clear the renderer list + mRendererList.clear(); +} - RemoveTextureSet(); +void TextVisual::DoSetOffStage( Actor& actor ) +{ + RemoveRenderer( actor ); - // Resets the renderer. - mImpl->mRenderer.Reset(); - } + // Resets the renderer. + mImpl->mRenderer.Reset(); // Resets the control handle. mControl.Reset(); @@ -597,14 +611,8 @@ void TextVisual::UpdateRenderer() if( ( fabsf( relayoutSize.width ) < Math::MACHINE_EPSILON_1000 ) || ( fabsf( relayoutSize.height ) < Math::MACHINE_EPSILON_1000 ) || text.empty() ) { - // Removes the texture set. - RemoveTextureSet(); - - // Remove any renderer previously set. - if( mImpl->mRenderer ) - { - control.RemoveRenderer( mImpl->mRenderer ); - } + // Remove the texture set and any renderer previously set. + RemoveRenderer( control ); // Nothing else to do if the relayout size is zero. ResourceReady( Toolkit::Visual::ResourceStatus::READY ); @@ -620,14 +628,8 @@ void TextVisual::UpdateRenderer() { mRendererUpdateNeeded = false; - // Removes the texture set. - RemoveTextureSet(); - - // Remove any renderer previously set. - if( mImpl->mRenderer ) - { - control.RemoveRenderer( mImpl->mRenderer ); - } + // Remove the texture set and any renderer previously set. + RemoveRenderer( control ); if( ( relayoutSize.width > Math::MACHINE_EPSILON_1000 ) && ( relayoutSize.height > Math::MACHINE_EPSILON_1000 ) ) @@ -670,48 +672,196 @@ void TextVisual::UpdateRenderer() const bool styleEnabled = ( shadowEnabled || underlineEnabled || outlineEnabled || backgroundEnabled ); - TextureSet textureSet = GetTextTexture( relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled ); - mImpl->mRenderer.SetTextures( textureSet ); - Shader shader = GetTextShader( mFactoryCache, hasMultipleTextColors, containsColorGlyph, styleEnabled ); - mImpl->mRenderer.SetShader(shader); + AddRenderer( control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled ); - mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED; + // Text rendered and ready to display + ResourceReady( Toolkit::Visual::ResourceStatus::READY ); + } + } +} - mImpl->mRenderer.RegisterProperty( "uHasMultipleTextColors", static_cast( hasMultipleTextColors ) ); +void TextVisual::AddTexture( TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex ) +{ + Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, + data.GetPixelFormat(), + data.GetWidth(), + data.GetHeight() ); + texture.Upload( data ); + + textureSet.SetTexture( textureSetIndex, texture ); + textureSet.SetSampler( textureSetIndex, sampler ); +} - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); +PixelData TextVisual::ConvertToPixelData( unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat ) +{ + int bpp = Pixel::GetBytesPerPixel( textPixelFormat ); + unsigned int bufferSize = width * height * bpp; + unsigned char* dstBuffer = static_cast( malloc ( bufferSize ) ); + memcpy( dstBuffer, buffer + offsetPosition * bpp, bufferSize ); + PixelData pixelData = Dali::PixelData::New( dstBuffer, + bufferSize, + width, + height, + textPixelFormat, + Dali::PixelData::FREE ); + return pixelData; +} - //Register transform properties - mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); +void TextVisual::CreateTextureSet( TilingInfo& info, Renderer& renderer, Sampler& sampler, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled ) +{ - control.AddRenderer( mImpl->mRenderer ); + TextureSet textureSet = TextureSet::New(); + unsigned int textureSetIndex = 0u; - // Text rendered and ready to display - ResourceReady( Toolkit::Visual::ResourceStatus::READY ); - } + // Convert the buffer to pixel data to make it a texture. + if( info.textBuffer ) + { + PixelData data = ConvertToPixelData( info.textBuffer, info.width, info.height, info.offsetPosition, info.textPixelFormat ); + AddTexture( textureSet, data, sampler, textureSetIndex ); + ++textureSetIndex; } + + if( styleEnabled && info.styleBuffer ) + { + PixelData styleData = ConvertToPixelData( info.styleBuffer, info.width, info.height, info.offsetPosition, Pixel::RGBA8888 ); + AddTexture( textureSet, styleData, sampler, textureSetIndex ); + ++textureSetIndex; + } + + if( containsColorGlyph && !hasMultipleTextColors && info.maskBuffer ) + { + PixelData maskData = ConvertToPixelData( info.maskBuffer, info.width, info.height, info.offsetPosition, Pixel::L8 ); + AddTexture( textureSet, maskData, sampler, textureSetIndex ); + } + + renderer.SetTextures( textureSet ); + + //Register transform properties + mImpl->mTransform.RegisterUniforms( renderer, Direction::LEFT_TO_RIGHT ); + + // Enable the pre-multiplied alpha to improve the text quality + renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true ); + renderer.RegisterProperty( PREMULTIPLIED_ALPHA, 1.0f ); + + // Set size and offset for the tiling. + renderer.RegisterProperty( SIZE, Vector2( info.width, info.height ) ); + renderer.RegisterProperty( OFFSET, Vector2( info.offSet.x, info.offSet.y ) ); + renderer.RegisterProperty( "uHasMultipleTextColors", static_cast( hasMultipleTextColors ) ); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); + + mRendererList.push_back( renderer ); } -void TextVisual::RemoveTextureSet() + +void TextVisual::AddRenderer( Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled ) { - if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) + Shader shader = GetTextShader( mFactoryCache, hasMultipleTextColors, containsColorGlyph, styleEnabled ); + mImpl->mRenderer.SetShader( shader ); + + // Get the maximum size. + const int maxTextureSize = Dali::GetMaxTextureSize(); + + // No tiling required. Use the default renderer. + if( size.height < maxTextureSize ) + { + TextureSet textureSet = GetTextTexture( size, hasMultipleTextColors, containsColorGlyph, styleEnabled ); + + mImpl->mRenderer.SetTextures( textureSet ); + //Register transform properties + mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); + mImpl->mRenderer.RegisterProperty( "uHasMultipleTextColors", static_cast( hasMultipleTextColors ) ); + mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); + + mRendererList.push_back( mImpl->mRenderer ); + } + // If the pixel data exceeds the maximum size, tiling is required. + else { - // Removes the text's image from the texture atlas. - Vector4 atlasRect; + // Filter mode needs to be set to linear to produce better quality while scaling. + Sampler sampler = Sampler::New(); + sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR ); + + // Create RGBA texture if the text contains emojis or multiple text colors, otherwise L8 texture + Pixel::Format textPixelFormat = ( containsColorGlyph || hasMultipleTextColors ) ? Pixel::RGBA8888 : Pixel::L8; + + // Check the text direction + Toolkit::DevelText::TextDirection::Type textDirection = mController->GetTextDirection(); + + // Create a texture for the text without any styles + PixelData data = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_NO_STYLES, false, textPixelFormat ); + + int verifiedWidth = data.GetWidth(); + int verifiedHeight = data.GetHeight(); + + // Set information for creating textures. + TilingInfo info( verifiedWidth, maxTextureSize, textPixelFormat ); + + // Get the buffer of text. + Dali::DevelPixelData::PixelDataBuffer textPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( data ); + info.textBuffer = textPixelData.buffer; + + if( styleEnabled ) + { + // Create RGBA texture for all the text styles (without the text itself) + PixelData styleData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_NO_TEXT, false, Pixel::RGBA8888 ); + Dali::DevelPixelData::PixelDataBuffer stylePixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( styleData ); + info.styleBuffer = stylePixelData.buffer; + } + + if ( containsColorGlyph && !hasMultipleTextColors ) + { + // Create a L8 texture as a mask to avoid color glyphs (e.g. emojis) to be affected by text color animation + PixelData maskData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_MASK, false, Pixel::L8 ); + Dali::DevelPixelData::PixelDataBuffer maskPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( maskData ); + info.maskBuffer = maskPixelData.buffer; + } + + // Get the current offset for recalculate the offset when tiling. + Property::Map retMap; + mImpl->mTransform.GetPropertyMap( retMap ); + Vector2 offSet = retMap.Find( Dali::Toolkit::Visual::Transform::Property::OFFSET )->Get< Vector2 >(); + info.offSet = offSet; + + // Create a textureset in the default renderer. + CreateTextureSet( info, mImpl->mRenderer, sampler, hasMultipleTextColors, containsColorGlyph, styleEnabled ); - const Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME ); - if( index != Property::INVALID_INDEX ) + verifiedHeight -= maxTextureSize; + + Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); + + int offsetPosition = verifiedWidth * maxTextureSize; + // Create a renderer by cutting maxTextureSize. + while( verifiedHeight > 0 ) { - const Property::Value& atlasRectValue = mImpl->mRenderer.GetProperty( index ); - atlasRectValue.Get( atlasRect ); + Renderer tilingRenderer = Renderer::New( geometry, shader ); + tilingRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT ); + // New offset position of buffer for tiling. + info.offsetPosition += offsetPosition; + // New height for tiling. + info.height = ( verifiedHeight - maxTextureSize ) > 0 ? maxTextureSize : verifiedHeight; + // New offset for tiling. + info.offSet.y += maxTextureSize; + // Create a textureset int the new tiling renderer. + CreateTextureSet( info, tilingRenderer, sampler, hasMultipleTextColors, containsColorGlyph, styleEnabled ); + + verifiedHeight -= maxTextureSize; + } + } + + mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED; - const TextureSet& textureSet = mImpl->mRenderer.GetTextures(); - mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect ); + for( RendererContainer::iterator iter = mRendererList.begin(); iter != mRendererList.end(); ++iter) + { + Renderer renderer = (*iter); + if( renderer ) + { + actor.AddRenderer( renderer ); } } } + TextureSet TextVisual::GetTextTexture( const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled ) { // Filter mode needs to be set to linear to produce better quality while scaling. @@ -731,31 +881,18 @@ TextureSet TextVisual::GetTextTexture( const Vector2& size, bool hasMultipleText // It may happen the image atlas can't handle a pixel data it exceeds the maximum size. // In that case, create a texture. TODO: should tile the text. + unsigned int textureSetIndex = 0u; - Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, - data.GetPixelFormat(), - data.GetWidth(), - data.GetHeight() ); - - texture.Upload( data ); - - textureSet.SetTexture( 0u, texture ); - textureSet.SetSampler( 0u, sampler ); + AddTexture( textureSet, data, sampler, textureSetIndex ); + ++textureSetIndex; if ( styleEnabled ) { // Create RGBA texture for all the text styles (without the text itself) PixelData styleData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_NO_TEXT, false, Pixel::RGBA8888 ); - Texture styleTexture = Texture::New( Dali::TextureType::TEXTURE_2D, - styleData.GetPixelFormat(), - styleData.GetWidth(), - styleData.GetHeight() ); - - styleTexture.Upload( styleData ); - - textureSet.SetTexture( 1u, styleTexture ); - textureSet.SetSampler( 1u, sampler ); + AddTexture( textureSet, styleData, sampler, textureSetIndex ); + ++textureSetIndex; } if ( containsColorGlyph && !hasMultipleTextColors ) @@ -763,23 +900,7 @@ TextureSet TextVisual::GetTextTexture( const Vector2& size, bool hasMultipleText // Create a L8 texture as a mask to avoid color glyphs (e.g. emojis) to be affected by text color animation PixelData maskData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_MASK, false, Pixel::L8 ); - Texture maskTexture = Texture::New( Dali::TextureType::TEXTURE_2D, - maskData.GetPixelFormat(), - maskData.GetWidth(), - maskData.GetHeight() ); - - maskTexture.Upload( maskData ); - - if ( !styleEnabled ) - { - textureSet.SetTexture( 1u, maskTexture ); - textureSet.SetSampler( 1u, sampler ); - } - else - { - textureSet.SetTexture( 2u, maskTexture ); - textureSet.SetSampler( 2u, sampler ); - } + AddTexture( textureSet, maskData, sampler, textureSetIndex ); } return textureSet; diff --git a/dali-toolkit/internal/visuals/text/text-visual.h b/dali-toolkit/internal/visuals/text/text-visual.h old mode 100644 new mode 100755 index 6f47e45..16da39a --- a/dali-toolkit/internal/visuals/text/text-visual.h +++ b/dali-toolkit/internal/visuals/text/text-visual.h @@ -182,6 +182,48 @@ protected: void OnSetTransform() override; private: + + struct TilingInfo + { + unsigned char* textBuffer; + unsigned char* styleBuffer; + unsigned char* maskBuffer; + int width; + int height; + Pixel::Format textPixelFormat; + int offsetPosition; + Vector2 offSet; + + TilingInfo( int width, int height, Pixel::Format textPixelFormat ) + : textBuffer( NULL ), + styleBuffer( NULL ), + maskBuffer( NULL ), + width( width ), + height( height ), + textPixelFormat( textPixelFormat ), + offsetPosition( 0 ), + offSet( 0.f, 0.f ) + { + } + + ~TilingInfo() + { + if( textBuffer ) + { + free( textBuffer ); + } + if( styleBuffer ) + { + free( styleBuffer ); + } + if( maskBuffer ) + { + free( maskBuffer ); + } + } + + }; + /** * @brief Set the individual property to the given value. * @@ -197,9 +239,50 @@ private: void UpdateRenderer(); /** - * @brief Removes the texture set from the renderer. + * @brief Removes the text's renderer. + */ + void RemoveRenderer( Actor& actor ); + + /** + * @brief Create a texture in textureSet and add it. + * @param[in] textureSet The textureSet to which the texture will be added. + * @param[in] data The PixelData to be uploaded to texture + * @param[in] sampler The sampler. + * @param[in] textureSetIndex The Index of TextureSet. + */ + void AddTexture( TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex ); + + /** + * @brief Convert the buffer to pixelData. + * @param[in] buffer The Buffer to be converted to pixelData. + * @param[in] width The width of pixel data. + * @param[in] height The height of pixel data. + * @param[in] offsetPosition The The buffer's start position. + * @param[in] textPixelFormat The PixelForma of text. + */ + PixelData ConvertToPixelData( unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat ); + + /** + * @brief Create the text's texture. + * @param[in] info This is the information you need to create a Tiling. + * @param[in] renderer The renderer to which the TextureSet will be added. + * @param[in] sampler The sampler. + * @param[in] hasMultipleTextColors Whether the text contains multiple colors. + * @param[in] containsColorGlyph Whether the text contains color glyph. + * @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.). */ - void RemoveTextureSet(); + void CreateTextureSet( TilingInfo& info, Renderer& renderer, Sampler& sampler, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled ); + + /** + * Create renderer of the text for rendering. + * @param[in] actor The actor. + * @param[in] size The texture size. + * @param[in] hasMultipleTextColors Whether the text contains multiple colors. + * @param[in] containsColorGlyph Whether the text contains color glyph. + * @param[in] styleEnabled Whether the text contains any styles (e.g. shadow, underline, etc.). + */ + void AddRenderer( Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled ); + /** * Get the texture of the text for rendering. @@ -231,6 +314,8 @@ private: private: + typedef std::vector< Renderer > RendererContainer; + /** * Used as an alternative to boolean so that it is obvious whether the text contains single or multiple text colors, and emoji and styles. */ @@ -247,12 +332,14 @@ private: }; }; + private: Text::ControllerPtr mController; ///< The text's controller. Text::TypesetterPtr mTypesetter; ///< The text's typesetter. WeakHandle mControl; ///< The control where the renderer is added. Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control. bool mRendererUpdateNeeded:1; ///< The flag to indicate whether the renderer needs to be updated. + RendererContainer mRendererList; }; } // namespace Internal -- 2.7.4 From 60b18668b605e921157ccb24a1258dd1ad5b2e64 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 27 Apr 2020 13:01:56 +0900 Subject: [PATCH 08/16] DALi Version 1.5.9 Change-Id: If4e38ff47911ea83435fde244fccedbbe28be255 --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 464d107..68c5073 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 8; +const unsigned int TOOLKIT_MICRO_VERSION = 9; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 700f4d2..0f574ca 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -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 32c501563f48bedb5136835c41254e152f611bfe Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Fri, 10 Apr 2020 18:00:40 +0900 Subject: [PATCH 09/16] Doxy patch for Capture ACR Change-Id: I62bacba01a73244489ff3286b598a229522694b6 Signed-off-by: Seungho, Baek --- build/tizen/docs/dali.doxy.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tizen/docs/dali.doxy.in b/build/tizen/docs/dali.doxy.in index 7f304a8..591c29f 100644 --- a/build/tizen/docs/dali.doxy.in +++ b/build/tizen/docs/dali.doxy.in @@ -413,12 +413,12 @@ ALIASES += REMARK_RAWVIDEO="" #ALIASES += SINCE_1_2_32="\par Since:\n 3.0, DALi version 1.2.32" ## Extra tags for Tizen 4.0 -#ALIASES += SINCE_1_3_4="\par Since:\n 4.0, DALi version 1.3.4" +#ALIASES += SINCE_1_3_4="\par Since:\n @if WEARABLE 4.0 @elseif 6.0 @endif, DALi version 1.3.4" #ALIASES += SINCE_1_3_5="\par Since:\n 4.0, DALi version 1.3.5" #ALIASES += SINCE_1_3_9="\par Since:\n 4.0, DALi version 1.3.9" #ALIASES += SINCE_1_3_15="\par Since:\n 4.0, DALi version 1.3.15" -#Extra tags for Tizen 5.5 +##Extra tags for Tizen 5.5 #ALIASES += SINCE_1_3_31="\par Since:\n 5.5, DALi version 1.3.31" #ALIASES += SINCE_1_5_9="\par Since:\n 5.5, DALi version 1.5.9" -- 2.7.4 From e55ceb6575f28fd81082faa7c76f41a523b71266 Mon Sep 17 00:00:00 2001 From: Ali Date: Mon, 20 Apr 2020 10:51:54 +0300 Subject: [PATCH 10/16] Add support to unselect text And Get_SelectedText This patch add two kind of support for TextField 1- SelectNone function: this will unselect text in textfield Programmatically by user. 2- Selected_Text property: this is readonly to return string for selected text. After this patch approve, I will create other one for dali-csharp-bindings Change-Id: If93ed6df44a41ff00f772a0abcfc9e2401c41480 --- .../utc-Dali-Text-Controller.cpp | 4 +- .../src/dali-toolkit/utc-Dali-TextField.cpp | 49 ++++++++++++++++++++++ .../controls/text-controls/text-field-devel.cpp | 5 +++ .../controls/text-controls/text-field-devel.h | 26 +++++++++++- .../controls/text-controls/text-field-impl.cpp | 20 ++++++++- .../controls/text-controls/text-field-impl.h | 11 +++++ .../internal/text/text-controller-impl.cpp | 26 ++++++++++++ dali-toolkit/internal/text/text-controller-impl.h | 5 ++- dali-toolkit/internal/text/text-controller.cpp | 23 ++++++++-- dali-toolkit/internal/text/text-controller.h | 21 +++++++++- .../public-api/controls/text-controls/text-field.h | 2 +- 11 files changed, 179 insertions(+), 13 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 3e53b67..0e8a597 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -1124,7 +1124,7 @@ int UtcDaliTextControllerSelectEvent(void) controller->SetText( text ); // Select the whole text. - controller->SelectEvent( 0.f, 0.f, false ); + controller->SelectEvent( 0.f, 0.f, SelectionType::INTERACTIVE ); // Perform a relayout const Size size( Dali::Stage::GetCurrent().GetSize() ); @@ -1139,7 +1139,7 @@ int UtcDaliTextControllerSelectEvent(void) DALI_TEST_EQUALS( "Hello", retrieved_text, TEST_LOCATION ); // Select the whole text. - controller->SelectEvent( 0.f, 0.f, true ); + controller->SelectEvent( 0.f, 0.f, SelectionType::ALL ); // Perform a relayout controller->Relayout( size ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 7e050ff..e58ab4d 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -2872,3 +2872,52 @@ int UtcDaliTextFieldSelectWholeText(void) END_TEST; } + +int UtcDaliTextFieldSelectNone(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldSelectWholeText "); + + TextField textField = TextField::New(); + + Stage::GetCurrent().Add( textField ); + + textField.SetSize( 300.f, 50.f ); + textField.SetParentOrigin( ParentOrigin::TOP_LEFT ); + textField.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + application.SendNotification(); + application.Render(); + + textField.SetProperty( TextField::Property::TEXT, "Hello world" ); + + application.SendNotification(); + application.Render(); + + // Nothing is selected + std::string selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION ); + + DevelTextField::SelectWholeText( textField ); + + application.SendNotification(); + application.Render(); + + // whole text is selected + selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "Hello world", selectedText, TEST_LOCATION ); + + DevelTextField::SelectNone( textField ); + + application.SendNotification(); + application.Render(); + + // Nothing is selected + selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get(); + DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION ); + + END_TEST; +} diff --git a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp index a53ef4a..e926401 100755 --- a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp +++ b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp @@ -38,6 +38,11 @@ void SelectWholeText( TextField textField ) GetImpl( textField ).SelectWholeText(); } +void SelectNone( TextField textField ) +{ + GetImpl( textField ).SelectNone(); +} + } // namespace DevelText } // namespace Toolkit diff --git a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h index 3a4864c..0d10779 100755 --- a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h @@ -122,7 +122,15 @@ namespace Property * @note Use "textBackground" as property name to avoid conflict with Control's "background" property. * @note The default value is Color::TRANSPARENT. */ - BACKGROUND = ELLIPSIS + 5 + BACKGROUND = ELLIPSIS + 5, + + + /** + * @brief The selected text in UTF-8 format. + * @details Name "selectedText", type Property::STRING. + * @note This property is read-only. + */ + SELECTED_TEXT = ELLIPSIS + 6 }; } // namespace Property @@ -139,10 +147,24 @@ DALI_TOOLKIT_API InputMethodContext GetInputMethodContext( TextField textField ) * @brief Select the whole text of TextField. * * @param[in] textField The instance of TextField. - * @return InputMethodContext instance. */ DALI_TOOLKIT_API void SelectWholeText( TextField textField ); +/** + * @brief Unselect the whole text of TextField. + * + * @param[in] textField The instance of TextField. + */ +DALI_TOOLKIT_API void SelectNone( TextField textField ); + +/** + * @brief Get the selected text of TextField. + * + * @param[in] textField The instance of TextField. + * @return Selected text in the TextField. + */ +DALI_TOOLKIT_API std::string SelectedText( TextField textField ); + } // namespace DevelText } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index e9d1fe4..f9b4b70 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -135,6 +135,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground", VECTOR4, BACKGROUND ) +DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextField, "selectedText", STRING, SELECTED_TEXT ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -1212,6 +1213,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextField::Property::SELECTED_TEXT: + { + if( impl.mController ) + { + value = impl.mController->GetSelectedText( ); + } + break; + } } //switch } @@ -1222,7 +1231,16 @@ void TextField::SelectWholeText() { if( mController && mController->IsShowingRealText() ) { - mController->SelectEvent( 0.f, 0.f, true ); + mController->SelectEvent( 0.f, 0.f, SelectionType::ALL ); + SetKeyInputFocus(); + } +} + +void TextField::SelectNone() +{ + if( mController && mController->IsShowingRealText() ) + { + mController->SelectEvent( 0.f, 0.f, SelectionType::NONE ); SetKeyInputFocus(); } } diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.h b/dali-toolkit/internal/controls/text-controls/text-field-impl.h index 25bd4bd..3fd32a0 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.h @@ -107,6 +107,17 @@ public: */ void SelectWholeText(); + /** + * @brief Called to unselect the whole texts. + */ + void SelectNone(); + + /** + * @brief Called to get selected text. + * @return Selected text in the TextField. + */ + std::string SelectedText(); + private: // From Control /** diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 8f4de65..4df4d38 100755 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -221,6 +221,11 @@ bool Controller::Impl::ProcessInputEvents() OnSelectAllEvent(); break; } + case Event::SELECT_NONE: + { + OnSelectNoneEvent(); + break; + } } } } @@ -2015,6 +2020,27 @@ void Controller::Impl::OnSelectAllEvent() } } +void Controller::Impl::OnSelectNoneEvent() +{ + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "OnSelectNoneEvent mEventData->mSelectionEnabled%s \n", mEventData->mSelectionEnabled?"true":"false"); + + if( NULL == mEventData ) + { + // Nothing to do if there is no text. + return; + } + + if( mEventData->mSelectionEnabled && mEventData->mState == EventData::SELECTING) + { + mEventData->mPrimaryCursorPosition = 0u; + mEventData->mLeftSelectionPosition = mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition; + ChangeState( EventData::INACTIVE ); + mEventData->mUpdateCursorPosition = true; + mEventData->mUpdateInputStyle = true; + mEventData->mScrollAfterUpdatePosition = true; + } +} + void Controller::Impl::RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval ) { if( mEventData->mLeftSelectionPosition == mEventData->mRightSelectionPosition ) diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 064d644..981e498 100755 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -61,7 +61,8 @@ struct Event LEFT_SELECTION_HANDLE_EVENT, RIGHT_SELECTION_HANDLE_EVENT, SELECT, - SELECT_ALL + SELECT_ALL, + SELECT_NONE, }; union Param @@ -619,6 +620,8 @@ struct Controller::Impl void OnSelectAllEvent(); + void OnSelectNoneEvent(); + /** * @brief Retrieves the selected text. It removes the text if the @p deleteAfterRetrieval parameter is @e true. * diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 8aaefae..b4624dc 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -3033,17 +3033,22 @@ void Controller::LongPressEvent( Gesture::State state, float x, float y ) } } -void Controller::SelectEvent( float x, float y, bool selectAll ) +void Controller::SelectEvent( float x, float y, SelectionType selectType ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SelectEvent\n" ); if( NULL != mImpl->mEventData ) { - if( selectAll ) + if( selectType == SelectionType::ALL ) { Event event( Event::SELECT_ALL ); mImpl->mEventData->mEventQueue.push_back( event ); } + else if( selectType == SelectionType::NONE ) + { + Event event( Event::SELECT_NONE ); + mImpl->mEventData->mEventQueue.push_back( event ); + } else { Event event( Event::SELECT ); @@ -3326,14 +3331,14 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt if( mImpl->mEventData->mSelectionEnabled ) { // Creates a SELECT event. - SelectEvent( currentCursorPosition.x, currentCursorPosition.y, false ); + SelectEvent( currentCursorPosition.x, currentCursorPosition.y, SelectionType::INTERACTIVE ); } break; } case Toolkit::TextSelectionPopup::SELECT_ALL: { // Creates a SELECT_ALL event - SelectEvent( 0.f, 0.f, true ); + SelectEvent( 0.f, 0.f, SelectionType::ALL ); break; } case Toolkit::TextSelectionPopup::CLIPBOARD: @@ -3755,6 +3760,16 @@ bool Controller::RemoveSelectedText() return textRemoved; } +std::string Controller::GetSelectedText() +{ + std::string text; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + mImpl->RetrieveSelection( text, false ); + } + return text; +} + // private : Relayout. bool Controller::DoRelayout( const Size& size, diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index 82a7a15..6a986f5 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -47,6 +47,16 @@ class EditableControlInterface; class View; class RenderingController; + /** + * @brief Text selection operations . + */ + enum SelectionType + { + INTERACTIVE = 0x0000, + ALL = 0x0001, + NONE = 0x0002 + }; + typedef IntrusivePtr ControllerPtr; /** @@ -1462,9 +1472,9 @@ public: // Text-input Event Queuing. * * @param[in] x The x position relative to the top-left of the parent control. * @param[in] y The y position relative to the top-left of the parent control. - * @param[in] selectAll Whether the whole text is selected. + * @param[in] selection type like the whole text is selected or unselected. */ - void SelectEvent( float x, float y, bool selectAll ); + void SelectEvent( float x, float y, SelectionType selection ); /** * @brief Event received from input method context @@ -1494,6 +1504,13 @@ public: // Text-input Event Queuing. */ Actor CreateBackgroundActor(); + /** + * @brief Retrive Selected text. + * + * @return The seleced text. + */ + std::string GetSelectedText(); + protected: // Inherit from Text::Decorator::ControllerInterface. /** diff --git a/dali-toolkit/public-api/controls/text-controls/text-field.h b/dali-toolkit/public-api/controls/text-controls/text-field.h index 133b2c7..6ac1887 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-field.h +++ b/dali-toolkit/public-api/controls/text-controls/text-field.h @@ -472,7 +472,7 @@ public: * @SINCE_1_2.60 * @note PLACEHOLDER map is used to add ellipsis to placeholder text. */ - ELLIPSIS, + ELLIPSIS }; }; -- 2.7.4 From 2a2a8820f28caea3802484e41a8c2459773ebebd Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 6 May 2020 16:50:31 +0900 Subject: [PATCH 11/16] DALi Version 1.5.10 Change-Id: I5adb8febacf31f6465e3202a6d73229281ea0395 --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 68c5073..f6d8027 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 9; +const unsigned int TOOLKIT_MICRO_VERSION = 10; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 0f574ca..71e75e1 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -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 23eacf8fa14ff20d37d5edb0f97af652e9149304 Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Wed, 6 May 2020 20:06:45 +0900 Subject: [PATCH 12/16] Update a font description run only in Selecting state for input font - When setting input font properties, its font description run has been updated in InsertText(). - UpdateSelectionFontStyleRun() resets the FontDescriptionRun value already set. - So, only in EventData::SELECTING state, updated a new font description run. Change-Id: I5c6643f919e077b2870d04c8a881ab9a1d125811 Signed-off-by: Seoyeon Kim --- .../utc-Dali-Text-Controller.cpp | 40 +++++ dali-toolkit/internal/text/text-controller.cpp | 161 ++++++++++++++------- 2 files changed, 148 insertions(+), 53 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 0e8a597..5db928d 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -1192,3 +1192,43 @@ int UtcDaliTextControllerRemoveTextChangeEventData(void) END_TEST; } + +int UtcDaliTextControllerCheckInputFontPointSizeUpdated(void) +{ + tet_infoline(" UtcDaliTextControllerCheckInputFontPointSizeUpdated"); + ToolkitTestApplication application; + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + ConfigureTextField(controller); + + // Set the text + const std::string text("Hello World!"); + controller->SetText( text ); + controller->SetInputFontPointSize( 1.0f ); + controller->KeyboardFocusGainEvent(); + + application.SendNotification(); + application.Render(); + + // Perform a relayout + const Size size( Dali::Stage::GetCurrent().GetSize() ); + controller->Relayout(size); + + // simulate a key event. + controller->KeyEvent( GenerateKey( "a", "a", 38, 0, 0, Dali::KeyEvent::Down ) ); + + // change the input font point size + controller->SetInputFontPointSize( 20.f ); + + application.SendNotification(); + application.Render(); + + // Perform a relayout + controller->Relayout(size); + + tet_result(TET_PASS); + + END_TEST; +} diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index b4624dc..9a46e8b 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1520,17 +1520,32 @@ void Controller::SetInputFontFamily( const std::string& fontFamily ) { CharacterIndex startOfSelectedText = 0u; Length lengthOfSelectedText = 0u; - FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, - mImpl->mModel->mLogicalModel, - startOfSelectedText, - lengthOfSelectedText ); - fontDescriptionRun.familyLength = fontFamily.size(); - fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength]; - memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength ); - fontDescriptionRun.familyDefined = true; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + // Update a font description run for the selecting state. + FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, + mImpl->mModel->mLogicalModel, + startOfSelectedText, + lengthOfSelectedText ); - // The memory allocated for the font family name is freed when the font description is removed from the logical model. + fontDescriptionRun.familyLength = fontFamily.size(); + fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength]; + memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength ); + fontDescriptionRun.familyDefined = true; + + // The memory allocated for the font family name is freed when the font description is removed from the logical model. + + mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; + } + else + { + mImpl->mTextUpdateInfo.mCharacterIndex = 0; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } // Request to relayout. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | @@ -1544,10 +1559,6 @@ void Controller::SetInputFontFamily( const std::string& fontFamily ) mImpl->mRecalculateNaturalSize = true; mImpl->RequestRelayout(); - mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; - // As the font changes, recalculate the handle positions is needed. mImpl->mEventData->mUpdateLeftSelectionPosition = true; mImpl->mEventData->mUpdateRightSelectionPosition = true; @@ -1579,13 +1590,28 @@ void Controller::SetInputFontWeight( FontWeight weight ) { CharacterIndex startOfSelectedText = 0u; Length lengthOfSelectedText = 0u; - FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, - mImpl->mModel->mLogicalModel, - startOfSelectedText, - lengthOfSelectedText ); - fontDescriptionRun.weight = weight; - fontDescriptionRun.weightDefined = true; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + // Update a font description run for the selecting state. + FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, + mImpl->mModel->mLogicalModel, + startOfSelectedText, + lengthOfSelectedText ); + + fontDescriptionRun.weight = weight; + fontDescriptionRun.weightDefined = true; + + mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; + } + else + { + mImpl->mTextUpdateInfo.mCharacterIndex = 0; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } // Request to relayout. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | @@ -1599,10 +1625,6 @@ void Controller::SetInputFontWeight( FontWeight weight ) mImpl->mRecalculateNaturalSize = true; mImpl->RequestRelayout(); - mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; - // As the font might change, recalculate the handle positions is needed. mImpl->mEventData->mUpdateLeftSelectionPosition = true; mImpl->mEventData->mUpdateRightSelectionPosition = true; @@ -1645,13 +1667,28 @@ void Controller::SetInputFontWidth( FontWidth width ) { CharacterIndex startOfSelectedText = 0u; Length lengthOfSelectedText = 0u; - FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, - mImpl->mModel->mLogicalModel, - startOfSelectedText, - lengthOfSelectedText ); - fontDescriptionRun.width = width; - fontDescriptionRun.widthDefined = true; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + // Update a font description run for the selecting state. + FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, + mImpl->mModel->mLogicalModel, + startOfSelectedText, + lengthOfSelectedText ); + + fontDescriptionRun.width = width; + fontDescriptionRun.widthDefined = true; + + mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; + } + else + { + mImpl->mTextUpdateInfo.mCharacterIndex = 0; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } // Request to relayout. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | @@ -1665,10 +1702,6 @@ void Controller::SetInputFontWidth( FontWidth width ) mImpl->mRecalculateNaturalSize = true; mImpl->RequestRelayout(); - mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; - // As the font might change, recalculate the handle positions is needed. mImpl->mEventData->mUpdateLeftSelectionPosition = true; mImpl->mEventData->mUpdateRightSelectionPosition = true; @@ -1711,13 +1744,28 @@ void Controller::SetInputFontSlant( FontSlant slant ) { CharacterIndex startOfSelectedText = 0u; Length lengthOfSelectedText = 0u; - FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, - mImpl->mModel->mLogicalModel, - startOfSelectedText, - lengthOfSelectedText ); - fontDescriptionRun.slant = slant; - fontDescriptionRun.slantDefined = true; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + // Update a font description run for the selecting state. + FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, + mImpl->mModel->mLogicalModel, + startOfSelectedText, + lengthOfSelectedText ); + + fontDescriptionRun.slant = slant; + fontDescriptionRun.slantDefined = true; + + mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; + } + else + { + mImpl->mTextUpdateInfo.mCharacterIndex = 0; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } // Request to relayout. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | @@ -1731,10 +1779,6 @@ void Controller::SetInputFontSlant( FontSlant slant ) mImpl->mRecalculateNaturalSize = true; mImpl->RequestRelayout(); - mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; - // As the font might change, recalculate the handle positions is needed. mImpl->mEventData->mUpdateLeftSelectionPosition = true; mImpl->mEventData->mUpdateRightSelectionPosition = true; @@ -1777,13 +1821,28 @@ void Controller::SetInputFontPointSize( float size ) { CharacterIndex startOfSelectedText = 0u; Length lengthOfSelectedText = 0u; - FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, - mImpl->mModel->mLogicalModel, - startOfSelectedText, - lengthOfSelectedText ); - fontDescriptionRun.size = static_cast( size * 64.f ); - fontDescriptionRun.sizeDefined = true; + if( EventData::SELECTING == mImpl->mEventData->mState ) + { + // Update a font description run for the selecting state. + FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData, + mImpl->mModel->mLogicalModel, + startOfSelectedText, + lengthOfSelectedText ); + + fontDescriptionRun.size = static_cast( size * 64.f ); + fontDescriptionRun.sizeDefined = true; + + mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; + } + else + { + mImpl->mTextUpdateInfo.mCharacterIndex = 0; + mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } // Request to relayout. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | @@ -1797,10 +1856,6 @@ void Controller::SetInputFontPointSize( float size ) mImpl->mRecalculateNaturalSize = true; mImpl->RequestRelayout(); - mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText; - mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText; - // As the font might change, recalculate the handle positions is needed. mImpl->mEventData->mUpdateLeftSelectionPosition = true; mImpl->mEventData->mUpdateRightSelectionPosition = true; -- 2.7.4 From 8c95b9918d50af7bd6a2b99c3c561dad98e84b68 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 13 May 2020 10:57:27 +0900 Subject: [PATCH 13/16] DALi Version 1.5.11 Change-Id: I3f871a321b667198f4b8e7dcce82f8bece25efb4 --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index f6d8027..340d5e9 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 10; +const unsigned int TOOLKIT_MICRO_VERSION = 11; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 71e75e1..5ba4e12 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -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 70e9012b77d2f2e5d4057ecc60c2a0754a9c9ccf Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Thu, 16 Apr 2020 14:41:52 +0900 Subject: [PATCH 14/16] Support rounded corners for GradientVisual Change-Id: Ibb63224756ad34359f84a7c620231a0cfa61ae3e --- .../src/dali-toolkit/utc-Dali-Visual.cpp | 45 +++++++ .../internal/visuals/gradient/gradient-visual.cpp | 142 ++++++++++++++++++--- .../internal/visuals/visual-factory-cache.h | 4 + 3 files changed, 174 insertions(+), 17 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 0a86423..aa1e8f6 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -3689,6 +3689,51 @@ int UtcDaliVisualRoundedCorner(void) DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION ); } + // gradient visual + { + VisualFactory factory = VisualFactory::Get(); + Property::Map properties; + float cornerRadius = 30.0f; + + properties[Visual::Property::TYPE] = Visual::GRADIENT; + properties[ColorVisual::Property::MIX_COLOR] = Color::BLUE; + properties[DevelVisual::Property::CORNER_RADIUS] = cornerRadius; + properties[GradientVisual::Property::START_POSITION] = Vector2( 0.5f, 0.5f ); + properties[GradientVisual::Property::END_POSITION] = Vector2( -0.5f, -0.5f ); + properties[GradientVisual::Property::UNITS] = GradientVisual::Units::USER_SPACE; + + Property::Array stopOffsets; + stopOffsets.PushBack( 0.0f ); + stopOffsets.PushBack( 0.6f ); + stopOffsets.PushBack( 1.0f ); + properties[GradientVisual::Property::STOP_OFFSET] = stopOffsets; + + Property::Array stopColors; + stopColors.PushBack( Color::RED ); + stopColors.PushBack( Color::YELLOW ); + stopColors.PushBack( Color::GREEN ); + properties[GradientVisual::Property::STOP_COLOR] = stopColors; + + Visual::Base visual = factory.CreateVisual( properties ); + + // trigger creation through setting on stage + DummyControl dummy = DummyControl::New( true ); + Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() ); + dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + + dummy.SetSize( 200.f, 200.f ); + dummy.SetParentOrigin( ParentOrigin::CENTER ); + Stage::GetCurrent().Add( dummy ); + + application.SendNotification(); + application.Render(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION ); + } + END_TEST; } diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index 53ea041..e1959e7 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.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. @@ -67,28 +67,26 @@ const char * const UNIFORM_ALIGNMENT_MATRIX_NAME( "uAlignmentMatrix" ); const unsigned int DEFAULT_OFFSET_MINIMUM = 0.0f; const unsigned int DEFAULT_OFFSET_MAXIMUM = 1.0f; -VisualFactoryCache::ShaderType GetShaderType( GradientVisual::Type type, Toolkit::GradientVisual::Units::Type units ) +VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[][4] = { - if( type == GradientVisual::LINEAR ) { - if( units == Toolkit::GradientVisual::Units::USER_SPACE ) - { - return VisualFactoryCache::GRADIENT_SHADER_LINEAR_USER_SPACE; - } - return VisualFactoryCache::GRADIENT_SHADER_LINEAR_BOUNDING_BOX; - } - else if( units == Toolkit::GradientVisual::Units::USER_SPACE ) + VisualFactoryCache::GRADIENT_SHADER_LINEAR_USER_SPACE, + VisualFactoryCache::GRADIENT_SHADER_LINEAR_BOUNDING_BOX, + VisualFactoryCache::GRADIENT_SHADER_LINEAR_USER_SPACE_ROUNDED_CORNER, + VisualFactoryCache::GRADIENT_SHADER_LINEAR_BOUNDING_BOX_ROUNDED_CORNER + }, { - return VisualFactoryCache::GRADIENT_SHADER_RADIAL_USER_SPACE; + VisualFactoryCache::GRADIENT_SHADER_RADIAL_USER_SPACE, + VisualFactoryCache::GRADIENT_SHADER_RADIAL_BOUNDING_BOX, + VisualFactoryCache::GRADIENT_SHADER_RADIAL_USER_SPACE_ROUNDED_CORNER, + VisualFactoryCache::GRADIENT_SHADER_RADIAL_BOUNDING_BOX_ROUNDED_CORNER } - - return VisualFactoryCache::GRADIENT_SHADER_RADIAL_BOUNDING_BOX; -} +}; const char* VERTEX_SHADER[] = { // vertex shader for gradient units as OBJECT_BOUNDING_BOX - DALI_COMPOSE_SHADER( +DALI_COMPOSE_SHADER( attribute mediump vec2 aPosition;\n uniform highp mat4 uMvpMatrix;\n uniform mediump vec3 uSize;\n @@ -150,6 +148,79 @@ DALI_COMPOSE_SHADER( \n vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n }\n +), + +// vertex shader for gradient units as OBJECT_BOUNDING_BOX with corner radius +DALI_COMPOSE_SHADER( + attribute mediump vec2 aPosition;\n + uniform highp mat4 uMvpMatrix;\n + uniform mediump vec3 uSize;\n + uniform mediump mat3 uAlignmentMatrix;\n + varying mediump vec2 vTexCoord;\n + varying mediump vec2 vPosition;\n + varying mediump vec2 vRectSize;\n + \n + //Visual size and offset + uniform mediump vec2 offset;\n + uniform mediump vec2 size;\n + uniform mediump vec4 offsetSizeMode;\n + uniform mediump vec2 origin;\n + uniform mediump vec2 anchorPoint;\n + uniform mediump float cornerRadius;\n + + vec4 ComputeVertexPosition()\n + {\n + vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n + vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n + vRectSize = visualSize * 0.5 - cornerRadius;\n + vPosition = aPosition * visualSize;\n + return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n + }\n + + void main()\n + {\n + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n + vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n + \n + gl_Position = uMvpMatrix * ComputeVertexPosition();\n + }\n +), + +// vertex shader for gradient units as USER_SPACE with corner radius +DALI_COMPOSE_SHADER( + attribute mediump vec2 aPosition;\n + uniform highp mat4 uMvpMatrix;\n + uniform mediump vec3 uSize;\n + uniform mediump mat3 uAlignmentMatrix;\n + varying mediump vec2 vTexCoord;\n + varying mediump vec2 vPosition;\n + varying mediump vec2 vRectSize;\n + \n + //Visual size and offset + uniform mediump vec2 offset;\n + uniform mediump vec2 size;\n + uniform mediump vec4 offsetSizeMode;\n + uniform mediump vec2 origin;\n + uniform mediump vec2 anchorPoint;\n + uniform mediump float cornerRadius;\n + + vec4 ComputeVertexPosition()\n + {\n + vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n + vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n + vRectSize = visualSize * 0.5 - cornerRadius;\n + vPosition = aPosition * visualSize;\n + return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n + }\n + + void main()\n + {\n + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n + vertexPosition.xyz *= uSize;\n + gl_Position = uMvpMatrix * ComputeVertexPosition();\n + \n + vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n + }\n ) }; @@ -179,6 +250,42 @@ DALI_COMPOSE_SHADER( {\n gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n }\n +), + +// fragment shader for linear gradient with corner radius +DALI_COMPOSE_SHADER( + uniform sampler2D sTexture;\n // sampler1D? + uniform lowp vec4 uColor;\n + uniform lowp vec3 mixColor;\n + uniform mediump float cornerRadius;\n + varying mediump vec2 vTexCoord;\n + varying mediump vec2 vPosition;\n + varying mediump vec2 vRectSize;\n + \n + void main()\n + {\n + mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - cornerRadius;\n + gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n + gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );\n + }\n +), + +// fragment shader for radial gradient with corner radius +DALI_COMPOSE_SHADER( + uniform sampler2D sTexture;\n // sampler1D? + uniform lowp vec4 uColor;\n + uniform lowp vec3 mixColor;\n + uniform mediump float cornerRadius;\n + varying mediump vec2 vTexCoord;\n + varying mediump vec2 vPosition;\n + varying mediump vec2 vRectSize;\n + \n + void main()\n + {\n + mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - cornerRadius;\n + gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n + gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );\n + }\n ) }; @@ -321,11 +428,12 @@ void GradientVisual::InitializeRenderer() Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits(); - VisualFactoryCache::ShaderType shaderType = GetShaderType( mGradientType, gradientUnits ); + int roundedCorner = IsRoundedCornerRequired() ? 1 : 0; + VisualFactoryCache::ShaderType shaderType = SHADER_TYPE_TABLE[mGradientType][gradientUnits + roundedCorner * 2]; Shader shader = mFactoryCache.GetShader( shaderType ); if( !shader ) { - shader = Shader::New( VERTEX_SHADER[gradientUnits], FRAGMENT_SHADER[ mGradientType ] ); + shader = Shader::New( VERTEX_SHADER[gradientUnits + roundedCorner * 2], FRAGMENT_SHADER[ mGradientType + roundedCorner * 2 ] ); mFactoryCache.SaveShader( shaderType, shader ); } diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.h b/dali-toolkit/internal/visuals/visual-factory-cache.h index e3629d3..f22fb86 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.h +++ b/dali-toolkit/internal/visuals/visual-factory-cache.h @@ -66,6 +66,10 @@ public: GRADIENT_SHADER_LINEAR_BOUNDING_BOX, GRADIENT_SHADER_RADIAL_USER_SPACE, GRADIENT_SHADER_RADIAL_BOUNDING_BOX, + GRADIENT_SHADER_LINEAR_USER_SPACE_ROUNDED_CORNER, + GRADIENT_SHADER_LINEAR_BOUNDING_BOX_ROUNDED_CORNER, + GRADIENT_SHADER_RADIAL_USER_SPACE_ROUNDED_CORNER, + GRADIENT_SHADER_RADIAL_BOUNDING_BOX_ROUNDED_CORNER, IMAGE_SHADER, IMAGE_SHADER_ATLAS_DEFAULT_WRAP, IMAGE_SHADER_ATLAS_CUSTOM_WRAP, -- 2.7.4 From da19b50dbd3bb82ac9bcbbc6dd0e6d601c929c2f Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 12 May 2020 14:55:59 +0900 Subject: [PATCH 15/16] Add MIN_LINE_SIZE property Users want to set the line size in multi-line. We have a lineSpacing property which allows us to set the spacing of the lines. However, the user wants to achieve a similar effect by setting the size of the line, not lineSpacing. Change-Id: Ia96e1875e90454a3269d2ad853d3c4e20ce66ae9 --- .../src/dali-toolkit/utc-Dali-TextLabel.cpp | 5 +++ .../controls/text-controls/text-label-devel.h | 7 ++++ .../controls/text-controls/text-label-impl.cpp | 24 ++++++++++++- .../internal/text/layouts/layout-engine.cpp | 39 ++++++++++++++++++---- dali-toolkit/internal/text/layouts/layout-engine.h | 14 ++++++++ dali-toolkit/internal/text/text-controller.cpp | 16 +++++++++ dali-toolkit/internal/text/text-controller.h | 16 +++++++++ 7 files changed, 113 insertions(+), 8 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 9f9ce5f..2d6b092 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -637,6 +637,11 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + // Check the line size property + DALI_TEST_EQUALS( label.GetProperty( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f ); + DALI_TEST_EQUALS( label.GetProperty( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + application.SendNotification(); application.Render(); diff --git a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h index 72ad6f8..9190441 100755 --- a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h @@ -140,6 +140,13 @@ namespace Property */ TEXT_FIT, + /** + * @brief Sets the height of the line in points. + * @details Name "lineSize", type Property::FLOAT. + * @note If the font size is larger than the line size, it works with the font size. + */ + MIN_LINE_SIZE, + }; } // namespace Property diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index c521817..2fddac3 100755 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -140,7 +140,8 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalLineAlignment DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textBackground", MAP, BACKGROUND ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ignoreSpacesAfterText", BOOLEAN, IGNORE_SPACES_AFTER_TEXT ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) -DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textFit", MAP, TEXT_FIT ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textFit", MAP, TEXT_FIT ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE ) DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR ) DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0 ) DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1 ) @@ -553,6 +554,19 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE: + { + if( impl.mController ) + { + const float lineSize = value.Get(); + + if( impl.mController->SetDefaultLineSize( lineSize ) ) + { + impl.mTextUpdateNeeded = true; + } + } + break; + } } // Request relayout when text update is needed. It's necessary to call it @@ -834,6 +848,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde value = map; break; } + case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE: + { + if( impl.mController ) + { + value = impl.mController->GetDefaultLineSize(); + } + break; + } } } diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index e91ebae..fb63d96 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -52,7 +52,8 @@ namespace const float MAX_FLOAT = std::numeric_limits::max(); const CharacterDirection LTR = false; const CharacterDirection RTL = !LTR; -const float LINE_SPACING= 0.f; +const float LINE_SPACING = 0.f; +const float MIN_LINE_SIZE = 0.f; inline bool isEmptyLineAtLast( const Vector& lines, const Vector::Iterator& line ) { @@ -130,7 +131,8 @@ struct Engine::Impl Impl() : mLayout{ Layout::Engine::SINGLE_LINE_BOX }, mCursorWidth{ 0.f }, - mDefaultLineSpacing{ LINE_SPACING } + mDefaultLineSpacing{ LINE_SPACING }, + mDefaultLineSize{ MIN_LINE_SIZE } { } @@ -162,8 +164,12 @@ struct Engine::Impl // Sets the minimum descender. lineLayout.descender = std::min( lineLayout.descender, fontMetrics.descender ); - // set the line spacing - lineLayout.lineSpacing = mDefaultLineSpacing; + // Sets the line size + lineLayout.lineSpacing = mDefaultLineSize - ( lineLayout.ascender + -lineLayout.descender ); + lineLayout.lineSpacing = lineLayout.lineSpacing < 0.f ? 0.f : lineLayout.lineSpacing; + + // Add the line spacing + lineLayout.lineSpacing += mDefaultLineSpacing; } /** @@ -921,8 +927,6 @@ struct Engine::Impl lineRun.glyphRun.numberOfGlyphs = layout.numberOfGlyphs; lineRun.characterRun.characterIndex = layout.characterIndex; lineRun.characterRun.numberOfCharacters = layout.numberOfCharacters; - lineRun.lineSpacing = mDefaultLineSpacing; - lineRun.width = layout.length; lineRun.extraLength = std::ceil( layout.whiteSpaceLengthEndOfLine ); @@ -935,6 +939,12 @@ struct Engine::Impl lineRun.direction = layout.direction; lineRun.ellipsis = false; + lineRun.lineSpacing = mDefaultLineSize - ( lineRun.ascender + -lineRun.descender ); + lineRun.lineSpacing = lineRun.lineSpacing < 0.f ? 0.f : lineRun.lineSpacing; + + lineRun.lineSpacing += mDefaultLineSpacing; + + // Update the actual size. if( lineRun.width > layoutSize.width ) { @@ -986,7 +996,11 @@ struct Engine::Impl lineRun.alignmentOffset = 0.f; lineRun.direction = LTR; lineRun.ellipsis = false; - lineRun.lineSpacing = mDefaultLineSpacing; + + lineRun.lineSpacing = mDefaultLineSize - ( lineRun.ascender + -lineRun.descender ); + lineRun.lineSpacing = lineRun.lineSpacing < 0.f ? 0.f : lineRun.lineSpacing; + + lineRun.lineSpacing += mDefaultLineSpacing; layoutSize.height += ( lineRun.ascender + -lineRun.descender ) + lineRun.lineSpacing; } @@ -1551,6 +1565,7 @@ struct Engine::Impl Type mLayout; float mCursorWidth; float mDefaultLineSpacing; + float mDefaultLineSize; IntrusivePtr mMetrics; }; @@ -1632,6 +1647,16 @@ float Engine::GetDefaultLineSpacing() const return mImpl->mDefaultLineSpacing; } +void Engine::SetDefaultLineSize( float lineSize ) +{ + mImpl->mDefaultLineSize = lineSize; +} + +float Engine::GetDefaultLineSize() const +{ + return mImpl->mDefaultLineSize; +} + } // namespace Layout } // namespace Text diff --git a/dali-toolkit/internal/text/layouts/layout-engine.h b/dali-toolkit/internal/text/layouts/layout-engine.h index af693da..5641c47 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.h +++ b/dali-toolkit/internal/text/layouts/layout-engine.h @@ -152,6 +152,20 @@ public: */ float GetDefaultLineSpacing() const; + /** + * @brief Sets the default line size. + * + * @param[in] lineSize The line size. + */ + void SetDefaultLineSize( float lineSize ); + + /** + * @brief Retrieves the default line size. + * + * @return The line size. + */ + float GetDefaultLineSize() const; + private: // Undefined diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 9a46e8b..cb09223 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1462,6 +1462,22 @@ float Controller::GetDefaultLineSpacing() const return mImpl->mLayoutEngine.GetDefaultLineSpacing(); } +bool Controller::SetDefaultLineSize( float lineSize ) +{ + if( std::fabs( lineSize - mImpl->mLayoutEngine.GetDefaultLineSize() ) > Math::MACHINE_EPSILON_1000 ) + { + mImpl->mLayoutEngine.SetDefaultLineSize(lineSize); + mImpl->mRecalculateNaturalSize = true; + return true; + } + return false; +} + +float Controller::GetDefaultLineSize() const +{ + return mImpl->mLayoutEngine.GetDefaultLineSize(); +} + void Controller::SetInputColor( const Vector4& color ) { if( NULL != mImpl->mEventData ) diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index 6a986f5..c7a549e 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -1055,6 +1055,22 @@ public: // Default style & Input style float GetDefaultLineSpacing() const; /** + * @brief Sets the default line size. + * + * @param[in] lineSize The line size. + * + * @return True if lineSize has been updated, false otherwise + */ + bool SetDefaultLineSize( float lineSize ); + + /** + * @brief Retrieves the default line size. + * + * @return The line size. + */ + float GetDefaultLineSize() const; + + /** * @brief Sets the input text's color. * * @param[in] color The input text's color. -- 2.7.4 From da14264ab4898d0954af273b9825c83f247619e5 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 19 May 2020 11:35:07 +0900 Subject: [PATCH 16/16] DALi Version 1.5.12 Change-Id: I0a2237606b86b946d483bc3c1dad4183abb62ee7 --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 340d5e9..09aa72d 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 11; +const unsigned int TOOLKIT_MICRO_VERSION = 12; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 5ba4e12..7d2896f 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -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