Merge "added FONT_SIZE_SCALE("fontSizeScale") DevelProperty into TextLabel, TextField...
authorHyunJu Shin <hyunjushin@samsung.com>
Wed, 11 Nov 2020 07:55:23 +0000 (07:55 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 11 Nov 2020 07:55:23 +0000 (07:55 +0000)
42 files changed:
automated-tests/CMakeLists.txt.in
automated-tests/build.sh
automated-tests/patch-coverage.pl
automated-tests/scripts/retriever.sh
automated-tests/scripts/tcheadgen.sh
automated-tests/scripts/tcpackageslistsgen.sh
automated-tests/scripts/tctestsgen.sh
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-internal/utc-Dali-ColorConversion.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Dictionary.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit-internal/utc-Dali-PropertyHelper.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp
automated-tests/src/dali-toolkit-styling/CMakeLists.txt
automated-tests/src/dali-toolkit-third-party/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/internal/builder/dictionary.h
dali-toolkit/internal/image-loader/image-load-thread.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/arc/arc-visual.cpp
dali-toolkit/internal/visuals/border/border-visual.cpp
dali-toolkit/internal/visuals/color/color-visual.cpp
dali-toolkit/internal/visuals/gradient/gradient-visual.cpp
dali-toolkit/internal/visuals/image-visual-shader-factory.cpp
dali-toolkit/internal/visuals/image-visual-shader-factory.h
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/svg/svg-rasterize-thread.cpp
dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/internal/visuals/visual-base-impl.h
dali-toolkit/internal/visuals/visual-factory-cache.cpp
dali-toolkit/internal/visuals/visual-factory-cache.h
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index ce46988..be21183 100644 (file)
@@ -4,9 +4,24 @@ SET(CMAKE_CXX_STANDARD 17)
 
 INCLUDE(FindPkgConfig)
 SET(BIN_DIR "/opt/usr/bin")
+SET(SCRIPT_DIR ${CMAKE_SOURCE_DIR}/scripts)
 
 ADD_DEFINITIONS(-DDALI_STYLE_DIR="@dataReadOnlyDir@/toolkit/styles/")
 
+# Macro checks if the module is available and sets user variable
+MACRO( CHECK_MODULE_AND_SET PKG_VAR PKG_LIB_REQUIREMENTS VAR_TO_SET )
+  PKG_CHECK_MODULES(${PKG_VAR} "${PKG_LIB_REQUIREMENTS}")
+  IF( ${PKG_VAR}_FOUND )
+    SET( ${VAR_TO_SET} ON )
+    SET( ${VAR_TO_SET}_ENABLED ON )
+  ELSE()
+    SET( ${VAR_TO_SET}_ENABLED OFF )
+  ENDIF()
+ENDMACRO()
+
+SET(ELDBUS_REQUIRED 1.16.0)
+CHECK_MODULE_AND_SET(ELDBUS eldbus>=${ELDBUS_REQUIRED} ELDBUS_AVAILABLE)
+
 INCLUDE_DIRECTORIES(
   src/common
 )
index 2f92135..7e812e1 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 
-TEMP=`getopt -o rn --long rebuild,no-gen \
+TEMP=`getopt -o r --long rebuild \
      -n 'genmake' -- "$@"`
 
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -10,12 +10,10 @@ if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
 eval set -- "$TEMP"
 
 opt_rebuild=false
-opt_generate=true
 
 while true ; do
     case "$1" in
         -r|--rebuild) opt_rebuild=true ; shift ;;
-        -n|--no-gen)  opt_generate=false ; shift ;;
         --) shift ; break ;;
         *) shift ;;   # Ignore
     esac
@@ -28,10 +26,6 @@ fi
 
 function build
 {
-    if [ $opt_generate == true -o $opt_rebuild == false ] ; then
-        (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h)
-        if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
-    fi
     (cd build ; cmake .. -DMODULE=$1 ; make -j7 )
 }
 
index 3a97dac..b3cf098 100755 (executable)
@@ -1105,7 +1105,7 @@ sub calc_patch_coverage_percentage
     my $percent = 0;
     if($total_exec > 0) { $percent = 100 * $total_covered_lines / $total_exec; }
 
-    return [ $total_exec, $percent ];
+    return [ $total_exec, $percent, $total_covered_lines ];
 }
 
 #
@@ -1417,6 +1417,7 @@ elsif( ! $opt_quiet )
     print RESET;
 }
 
+printf("Line Coverage: %d/%d\n", $percentref->[2], $percentref->[0]);
 printf("Percentage of change covered: %5.2f%\n", $percent);
 
 exit($percent<90);
index c1d466d..102bb44 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/bash
 
 USAGE=$(cat <<EOF
-Usage note: retriever.sh [option] [directory]
+Usage note: retriever.sh [option] [directory] test-files
 Options:
   none    retrieve TC names with corresponding startup and cleanup functions
-  -f      retrieveve TC name with corresponding "set" and "purpose" clauses
+  -f      retrieve TC name with corresponding "set" and "purpose" clauses
   -anum   retrieve automatic TC number
   -mnum   retrieve manual TC number
 
@@ -46,6 +46,8 @@ function get_tc_files {
     }')
 }
 
+
+
 function tc_names {
     if [[ -z "$1" ]]; then
         exit
@@ -59,6 +61,10 @@ function tc_names {
         err_flag = 0;
         tc_list = "";
     }
+    BEGINFILE {
+        start_fun = "NULL";
+        clean_fun = "NULL";
+    }
     /^void .*startup\(void\)/ {
         gsub(/^void /, "");
         gsub(/\(void\)$/,"");
@@ -159,39 +165,73 @@ function tc_fullinfo {
     ' $*
 }
 
-
-# usage note and exit:
-# - argument begin with '-' but is not recognised or number of arguments is > 3,
-# - argument doesn't begin with '-' and number of arguments is > 2
-if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 3 ) ) || ( "$1" != -* && $# > 2 ) ]]; then
-    echo -e "$USAGE"
-    exit 1
+TEMP=`getopt -o f::,a:,m: --long full::,anum:,mnum: \
+     -n 'retriever.sh' -- "$@"`
+
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+opt_full=false
+opt_full_dir=
+opt_anum=
+opt_mnum=
+
+while true ; do
+    case "$1" in
+        -f|--full) opt_full_dir="$2" ; opt_full="true" ; shift 2 ;;
+        -a|--anum) opt_anum="$2" ; shift 2 ;;
+        -m|--mnum) opt_mnum="$2" ; shift 2 ;;
+        --) shift ; break ;;
+        *) echo -e $USAGE ; exit 1 ;;
+    esac
+done
+
+#echo "###Retriever" >& 2
+#echo opt_full: {$opt_full} >& 2
+#echo opt_full_dir: {$opt_full_dir} >& 2
+
+DIR=.
+if [ -n "$opt_anum" ] ; then
+    DIR=$opt_anum
+    echo opt_anum: DIR=$DIR >& 2
+elif [ -n "$opt_mnum" ] ; then
+    DIR=$opt_mnum
+    echo opt_mnum: DIR=$DIR >& 2
+elif [ "$opt_full" == "true" ] ; then
+    if [ -n $opt_full_dir ] ; then
+        DIR=$opt_full_dir
+        echo opt_full: DIR=$DIR >& 2
+    fi
 fi
 
-# get directory from last argument (or assume current one)
-if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then
-    DIR=${1:-.}
-else
-    DIR=${2:-.}
-fi
 
-# get filename from last argument
-if [[ $# == 3 && -f $DIR/$3 ]] ; then
-    FILE=$3
-elif [[ $# == 2 && -f $DIR/$2 ]] ; then
-    FILE=$2
+# get filename from first argument
+if [[ $# == 1 && -f $DIR/$1 ]] ; then
+    FILE=$1
+    shift;
 fi
 
 #echo "Dir: $DIR  File: $FILE" >& 2
 
-
 # populate $TC_FILES with files declared in CMakeLists.txt
 if [[ -z $FILE ]]; then
-    get_tc_files $DIR
+    if [[ ! $DIR == "." || $# == 0 ]] ; then
+        #echo Get tc files: DIR=$DIR >& 2
+        get_tc_files $DIR
+    else
+        TC_FILES=$(
+            for i in $* ; do
+                echo $DIR/$i
+            done
+            )
+    fi
     if [ $? != 0 ]; then
         exit 1
     fi
-    echo "Got all files" >& 2
+    echo "Got all files in `pwd`" >& 2
+    #echo "TC_FILES: $TC_FILES" >& 2
 else
     TC_FILES="$DIR/$FILE"
     echo "TC_FILES: $TC_FILES" >& 2
@@ -200,13 +240,12 @@ fi
 
 
 # run appropriate subcommand
-case "$1" in
-    -anum)
-        tc_anum $TC_FILES ;;
-    -mnum)
-        tc_mnum $TC_FILES ;;
-    -f)
-        tc_fullinfo $TC_FILES ;;
-    *)
-        tc_names $TC_FILES ;;
-esac
+if [ "$opt_full" == "true" ] ; then
+    tc_fullinfo $TC_FILES
+elif [ -n "$opt_anum" ] ; then
+    tc_anum $TC_FILES
+elif [ -n "$opt_mnum" ] ; then
+    tc_mnum $TC_FILES
+else
+    tc_names $TC_FILES
+fi
index c8cd679..007ed89 100755 (executable)
@@ -1,16 +1,18 @@
 #!/bin/bash
 
 if [[ -z $1 ]]; then
-    echo "Usage note: tcheadgen.sh <header_filename.h>"
+    echo "Usage note: tcheadgen.sh <header_filename.h> <test-sources>"
     exit 1
 fi
 
 FILE="$PWD/$1"
+shift
+TC_FILES=$*
 TFILE="/tmp/retr.csv$$"
 HEADER_NAME=$(echo $1 | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/')
 SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
 
-$SCRIPT_DIR/retriever.sh > $TFILE
+$SCRIPT_DIR/retriever.sh $TC_FILES > $TFILE
 if [ $? -ne 0 ]; then cat $TFILE; exit 1; fi
 awk -F',' -v HEADER_NAME="$HEADER_NAME" '
     BEGIN {
@@ -70,4 +72,3 @@ print ""
 print "#endif // " HEADER_NAME
 }' $TFILE > $FILE
 unlink $TFILE
-
index 15ea51f..edc876d 100755 (executable)
@@ -12,9 +12,9 @@ if [ ! -f $FILE ]; then
     exit
 fi
 SCRIPT_DIR="$(cd "$(dirname $0)" && pwd)"
-AUTO_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -anum src/$MODULE_NAME)
+AUTO_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh --anum src/$MODULE_NAME)
 if [ $? -ne 0 ]; then echo $AUTO_NUM; exit 1; fi
-MAN_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh -mnum src/$MODULE_NAME)
+MAN_NUM=$(cd $SCRIPT_DIR/..; scripts/retriever.sh --mnum src/$MODULE_NAME)
 if [ $? -ne 0 ]; then echo $MAN_NUM; exit 1; fi
 
 TFILE="/tmp/tempfile.xml"
@@ -23,7 +23,7 @@ if [ -f $TFILE ]; then
 fi
 
 function regen {
-    awk -v RS='\r\n' -v ORS='\r\n' -v MODULE_NAME=$MODULE_NAME -v AUTO_NUM=$AUTO_NUM -v MAN_NUM=$MAN_NUM '    
+    awk -v RS='\r\n' -v ORS='\r\n' -v MODULE_NAME=$MODULE_NAME -v AUTO_NUM=$AUTO_NUM -v MAN_NUM=$MAN_NUM '
     BEGIN {
         found = 0;
         replaced = 0;
index 1881668..517cfb4 100755 (executable)
@@ -60,7 +60,9 @@ print "</test_definition>"
     }' $TFILE > $FILE
 }
 
-(cd $SCRIPT_DIR/..; scripts/retriever.sh -f src/$MODULE_NAME $4 > ${TFILE}_pre)
+cmd="cd $SCRIPT_DIR/..; scripts/retriever.sh -fsrc/$MODULE_NAME $4 > ${TFILE}_pre"
+echo "$cmd"
+( eval $cmd )
 if [ $? -ne 0 ]; then cat ${TFILE}_pre; exit 1; fi
 cat ${TFILE}_pre | sort -t',' -k2,2 -s > $TFILE
 gen
index 7aea8eb..ddd196c 100755 (executable)
@@ -8,15 +8,11 @@ SET(CAPI_LIB "dali-toolkit-internal")
 # List of test case sources (Only these get parsed for test cases)
 SET(TC_SOURCES
  utc-Dali-AddOns.cpp
- utc-Dali-Accessibility-Accessible.cpp
- utc-Dali-Accessibility-Controls.cpp
- utc-Dali-Accessibility-Controls-BridgeUp.cpp
- utc-Dali-Accessibility-Text.cpp
- utc-Dali-Accessibility-Value.cpp
  utc-Dali-BidirectionalSupport.cpp
  utc-Dali-ColorConversion.cpp
  utc-Dali-Control-internal.cpp
  utc-Dali-DebugRendering.cpp
+ utc-Dali-Dictionary.cpp
  utc-Dali-FeedbackStyle.cpp
  utc-Dali-ItemView-internal.cpp
  utc-Dali-LogicalModel.cpp
@@ -41,8 +37,18 @@ SET(TC_SOURCES
  utc-Dali-VisualUrl.cpp
 )
 
-# Append list of test harness files (Won't get parsed for test cases)
-LIST(APPEND TC_SOURCES
+IF(ELDBUS_AVAILABLE)
+  LIST(APPEND TC_SOURCES
+    utc-Dali-Accessibility-Accessible.cpp
+    utc-Dali-Accessibility-Controls.cpp
+    utc-Dali-Accessibility-Controls-BridgeUp.cpp
+    utc-Dali-Accessibility-Text.cpp
+    utc-Dali-Accessibility-Value.cpp
+    )
+ENDIF()
+
+# List of test harness files (Won't get parsed for test cases)
+SET(TEST_HARNESS_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
@@ -81,9 +87,15 @@ LIST(APPEND TC_SOURCES
    dali-toolkit-test-utils/toolkit-text-utils.cpp
    dali-toolkit-test-utils/dummy-visual.cpp
    dali-toolkit-test-utils/test-addon-manager.cpp
+)
+
+IF(ELDBUS_AVAILABLE)
+  LIST(APPEND TEST_HARNESS_SOURCES
    dali-toolkit-test-utils/accessibility-test-utils.cpp
    dali-toolkit-test-utils/dbus-wrapper.cpp
-)
+    )
+ENDIF()
+
 
 PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
     dali2-core
@@ -102,6 +114,11 @@ ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
 ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" )
 ADD_DEFINITIONS(-DDALI_ADDONS_PATH=\"${CMAKE_CURRENT_BINARY_DIR}\")
 
+IF(ELDBUS_AVAILABLE)
+  ADD_COMPILE_OPTIONS(-Wno-error=attributes)
+  ADD_DEFINITIONS(-DELDBUS_ENABLED)
+ENDIF()
+
 FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
     SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
 ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
@@ -109,13 +126,21 @@ ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS})
 STRING(STRIP ${CMAKE_CXX_LINK_FLAGS} CMAKE_CXX_LINK_FLAGS)
 
 INCLUDE_DIRECTORIES(
-    ../../../
-    ${${CAPI_LIB}_INCLUDE_DIRS}
-    ../dali-toolkit/dali-toolkit-test-utils
-    dali-toolkit-test-utils
+  ../../../
+  ${${CAPI_LIB}_INCLUDE_DIRS}
+  ../dali-toolkit/dali-toolkit-test-utils
+  dali-toolkit-test-utils
 )
 
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+ADD_CUSTOM_COMMAND(
+  COMMAND ../../scripts/tcheadgen.sh ${EXEC_NAME}.h ${TC_SOURCES}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  OUTPUT  ${EXEC_NAME}.h
+  COMMENT "Generating test tables"
+  )
+
+# Add explicit dependency on auto-generated header.
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.h ${EXEC_NAME}.cpp ${TC_SOURCES} ${TEST_HARNESS_SOURCES})
 TARGET_LINK_LIBRARIES(${EXEC_NAME}
     ${${CAPI_LIB}_LIBRARIES}
     -lpthread --coverage -ldl -rdynamic
index 6e41930..cec590c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,9 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/internal/helpers/color-conversion.h>
 
+#if defined(ELDBUS_ENABLED)
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
+#endif
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -26,7 +28,9 @@ using namespace Dali::Toolkit;
 void dali_color_conversion_startup(void)
 {
   test_return_value = TET_UNDEF;
+#if defined(ELDBUS_ENABLED)
   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
+#endif
 }
 
 void dali_color_conversion_cleanup(void)
index 12276e8..cdfa432 100755 (executable)
@@ -26,7 +26,9 @@
 
 #include <toolkit-environment-variable.h> // for setting environment variable: DALI_DEBUG_RENDERING
 
+#if defined(ELDBUS_ENABLED)
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
+#endif
 
 #include "dummy-control.h"
 
@@ -78,7 +80,9 @@ void TestDebugVisual( Integration::Scene scene,  Visual::Base& visual, Visual::T
 void dali_debug_rendering_startup(void)
 {
   test_return_value = TET_UNDEF;
+#if defined(ELDBUS_ENABLED)
   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
+#endif
 }
 
 void dali_debug_rendering_cleanup(void)
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Dictionary.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Dictionary.cpp
new file mode 100644 (file)
index 0000000..698377e
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/internal/builder/dictionary.h>
+using namespace Dali::Toolkit::Internal;
+
+
+std::string_view test_keys[20] =
+{
+  "testkey0", "testkey1", "testkey2", "testkey3", "testkey4", "testkey5", "testkey6", "testkey7", "testkey8", "testkey9",
+  "testkey10", "testkey11", "testkey12", "testkey13", "testkey14", "testkey15", "testkey16", "testkey17", "testkey18", "testkey19"
+};
+
+std::string_view testKeys[20] =
+{
+  "TestKey0", "TestKey1", "TestKey2", "TestKey3", "TestKey4", "TestKey5", "TestKey6", "TestKey7", "TestKey8", "TestKey9",
+  "TestKey10", "TestKey11", "TestKey12", "TestKey13", "TestKey14", "TestKey15", "TestKey16", "TestKey17", "TestKey18", "TestKey19"
+};
+
+
+int UtcDaliBuilderDictionaryNew(void)
+{
+  Dictionary<int> dictionary;
+
+  DictionaryKeys keys;
+  dictionary.GetKeys(keys);
+
+  DALI_TEST_CHECK( keys.empty() );
+  DALI_TEST_EQUALS( keys.size(), 0, TEST_LOCATION );
+  END_TEST;
+}
+
+
+int UtcDaliBuilderDictionaryAdd1(void)
+{
+  Dictionary<int> dictionary;
+
+  for(int i=0; i<10; i++)
+  {
+    char buffer[16];
+    sprintf(buffer, "testkey%d",i);
+    bool added=false;
+    if(i%2 == 0)
+    {
+      added = dictionary.Add(std::string(buffer), i);
+    }
+    else
+    {
+      added = dictionary.Add(buffer, i);
+    }
+    DALI_TEST_EQUALS(added, true, TEST_LOCATION);
+  }
+
+  DictionaryKeys keys;
+  dictionary.GetKeys(keys);
+
+  DALI_TEST_EQUALS( keys.size(), 10, TEST_LOCATION );
+  for(int i=0; i<10; i++)
+  {
+    char buffer[16];
+    sprintf(buffer, "testkey%d",i);
+    auto iter = std::find(keys.begin(), keys.end(), std::string(buffer));
+    DALI_TEST_CHECK(iter != keys.end());
+  }
+
+  END_TEST;
+}
+
+int UtcDaliBuilderDictionaryAdd2(void)
+{
+  Dictionary<int> dictionary;
+
+  for(int i=0; i<10; i++)
+  {
+    char buffer[16];
+    sprintf(buffer, "testkey%d",i);
+    bool added=false;
+    if(i%2 == 0)
+    {
+      added = dictionary.Add(std::string(buffer), i);
+    }
+    else
+    {
+      added = dictionary.Add(buffer, i);
+    }
+    DALI_TEST_EQUALS(added, true, TEST_LOCATION);
+  }
+
+  DictionaryKeys keys;
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 10, TEST_LOCATION );
+
+  bool added = dictionary.Add("testkey5", 1);
+  DALI_TEST_EQUALS(added, false, TEST_LOCATION);
+  DALI_TEST_EQUALS(*dictionary.Find("testkey5"), 5, TEST_LOCATION);
+
+  dictionary.Clear();
+  DALI_TEST_EQUALS(dictionary.Begin()==dictionary.End(), true, TEST_LOCATION);
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 0, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliBuilderDictionaryRemoveP(void)
+{
+  Dictionary<int> dictionary;
+
+  for(int i=0; i<10; i++)
+  {
+    bool added=false;
+    added = dictionary.Add(std::string(testKeys[i]), i);
+    DALI_TEST_EQUALS(added, true, TEST_LOCATION);
+  }
+
+  DictionaryKeys keys;
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 10, TEST_LOCATION );
+
+  for(int i=0; i<10; i++)
+  {
+    if(i%2==0)
+    {
+      dictionary.Remove(test_keys[i]); // Should fail (case sensitive)
+    }
+    else
+    {
+      dictionary.Remove(testKeys[i]);
+    }
+  }
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 5, TEST_LOCATION );
+
+  dictionary.Clear();
+  DALI_TEST_EQUALS(dictionary.Begin()==dictionary.End(), true, TEST_LOCATION);
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 0, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliBuilderDictionaryRemoveN(void)
+{
+  Dictionary<int> dictionary;
+
+  for(int i=0; i<10; i++)
+  {
+    bool added=false;
+    added = dictionary.Add(std::string(testKeys[i]), i);
+    DALI_TEST_EQUALS(added, true, TEST_LOCATION);
+  }
+
+  DictionaryKeys keys;
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 10, TEST_LOCATION );
+
+  dictionary.Remove("randomkey");
+  dictionary.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 10, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliBuilderDictionaryMerge1(void)
+{
+  // Test that "overlapping" dicts merge into 1 successfully
+  Dictionary<int> dictionary1;
+
+  for(int i=0; i<10; i++)
+  {
+    dictionary1.Add(std::string(test_keys[i]), i);
+  }
+
+  Dictionary<int> dictionary2;
+  for(int i=0; i<20; i++)
+  {
+    dictionary2.Add(std::string(testKeys[i]), i);
+  }
+
+  dictionary1.Merge(dictionary2);
+  DictionaryKeys keys;
+  dictionary1.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 30, TEST_LOCATION ); // Now have 2 case versions of 10 keys :/ - broken by design?
+
+  for(int i=0; i<20;++i)
+  {
+    // Check both cases of keys
+    auto ptr1 = dictionary1.FindConst(test_keys[i]);
+    auto ptr2 = dictionary1.FindConst(testKeys[i]);
+
+    DALI_TEST_CHECK( nullptr != ptr1 );
+    DALI_TEST_CHECK( nullptr != ptr2 );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliBuilderDictionaryMerge2(void)
+{
+  // Test that non-overlapping dicts merge successfully
+  Dictionary<int> dictionary1;
+  for(int i=0; i<10; i++) // Add first 10 from lowercase keys
+  {
+    dictionary1.Add(std::string(test_keys[i]), i);
+  }
+
+  Dictionary<int> dictionary2;
+  for(int i=10; i<20; i++) // add last 10 from capitalized keys
+  {
+    dictionary2.Add(std::string(testKeys[i]), i);
+  }
+
+  dictionary1.Merge(dictionary2);
+  DictionaryKeys keys;
+  dictionary1.GetKeys(keys);
+  DALI_TEST_EQUALS( keys.size(), 20, TEST_LOCATION ); // check it's an amalgam of both
+
+  for(int i=0; i<20;++i)
+  {
+    // Check both cases of keys
+    DALI_TEST_CHECK( nullptr != dictionary1.FindConst(test_keys[i]));
+    DALI_TEST_CHECK( nullptr != dictionary1.FindConst(testKeys[i]));
+  }
+
+  END_TEST;
+}
+
+
+template<typename EntryType>
+struct TestElement
+{
+  std::string key;
+  EntryType entry;
+  TestElement(std::string name, EntryType entry)
+  : key(std::move(name)),
+    entry(std::move(entry))
+  {
+  }
+};
+
+int UtcDaliBuilderDictionaryFindP(void)
+{
+  // Test that non-overlapping dicts merge successfully
+  Dictionary<int> dictionary;
+  for(int i=0; i<10; i++) // Add first 10 from lowercase keys
+  {
+    dictionary.Add(std::string(test_keys[i]), i);
+  }
+
+  // Test that the entries can be directly modified
+  for(int i=0; i<10; i++)
+  {
+    auto entryPtr = dictionary.Find(testKeys[i]);
+    DALI_TEST_CHECK( entryPtr != nullptr );
+    *entryPtr = i+10;
+  }
+
+  for(int i=0; i<10; ++i)
+  {
+    auto entryPtr = dictionary.Find(testKeys[i]);
+    DALI_TEST_CHECK( entryPtr != nullptr );
+    DALI_TEST_EQUALS( *entryPtr, i+10, TEST_LOCATION );
+  }
+
+  END_TEST;
+}
index df76c38..38fdc58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,9 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/internal/helpers/property-helper.h>
 
+#if defined(ELDBUS_ENABLED)
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
+#endif
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -26,7 +28,9 @@ using namespace Dali::Toolkit;
 void dali_property_helper_startup(void)
 {
   test_return_value = TET_UNDEF;
+#if defined(ELDBUS_ENABLED)
   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
+#endif
 }
 
 void dali_property_helper_cleanup(void)
index 06ce4c8..c5ad959 100644 (file)
@@ -24,7 +24,9 @@
 #include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
 #undef private
 
+#if defined(ELDBUS_ENABLED)
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
+#endif
 
 using namespace Dali;
 using namespace Toolkit;
@@ -32,7 +34,9 @@ using namespace Toolkit;
 void dali_textselectionpopupinternal_startup(void)
 {
   test_return_value = TET_UNDEF;
+#if defined(ELDBUS_ENABLED)
   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
+#endif
 }
 
 void dali_textselectionpopupinternal_cleanup(void)
@@ -51,4 +55,3 @@ int UtcDaliToolkitTextSelectionPopupIconPropertiesN(void)
 
   END_TEST;
 }
-
index c1ea9ad..9098be8 100644 (file)
@@ -27,7 +27,9 @@
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
 
+#if defined(ELDBUS_ENABLED)
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
+#endif
 
 using namespace Dali::Toolkit::Internal;
 
@@ -35,7 +37,9 @@ void utc_dali_toolkit_texture_manager_startup(void)
 {
   setenv( "LOG_TEXTURE_MANAGER", "3", 1 );
   test_return_value = TET_UNDEF;
+#if defined(ELDBUS_ENABLED)
   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
+#endif
 }
 
 void utc_dali_toolkit_texture_manager_cleanup(void)
index bda1454..76191dd 100644 (file)
@@ -10,8 +10,8 @@ SET(TC_SOURCES
    utc-Dali-StyleManager.cpp
 )
 
-# Append list of test harness files (Won't get parsed for test cases)
-LIST(APPEND TC_SOURCES
+# List of test harness files (Won't get parsed for test cases)
+SET(TEST_HARNESS_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-application.cpp
@@ -74,7 +74,14 @@ INCLUDE_DIRECTORIES(
     ../dali-toolkit/dali-toolkit-test-utils
 )
 
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+ADD_CUSTOM_COMMAND(
+  COMMAND ../../scripts/tcheadgen.sh ${EXEC_NAME}.h ${TC_SOURCES}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  OUTPUT  ${EXEC_NAME}.h
+  COMMENT "Generating test tables"
+  )
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.h ${EXEC_NAME}.cpp ${TC_SOURCES} ${TEST_HARNESS_SOURCES})
 TARGET_LINK_LIBRARIES(${EXEC_NAME}
   ${${CAPI_LIB}_LIBRARIES}
   -lpthread -ldl --coverage
index e089fc6..62631ea 100644 (file)
@@ -10,8 +10,8 @@ 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
+# List of test harness files (Won't get parsed for test cases)
+SET(TEST_HARNESS_SOURCES
    ../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
@@ -70,7 +70,14 @@ INCLUDE_DIRECTORIES(
     ${GTEST_INCLUDE_DIRS}
 )
 
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+ADD_CUSTOM_COMMAND(
+  COMMAND ../../scripts/tcheadgen.sh ${EXEC_NAME}.h ${TC_SOURCES}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  OUTPUT  ${EXEC_NAME}.h
+  COMMENT "Generating test tables"
+  )
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.h ${EXEC_NAME}.cpp ${TC_SOURCES} ${TEST_HARNESS_SOURCES})
 TARGET_LINK_LIBRARIES(${EXEC_NAME}
     ${${CAPI_LIB}_LIBRARIES}
     -lpthread --coverage
index f21b289..ea6c3fc 100755 (executable)
@@ -73,8 +73,8 @@ SET(TC_SOURCES
   utc-Dali-NPatchUtilities.cpp
 )
 
-# Append list of test harness files (Won't get parsed for test cases)
-LIST(APPEND TC_SOURCES
+# List of test harness files (Won't get parsed for test cases)
+SET(TEST_HARNESS_SOURCES
   dali-toolkit-test-utils/toolkit-adaptor.cpp
   dali-toolkit-test-utils/toolkit-application.cpp
   dali-toolkit-test-utils/toolkit-clipboard.cpp
@@ -137,7 +137,14 @@ INCLUDE_DIRECTORIES(
     dali-toolkit-test-utils
 )
 
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
+ADD_CUSTOM_COMMAND(
+  COMMAND ${SCRIPT_DIR}/tcheadgen.sh ${EXEC_NAME}.h ${TC_SOURCES}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  OUTPUT ${EXEC_NAME}.h
+  COMMENT "Generating test tables"
+  )
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.h ${EXEC_NAME}.cpp ${TC_SOURCES} ${TEST_HARNESS_SOURCES})
 TARGET_LINK_LIBRARIES(${EXEC_NAME}
     ${${CAPI_LIB}_LIBRARIES}
     -lpthread --coverage
index a694eeb..9e8c7a8 100644 (file)
@@ -112,6 +112,31 @@ bool TestGlAbstraction::IsSurfacelessContextSupported() const
   return true;
 }
 
+bool TestGlAbstraction::IsAdvancedBlendEquationSupported()
+{
+  return true;
+}
+
+bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
+{
+  return true;
+}
+
+std::string TestGlAbstraction::GetShaderVersionPrefix()
+{
+  return std::string("");
+}
+
+std::string TestGlAbstraction::GetVertexShaderPrefix()
+{
+  return std::string("");
+}
+
+std::string TestGlAbstraction::GetFragmentShaderPrefix()
+{
+  return std::string("");
+}
+
 bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
 {
   return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
index 99dca10..861f4ae 100644 (file)
@@ -61,6 +61,16 @@ public:
 
   bool IsSurfacelessContextSupported() const override;
 
+  bool IsAdvancedBlendEquationSupported() override;
+
+  bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) override;
+
+  std::string GetShaderVersionPrefix();
+
+  std::string GetVertexShaderPrefix();
+
+  std::string GetFragmentShaderPrefix();
+
   bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override;
 
   /* OpenGL ES 2.0 */
@@ -1889,6 +1899,10 @@ public:
   {
   }
 
+  inline void BlendBarrier(void)
+  {
+  }
+
 private:
   inline void AddUniformCallToTraceStack(GLint location, std::string& value)
   {
index f31da7c..2be7c5a 100644 (file)
@@ -2766,9 +2766,21 @@ void OnResourceReadySignal( Control control )
   }
 }
 
+void OnResourceReadySignal01( Control control )
+{
+  if(++gResourceReadySignalCounter == 1)
+  {
+    // It makes the first new visual be deleted immediately
+    // The first image will not be loaded.
+    control[ImageView::Property::IMAGE] = Property::Map().Add(ImageVisual::Property::URL, gImage_600_RGB)
+                                                         .Add(ImageVisual::Property::RELEASE_POLICY, ImageVisual::ReleasePolicy::NEVER);
+    control[ImageView::Property::IMAGE] = TEST_IMAGE_1;
+  }
+}
+
 }
 
-int UtcDaliImageViewSetImageOnResourceReadySignal(void)
+int UtcDaliImageViewSetImageOnResourceReadySignal01(void)
 {
   tet_infoline("Test setting image from within signal handler.");
 
@@ -2809,3 +2821,31 @@ int UtcDaliImageViewSetImageOnResourceReadySignal(void)
 
   END_TEST;
 }
+
+int UtcDaliImageViewSetImageOnResourceReadySignal02(void)
+{
+  tet_infoline("Test setting image from within signal handler.");
+
+  ToolkitTestApplication application;
+
+  gResourceReadySignalCounter = 0;
+
+  ImageView imageView = ImageView::New( gImage_34_RGBA );
+  imageView.ResourceReadySignal().Connect( &OnResourceReadySignal01 );
+
+  application.GetScene().Add( imageView );
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  // Wait for loading an image
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( gResourceReadySignalCounter, 2, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( imageView.IsResourceReady(), true, TEST_LOCATION );
+
+  END_TEST;
+}
index 9823516..f17f120 100644 (file)
@@ -2817,6 +2817,23 @@ static void TestTransform( ToolkitTestApplication& application, Visual::Base vis
   DALI_TEST_EQUALS( extraSize, Vector2(0.5f,0.5f), TEST_LOCATION );
 }
 
+int UtcDaliVisualSetTransform01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliVisualSetTransform: ColorVisual" );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map propertyMap;
+  propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+  propertyMap.Insert(Visual::Property::OPACITY, 0.5f);
+  propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  TestTransform( application, visual );
+  TestMixColor( visual, ColorVisual::Property::MIX_COLOR, Color::BLUE );
+
+  END_TEST;
+}
+
 int UtcDaliVisualSetTransform0(void)
 {
   ToolkitTestApplication application;
index 33ed1ee..faae3fe 100644 (file)
@@ -1131,12 +1131,9 @@ int UtcDaliVisualFactoryGetSvgVisual(void)
   application.GetScene().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
@@ -1170,12 +1167,9 @@ int UtcDaliVisualFactoryGetSvgVisualLarge(void)
   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
   application.GetScene().Add( actor );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
@@ -1216,12 +1210,10 @@ int UtcDaliVisualFactoryGetSvgVisualAtlas(void)
   application.GetScene().Add( actor );
   visual.SetTransformAndSize(DefaultTransform(), Vector2(200.f, 200.f) );
 
+  // Either application.SendNotification() or the trigger can now complete the task.
+  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
   application.SendNotification();
   application.Render();
-
-  // renderer is not added to actor until the rasterization is completed.
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
 
   // renderer is added to actor
index 65c7e18..a3036d9 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,17 +39,16 @@ namespace Internal
  * It enables lookup of keys via case-insensitive match.
  */
 
+using DictionaryKeys = std::vector<std::string>;
 
-typedef std::vector<std::string> DictionaryKeys;
 inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict )
 {
-  for( DictionaryKeys::const_iterator fromIter = fromDict.begin(); fromIter != fromDict.end(); ++fromIter )
+  for(const auto& element : fromDict)
   {
-    const std::string& fromKey = (*fromIter);
-    DictionaryKeys::iterator toIter = std::find( toDict.begin(), toDict.end(), fromKey );
-    if( toIter == toDict.end() )
+    auto iter = std::find(toDict.cbegin(), toDict.cend(), element);
+    if(iter == toDict.cend())
     {
-      toDict.push_back( fromKey );
+      toDict.push_back(element);
     }
   }
 }
@@ -66,105 +65,97 @@ private:
   {
     std::string key;
     EntryType entry;
-    Element( const std::string&name, EntryType entry )
-    : key( name ),
-      entry( entry )
+    Element(std::string name, EntryType entry)
+    : key(std::move(name)),
+      entry(std::move(entry))
     {
     }
   };
-  typedef std::vector<Element> Elements;
+  using Elements = std::vector<Element>;
   Elements container;
 
+  auto FindElementCaseInsensitive(std::string_view key) const
+  {
+    return std::find_if(
+      Begin(), End(), [key](auto& e) { return Dali::CaseInsensitiveStringCompare(e.key, key); });
+  }
+
+  auto FindElement(std::string_view key)
+  {
+    return std::find_if(container.begin(), container.end(), [key](auto& e){
+        return bool(key == e.key);
+      });
+  }
+
 public:
   /**
    * Only allow const iteration over the dictionary
    */
-  typedef typename Elements::const_iterator iterator;
+  using iterator = typename Elements::const_iterator;
 
   /**
    * Constructor
    */
-  Dictionary<EntryType>()
-  {
-  }
+  Dictionary<EntryType>() = default;
 
   /**
    * Add a key value pair to the dictionary.
    * If the entry does not already exist, add it to the dictionary
-   * using a shallow copy
    */
-  bool Add( const std::string& name, const EntryType& entry )
+  bool Add(std::string name, EntryType entry)
   {
-    for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
+    auto iter = FindElement(name);
+    if(iter != End())
     {
-      if( iter->key == name )
-      {
-        return false;
-      }
+      return false;
     }
-    container.push_back( Element(name, entry) );
+
+    container.push_back(Element(std::move(name), std::move(entry)));
     return true;
   }
 
   /**
    * Add a key-value pair to the dictionary
    * If the entry does not already exist, add it to the dictionary
-   * (shallow copy)
    */
-  bool Add( const char* name, const EntryType& entry )
+  bool Add(const char* name, EntryType entry)
   {
-    bool result=false;
-    if( name != NULL )
+    if(name != nullptr)
     {
-      std::string theName(name);
-      result=Add(theName, entry);
+      return Add(std::string(name), std::move(entry));
     }
-    return result;
+    return false;
   }
 
   /**
    * Remove a key value pair from the dictionary.
    */
-  void Remove( const std::string& name )
+  void Remove(std::string_view name)
   {
-    for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
+    if(!name.empty())
     {
-      if( iter->key == name )
+      auto iter = FindElement(name);
+
+      if(iter != End())
       {
         container.erase( iter );
-        break;
       }
     }
   }
 
-  /**
-   * Remove a key value pair from the dictionary.
-   */
-  void Remove( const char* name )
-  {
-    if( name != NULL )
-    {
-      std::string theName(name);
-      Remove(theName);
-    }
-  }
-
   void Merge( const Dictionary<EntryType>& dictionary )
   {
-    for( typename Elements::const_iterator fromIter = dictionary.container.begin(); fromIter != dictionary.container.end(); ++fromIter )
+    for(const auto& element : dictionary.container)
     {
-      bool found=false;
-      for( typename Elements::iterator toIter = container.begin(); toIter != container.end(); ++toIter )
+      auto iter = FindElement(element.key);
+
+      if(iter == End())
       {
-        if( fromIter->key == toIter->key )
-        {
-          found=true;
-          toIter->entry = fromIter->entry;
-        }
+        container.push_back(Element(element.key, element.entry));
       }
-      if( !found )
+      else
       {
-        container.push_back( Element(fromIter->key, fromIter->entry) );
+        iter->entry = element.entry;
       }
     }
   }
@@ -173,92 +164,57 @@ public:
    * Find the element in the dictionary pointed at by key, and
    * insensitive search, and return a const pointer to it, or NULL
    */
-  const EntryType* FindConst( const std::string& key ) const
+  const EntryType* FindConst(std::string_view key) const
   {
     if( ! key.empty() )
     {
-      for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+      auto iter = FindElementCaseInsensitive(key);
+
+      if(iter != End())
       {
-        if( Dali::CaseInsensitiveStringCompare(iter->key, key ))
-        {
-          const EntryType* result = &(iter->entry);
-          return result;
-        }
+        return &(iter->entry);
       }
     }
-    return NULL;
+    return nullptr;
   }
 
   /**
    * Find the element in the dictionary pointed at by key using a case
    * insensitive search, and return a non-const pointer to it, or NULL
    */
-  EntryType* Find( const std::string& key ) const
+  EntryType* Find(std::string_view key) const
   {
-    EntryType* result = NULL;
     if( ! key.empty() )
     {
-      for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+      auto iter = FindElementCaseInsensitive(key);
+
+      if(iter != End())
       {
-        if( Dali::CaseInsensitiveStringCompare(iter->key, key ))
-        {
-          // Const cast because of const_iterator. const_iterator because, STL.
-          result = const_cast<EntryType*>(&(iter->entry));
-        }
+        return const_cast<EntryType*>(&(iter->entry));
       }
     }
-    return result;
-  }
-
-  /**
-   * Find the element in the dictionary pointed at by key using a case
-   * insensitive search, and return a const pointer to it, or NULL
-   */
-  const EntryType* FindConst( const char* key ) const
-  {
-    if( key != NULL )
-    {
-      std::string theKey(key);
-      return FindConst( theKey );
-    }
-    return NULL;
+    return nullptr;
   }
 
-  /**
-   * Find the element in the dictionary pointed at by key using a case
-   * insensitive search, and return a non-const pointer to it, or NULL
-   */
-  EntryType* Find( const char* key ) const
-  {
-    if( key != NULL )
-    {
-      std::string theKey(key);
-      return Find( theKey );
-    }
-    return NULL;
-  }
-  /**
-   * Return an iterator pointing at the first entry in the dictionary
-   */
-  typename Elements::const_iterator Begin() const
+  iterator Begin() const
   {
-    return container.begin();
+    return container.cbegin();
   }
 
   /**
    * Return an iterator pointing past the last entry in the dictionary
    */
-  typename Elements::const_iterator End() const
+  iterator End() const
   {
-    return container.end();
+    return container.cend();
   }
 
   void GetKeys( DictionaryKeys& keys ) const
   {
     keys.clear();
-    for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+    for(const auto& element : container)
     {
-      keys.push_back( (*iter).key );
+      keys.push_back(element.key);
     }
   }
 
index eba2eef..9b68176 100644 (file)
@@ -90,7 +90,7 @@ LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::Pi
 }
 
 void LoadingTask::Load()
-{;
+{
   if( animatedImageLoading )
   {
     pixelBuffer = animatedImageLoading.LoadFrame( frameIndex );
index fead0e6..93c0966 100644 (file)
@@ -270,8 +270,8 @@ void AnimatedVectorImageVisual::DoSetOnScene( Actor& actor )
 
   if( mImpl->mCustomShader )
   {
-    shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource() : mImpl->mCustomShader->mVertexShader,
-                          mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource() : mImpl->mCustomShader->mFragmentShader,
+    shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
+                          mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
                           mImpl->mCustomShader->mHints );
 
     shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
index babfc94..71e2383 100644 (file)
@@ -47,102 +47,103 @@ DALI_ENUM_TO_STRING_WITH_SCOPE( DevelArcVisual::Cap, BUTT )
 DALI_ENUM_TO_STRING_WITH_SCOPE( DevelArcVisual::Cap, ROUND )
 DALI_ENUM_TO_STRING_TABLE_END( CAP )
 
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform mediump vec3 uSize;\n
-  \n
-  varying mediump vec2 vPosition;\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
-
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    vPosition = aPosition* visualSize;\n
-    return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER_BUTT_CAP = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vPosition;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform mediump float thickness;\n
-  uniform mediump float radius;\n
-  uniform mediump float startAngle;\n
-  uniform mediump float sweepAngle;\n
-  \n
-  const mediump float M_PI_OVER_2 = 1.57079632679;\n
-  const mediump float M_PI = 3.14159265359;\n
-  const mediump float M_PI_2 = 6.28318530718;\n
-  \n
-  mediump float GetOpacity()\n
-  {\n
-      mediump float start = radians( mod( startAngle, 360.0 ) );\n
-      mediump float angle = mod( atan( vPosition.y, vPosition.x ) + M_PI_OVER_2 - start, M_PI_2 );\n
-      mediump float dist = length( vPosition );\n
-      if( angle <= radians( sweepAngle ) )\n
-      {\n
-        return smoothstep( -1.0, 1.0, thickness / 2.0 - ( abs( dist - radius ) ) );\n
-      }\n
-      mediump float end = radians( mod( startAngle + sweepAngle, 360.0 ) );\n
-      mediump vec2 q0 = vec2( dist * cos( start - M_PI_OVER_2 ), dist * sin( start - M_PI_OVER_2 ) );\n
-      mediump vec2 q1 = vec2( dist * cos( end - M_PI_OVER_2 ), dist * sin( end - M_PI_OVER_2 ) );\n
-      mediump float opacity = 1.0 - smoothstep( 0.0, 2.0, min( length( vPosition - q0 ), length( vPosition - q1 ) ) );\n
-      opacity *= step( 0.0, thickness / 2.0 - abs( dist - radius ) );\n
-      return opacity;\n
-  }\n
-  void main()\n
-  {\n
-    gl_FragColor = vec4( mixColor, 1.0 ) * uColor;\n
-    gl_FragColor.a *= GetOpacity();\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER_ROUND_CAP = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vPosition;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform mediump float thickness;\n
-  uniform mediump float radius;\n
-  uniform mediump float startAngle;\n
-  uniform mediump float sweepAngle;\n
-  \n
-  const mediump float M_PI_OVER_2 = 1.57079632679;\n
-  const mediump float M_PI_2 = 6.28318530718;\n
-  \n
-  mediump float GetOpacity()\n
-  {\n
-      mediump float start = radians( mod( startAngle, 360.0 ) );\n
-      mediump float angle = mod( atan( vPosition.y, vPosition.x ) + M_PI_OVER_2 - start, M_PI_2 );\n
-      mediump float dist = length( vPosition );\n
-      if( angle <= radians( sweepAngle ) )\n
-      {\n
-        return smoothstep( -1.0, 1.0, thickness / 2.0 - ( abs( dist - radius ) ) );\n
-      }\n
-      mediump float end = radians( mod( startAngle + sweepAngle, 360.0 ) );\n
-      mediump vec2 q0 = vec2( radius * cos( start - M_PI_OVER_2 ), radius * sin( start - M_PI_OVER_2 ) );\n
-      mediump vec2 q1 = vec2( radius * cos( end - M_PI_OVER_2 ), radius * sin( end - M_PI_OVER_2 ) );\n
-      return smoothstep( -1.0, 1.0, thickness / 2.0 - min( length( vPosition - q0 ), length( vPosition - q1 ) ) );\n
-  }\n
-  void main()\n
-  {\n
-    gl_FragColor = vec4( mixColor, 1.0 ) * uColor;\n
-    gl_FragColor.a *= GetOpacity();\n
-  }\n
-);
+const char* VERTEX_SHADER =
+  "INPUT mediump vec2 aPosition;\n"
+  "OUTPUT mediump vec2 vPosition;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\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"
+  "  vPosition = aPosition* visualSize;\n"
+  "  return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "}\n";
+
+const char* FRAGMENT_SHADER_BUTT_CAP =
+  "INPUT mediump vec2 vPosition;\n"
+
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform mediump float thickness;\n"
+  "uniform mediump float radius;\n"
+  "uniform mediump float startAngle;\n"
+  "uniform mediump float sweepAngle;\n"
+
+  "const mediump float M_PI_OVER_2 = 1.57079632679;\n"
+  "const mediump float M_PI = 3.14159265359;\n"
+  "const mediump float M_PI_2 = 6.28318530718;\n"
+
+  "mediump float GetOpacity()\n"
+  "{\n"
+  "  mediump float start = radians( mod( startAngle, 360.0 ) );\n"
+  "  mediump float angle = mod( atan( vPosition.y, vPosition.x ) + M_PI_OVER_2 - start, M_PI_2 );\n"
+  "  mediump float dist = length( vPosition );\n"
+  "  if( angle <= radians( sweepAngle ) )\n"
+  "  {\n"
+  "    return smoothstep( -1.0, 1.0, thickness / 2.0 - ( abs( dist - radius ) ) );\n"
+  "  }\n"
+  "  mediump float end = radians( mod( startAngle + sweepAngle, 360.0 ) );\n"
+  "  mediump vec2 q0 = vec2( dist * cos( start - M_PI_OVER_2 ), dist * sin( start - M_PI_OVER_2 ) );\n"
+  "  mediump vec2 q1 = vec2( dist * cos( end - M_PI_OVER_2 ), dist * sin( end - M_PI_OVER_2 ) );\n"
+  "  mediump float opacity = 1.0 - smoothstep( 0.0, 2.0, min( length( vPosition - q0 ), length( vPosition - q1 ) ) );\n"
+  "  opacity *= step( 0.0, thickness / 2.0 - abs( dist - radius ) );\n"
+  "  return opacity;\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = vec4( mixColor, 1.0 ) * uColor;\n"
+  "  OUT_COLOR.a *= GetOpacity();\n"
+  "}\n";
+
+const char* FRAGMENT_SHADER_ROUND_CAP =
+  "INPUT mediump vec2 vPosition;\n"
+
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform mediump float thickness;\n"
+  "uniform mediump float radius;\n"
+  "uniform mediump float startAngle;\n"
+  "uniform mediump float sweepAngle;\n"
+
+  "const mediump float M_PI_OVER_2 = 1.57079632679;\n"
+  "const mediump float M_PI_2 = 6.28318530718;\n"
+
+  "mediump float GetOpacity()\n"
+  "{\n"
+  "  mediump float start = radians( mod( startAngle, 360.0 ) );\n"
+  "  mediump float angle = mod( atan( vPosition.y, vPosition.x ) + M_PI_OVER_2 - start, M_PI_2 );\n"
+  "  mediump float dist = length( vPosition );\n"
+  "  if( angle <= radians( sweepAngle ) )\n"
+  "  {\n"
+  "    return smoothstep( -1.0, 1.0, thickness / 2.0 - ( abs( dist - radius ) ) );\n"
+  "  }\n"
+  "  mediump float end = radians( mod( startAngle + sweepAngle, 360.0 ) );\n"
+  "  mediump vec2 q0 = vec2( radius * cos( start - M_PI_OVER_2 ), radius * sin( start - M_PI_OVER_2 ) );\n"
+  "  mediump vec2 q1 = vec2( radius * cos( end - M_PI_OVER_2 ), radius * sin( end - M_PI_OVER_2 ) );\n"
+  "  return smoothstep( -1.0, 1.0, thickness / 2.0 - min( length( vPosition - q0 ), length( vPosition - q1 ) ) );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = vec4( mixColor, 1.0 ) * uColor;\n"
+  "  OUT_COLOR.a *= GetOpacity();\n"
+  "}\n";
 
 }
 
@@ -296,7 +297,7 @@ void ArcVisual::InitializeRenderer()
     shader = mFactoryCache.GetShader( VisualFactoryCache::ARC_BUTT_CAP_SHADER );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_BUTT_CAP );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_BUTT_CAP );
       mFactoryCache.SaveShader( VisualFactoryCache::ARC_BUTT_CAP_SHADER, shader );
     }
   }
@@ -305,7 +306,7 @@ void ArcVisual::InitializeRenderer()
     shader = mFactoryCache.GetShader( VisualFactoryCache::ARC_ROUND_CAP_SHADER );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ROUND_CAP );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ROUND_CAP );
       mFactoryCache.SaveShader( VisualFactoryCache::ARC_ROUND_CAP_SHADER, shader );
     }
   }
index 03412bf..ddd2e52 100644 (file)
@@ -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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/visuals/border-visual-properties.h>
@@ -44,76 +45,73 @@ const char * const POSITION_ATTRIBUTE_NAME("aPosition");
 const char * const DRIFT_ATTRIBUTE_NAME("aDrift");
 const char * const INDEX_NAME("indices");
 
-
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  attribute mediump vec2 aDrift;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp   vec3 uSize;\n
-  uniform mediump float borderSize;\n
-  \n
-
-  //Visual size and offset
-  uniform mediump vec2 offset;\n
-  uniform highp   vec2 size;\n
-  uniform mediump vec4 offsetSizeMode;\n
-  uniform mediump vec2 origin;\n
-  uniform mediump vec2 anchorPoint;\n
-
-  vec2 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    return (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy;\n
-  }\n
-
-  void main()\n
-  {\n
-    vec2 position = ComputeVertexPosition() + aDrift*borderSize;\n
-    gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec4 borderColor;\n
-  uniform lowp vec3 mixColor;\n
-  \n
-  void main()\n
-  {\n
-    gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
-  }\n
-);
-
-const char* VERTEX_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  attribute mediump vec2 aDrift;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp   vec3 uSize;\n
-  uniform mediump float borderSize;\n
-  varying mediump float vAlpha;\n
-  \n
-  void main()\n
-  {\n
-    vec2 position = aPosition*(uSize.xy+vec2(0.75)) + aDrift*(borderSize+1.5);\n
-    gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n
-    vAlpha = min( abs(aDrift.x), abs(aDrift.y) )*(borderSize+1.5);
-  }\n
-);
-
-const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec4 borderColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform mediump float borderSize;\n
-  varying mediump float vAlpha;\n
-  \n
-  void main()\n
-  {\n
-    gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
-    gl_FragColor.a *= smoothstep(0.0, 1.5, vAlpha)*smoothstep( borderSize+1.5, borderSize, vAlpha );\n
-  }\n
-);
+const char* VERTEX_SHADER =
+  "INPUT mediump vec2 aPosition;\n"
+  "INPUT mediump vec2 aDrift;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+  "uniform mediump float borderSize;\n"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+
+  "vec2 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  return (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy;\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  vec2 position = ComputeVertexPosition() + aDrift*borderSize;\n"
+  "  gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n"
+  "}\n";
+
+const char* FRAGMENT_SHADER =
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec4 borderColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = vec4(mixColor, 1.0) * borderColor * uColor;\n"
+  "}\n";
+
+const char* VERTEX_SHADER_ANTI_ALIASING =
+  "INPUT mediump vec2 aPosition;\n"
+  "INPUT mediump vec2 aDrift;\n"
+  "OUTPUT mediump float vAlpha;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+  "uniform mediump float borderSize;\n"
+
+  "void main()\n"
+  "{\n"
+  "  vec2 position = aPosition*(uSize.xy+vec2(0.75)) + aDrift*(borderSize+1.5);\n"
+  "  gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n"
+  "  vAlpha = min( abs(aDrift.x), abs(aDrift.y) )*(borderSize+1.5);"
+  "}\n";
+
+const char* FRAGMENT_SHADER_ANTI_ALIASING =
+  "INPUT mediump float vAlpha;\n"
+
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec4 borderColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform mediump float borderSize;\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = vec4(mixColor, 1.0) * borderColor * uColor;\n"
+  "  OUT_COLOR.a *= smoothstep(0.0, 1.5, vAlpha) * smoothstep( borderSize + 1.5, borderSize, vAlpha );\n"
+  "}\n";
 }
 
 BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
@@ -201,7 +199,7 @@ void BorderVisual::DoSetOnScene( Actor& actor )
   InitializeRenderer();
 
   mBorderColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor );
-  if( mBorderColor.a < 1.f || mAntiAliasing)
+  if( ( mBorderColor.a < 1.f || mAntiAliasing ) || IsAdvancedBlendEquationApplied() )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
   }
@@ -259,7 +257,7 @@ Shader BorderVisual::GetBorderShader()
     shader = mFactoryCache.GetShader( VisualFactoryCache::BORDER_SHADER_ANTI_ALIASING );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER_ANTI_ALIASING, FRAGMENT_SHADER_ANTI_ALIASING );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER_ANTI_ALIASING, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ANTI_ALIASING );
       mFactoryCache.SaveShader( VisualFactoryCache::BORDER_SHADER_ANTI_ALIASING, shader );
     }
   }
@@ -268,7 +266,7 @@ Shader BorderVisual::GetBorderShader()
     shader = mFactoryCache.GetShader( VisualFactoryCache::BORDER_SHADER );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER );
       mFactoryCache.SaveShader( VisualFactoryCache::BORDER_SHADER, shader );
     }
   }
index 4fae268..793b8b2 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
 
 //INTERNAL INCLUDES
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
@@ -43,140 +44,139 @@ namespace Internal
 namespace
 {
 
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp   vec3 uSize;\n
-  \n
-
-  //Visual size and offset
-  uniform mediump vec2 offset;\n
-  uniform highp   vec2 size;\n
-  uniform mediump vec4 offsetSizeMode;\n
-  uniform mediump vec2 origin;\n
-  uniform mediump vec2 anchorPoint;\n
-  uniform mediump vec2 extraSize;\n
-
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  \n
-  void main()\n
-  {\n
-    gl_FragColor = vec4(mixColor, 1.0)*uColor;\n
-  }\n
-);
-
-const char* VERTEX_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp   vec3 uSize;\n
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  varying mediump float vCornerRadius;\n
-  \n
-  //Visual size and offset
-  uniform mediump vec2 offset;\n
-  uniform highp   vec2 size;\n
-  uniform mediump vec2 extraSize;\n
-  uniform mediump vec4 offsetSizeMode;\n
-  uniform mediump vec2 origin;\n
-  uniform mediump vec2 anchorPoint;\n
-  uniform mediump float cornerRadius;\n
-  uniform mediump float cornerRadiusPolicy;\n
-  \n
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    mediump float minSize = min( visualSize.x, visualSize.y );\n
-    vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);\n
-    vCornerRadius = min( vCornerRadius, minSize * 0.5 );\n
-    vRectSize = visualSize / 2.0 - vCornerRadius;\n
-    vPosition = aPosition* visualSize;\n
-    return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-  \n
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-  }\n
-);
+const char* VERTEX_SHADER =
+  "INPUT mediump vec2 aPosition;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+  "uniform mediump vec2 extraSize;\n"
+
+  "vec4 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "}\n";
+
+
+const char* FRAGMENT_SHADER =
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = vec4(mixColor, 1.0) * uColor;\n"
+  "}\n";
+
+const char* VERTEX_SHADER_ROUNDED_CORNER =
+  "INPUT mediump vec2 aPosition;\n"
+  "OUTPUT mediump vec2 vPosition;\n"
+  "OUTPUT mediump vec2 vRectSize;\n"
+  "OUTPUT mediump float vCornerRadius;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec2 extraSize;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+  "uniform mediump float cornerRadius;\n"
+  "uniform mediump float cornerRadiusPolicy;\n"
+
+  "vec4 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  mediump float minSize = min( visualSize.x, visualSize.y );\n"
+  "  vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);\n"
+  "  vCornerRadius = min( vCornerRadius, minSize * 0.5 );\n"
+  "  vRectSize = visualSize / 2.0 - vCornerRadius;\n"
+  "  vPosition = aPosition* visualSize;\n"
+  "  return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "}\n";
 
 //float distance = length( max( abs( position - center ), size ) - size ) - radius;
-const char* FRAGMENT_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  varying mediump float vCornerRadius;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  \n
-  void main()\n
-  {\n
-      mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;\n
-      gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
-      gl_FragColor.a *= 1.0 - smoothstep( -1.0, 1.0, dist );\n
-  }\n
-);
-
-const char* VERTEX_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp vec3 uSize;\n
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  \n
-  //Visual size and offset
-  uniform mediump vec2 offset;\n
-  uniform highp vec2 size;\n
-  uniform mediump vec2 extraSize;\n
-  uniform mediump vec4 offsetSizeMode;\n
-  uniform mediump vec2 origin;\n
-  uniform mediump vec2 anchorPoint;\n
-  uniform mediump float blurRadius;\n
-  \n
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize + blurRadius * 2.0;\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    vRectSize = visualSize / 2.0;\n
-    vPosition = aPosition* visualSize;\n
-    return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-  \n
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform mediump float blurRadius;\n
-  \n
-  void main()\n
-  {\n
-      mediump vec2 blur = 1.0 - smoothstep( vRectSize - blurRadius * 2.0, vRectSize, abs( vPosition ) );\n
-      gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
-      gl_FragColor.a *= blur.x * blur.y;\n
-  }\n
-);
+const char* FRAGMENT_SHADER_ROUNDED_CORNER =
+  "INPUT mediump vec2 vPosition;\n"
+  "INPUT mediump vec2 vRectSize;\n"
+  "INPUT mediump float vCornerRadius;\n"
+
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+
+  "void main()\n"
+  "{\n"
+  "  mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;\n"
+  "  OUT_COLOR = vec4(mixColor, 1.0) * uColor;\n"
+  "  OUT_COLOR.a *= 1.0 - smoothstep( -1.0, 1.0, dist );\n"
+  "}\n";
+
+const char* VERTEX_SHADER_BLUR_EDGE =
+  "INPUT mediump vec2 aPosition;\n"
+  "OUTPUT mediump vec2 vPosition;\n"
+  "OUTPUT mediump vec2 vRectSize;\n"
+
+  "uniform highp   mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec2 extraSize;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+  "uniform mediump float blurRadius;\n"
+
+  "vec4 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize + blurRadius * 2.0;\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  vRectSize = visualSize / 2.0;\n"
+  "  vPosition = aPosition* visualSize;\n"
+  "  return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "}\n";
+
+const char* FRAGMENT_SHADER_BLUR_EDGE =
+  "INPUT mediump vec2 vPosition;\n"
+  "INPUT mediump vec2 vRectSize;\n"
+
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform mediump float blurRadius;\n"
+
+  "void main()\n"
+  "{\n"
+  "  mediump vec2 blur = 1.0 - smoothstep( vRectSize - blurRadius * 2.0, vRectSize, abs( vPosition ) );\n"
+  "  OUT_COLOR = vec4(mixColor, 1.0) * uColor;\n"
+  "  OUT_COLOR.a *= blur.x * blur.y;\n"
+  "}\n";
 
 }
 
@@ -309,7 +309,7 @@ void ColorVisual::InitializeRenderer()
     shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER_BLUR_EDGE );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER_BLUR_EDGE, FRAGMENT_SHADER_BLUR_EDGE );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER_BLUR_EDGE, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_BLUR_EDGE );
       mFactoryCache.SaveShader( VisualFactoryCache::COLOR_SHADER_BLUR_EDGE, shader );
     }
   }
@@ -318,7 +318,7 @@ void ColorVisual::InitializeRenderer()
     shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER );
       mFactoryCache.SaveShader( VisualFactoryCache::COLOR_SHADER, shader );
     }
   }
@@ -327,7 +327,7 @@ void ColorVisual::InitializeRenderer()
     shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER_ROUNDED_CORNER );
     if( !shader )
     {
-      shader = Shader::New( VERTEX_SHADER_ROUNDED_CORNER, FRAGMENT_SHADER_ROUNDED_CORNER );
+      shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER_ROUNDED_CORNER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ROUNDED_CORNER );
       mFactoryCache.SaveShader( VisualFactoryCache::COLOR_SHADER_ROUNDED_CORNER, shader );
     }
   }
@@ -341,7 +341,7 @@ void ColorVisual::InitializeRenderer()
 
   mImpl->mRenderer.RegisterProperty( BLUR_RADIUS_NAME, mBlurRadius );
 
-  if( mImpl->mMixColor.a < 1.f || !EqualsZero( mBlurRadius ) )
+  if( mImpl->mMixColor.a < 1.f || !EqualsZero( mBlurRadius ) || IsAdvancedBlendEquationApplied() )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
   }
index 462a6c0..7d39a77 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/public-api/object/property-array.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/devel-api/scripting/scripting.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
@@ -458,8 +459,8 @@ void GradientVisual::InitializeRenderer()
   mImpl->mRenderer = Renderer::New( geometry, shader );
   mImpl->mRenderer.SetTextures( textureSet );
 
-  // If opaque then no need to have blending
-  if( mIsOpaque )
+  // If opaque and then no need to have blending
+  if( mIsOpaque && !IsAdvancedBlendEquationApplied() )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
   }
index 45d0e3f..5bc09ce 100644 (file)
@@ -21,6 +21,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
+#include <dali/integration-api/debug.h>
 
 namespace Dali
 {
@@ -36,150 +37,160 @@ namespace
 
 const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform highp   vec3 uSize;\n
-  uniform mediump vec4 pixelArea;
-  varying mediump vec2 vTexCoord;\n
-  \n
-  //Visual size and offset
-  uniform mediump vec2 offset;\n
-  uniform highp   vec2 size;\n
-  uniform mediump vec4 offsetSizeMode;\n
-  uniform mediump vec2 origin;\n
-  uniform mediump vec2 anchorPoint;\n
-  uniform mediump vec2 extraSize;\n
-\n
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-\n
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-    vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER_NO_ATLAS = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vTexCoord;\n
-  uniform sampler2D sTexture;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform lowp float preMultipliedAlpha;\n
-  \n
-  void main()\n
-  {\n
-      gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
-    varying mediump vec2 vTexCoord;\n
-    uniform sampler2D sTexture;\n
-    uniform mediump vec4 uAtlasRect;\n
-    uniform lowp vec4 uColor;\n
-    uniform lowp vec3 mixColor;\n
-    uniform lowp float preMultipliedAlpha;\n
-    \n
-    void main()\n
-    {\n
-        mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
-        gl_FragColor = texture2D( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n
-     }\n
-);
-
-const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP = DALI_COMPOSE_SHADER(
-    varying mediump vec2 vTexCoord;\n
-    uniform sampler2D sTexture;\n
-    uniform mediump vec4 uAtlasRect;\n
-    // WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
-    uniform lowp vec2 wrapMode;\n
-    uniform lowp vec4 uColor;\n
-    uniform lowp vec3 mixColor;\n
-    uniform lowp float preMultipliedAlpha;\n
-    \n
-    mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n
-    {\n
-      mediump float coord;\n
-      if( wrap > 1.5 )\n // REFLECT
-        coord = 1.0-abs(fract(coordinate*0.5)*2.0 - 1.0);\n
-      else \n// warp == 0 or 1
-        coord = mix(coordinate, fract( coordinate ), wrap);\n
-      return clamp( mix(range.x, range.y, coord), range.x, range.y );
-    }\n
-    \n
-    void main()\n
-    {\n
-        mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
-                                      wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n
-        gl_FragColor = texture2D( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n
-    }\n
-);
-
-const char* VERTEX_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  uniform highp   mat4 uMvpMatrix;\n
-  uniform mediump vec3 uSize;\n
-  uniform mediump vec4 pixelArea;
-  varying mediump vec2 vTexCoord;\n
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  varying mediump float vCornerRadius;\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
-  uniform mediump float cornerRadiusPolicy;\n
-  uniform mediump vec2 extraSize;\n
-  \n
-  vec4 ComputeVertexPosition()\n
-  {\n
-    vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n
-    vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-    mediump float minSize = min( visualSize.x, visualSize.y );\n
-    vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);\n
-    vCornerRadius = min( vCornerRadius, minSize * 0.5 );\n
-    vRectSize = visualSize * 0.5 - vCornerRadius;\n
-    vPosition = aPosition* visualSize;\n
-    return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
-  }\n
-\n
-  void main()\n
-  {\n
-    gl_Position = uMvpMatrix * ComputeVertexPosition();\n
-    vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
-  }\n
-);
+const char* VERTEX_SHADER =
+  "INPUT mediump vec2 aPosition;\n"
+  "OUTPUT mediump vec2 vTexCoord;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+  "uniform mediump vec4 pixelArea;"
+  "//Visual size and offset\n"
+
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+  "uniform mediump vec2 extraSize;\n"
+
+  "vec4 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+  "\n"
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "  vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n"
+  "}\n";
+
+const char* FRAGMENT_SHADER_NO_ATLAS =
+  "INPUT mediump vec2 vTexCoord;\n"
+
+  "uniform sampler2D sTexture;\n"
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform lowp float preMultipliedAlpha;\n"
+
+  "void main()\n"
+  "{\n"
+  "  OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n"
+  "}\n";
+
+
+const char* FRAGMENT_SHADER_ATLAS_CLAMP =
+  "INPUT mediump vec2 vTexCoord;\n"
+
+  "uniform sampler2D sTexture;\n"
+  "uniform mediump vec4 uAtlasRect;\n"
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform lowp float preMultipliedAlpha;\n"
+
+  "void main()\n"
+  "{\n"
+  "  mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n"
+  "  OUT_COLOR = TEXTURE( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n"
+  "}\n";
+
+
+const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP =
+  "INPUT mediump vec2 vTexCoord;\n"
+
+  "uniform sampler2D sTexture;\n"
+  "uniform mediump vec4 uAtlasRect;\n"
+  "// WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;"
+  "uniform lowp vec2 wrapMode;\n"
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform lowp float preMultipliedAlpha;\n"
+  "mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n"
+
+  "{\n"
+  "  mediump float coord;\n"
+  "  if( wrap > 1.5 )\n // REFLECT"
+  "    coord = 1.0-abs(fract(coordinate*0.5)*2.0 - 1.0);\n"
+  "  else \n// warp == 0 or 1"
+  "    coord = mix(coordinate, fract( coordinate ), wrap);\n"
+  "  return clamp( mix(range.x, range.y, coord), range.x, range.y );"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),"
+  "                                wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n"
+  "  OUT_COLOR = TEXTURE( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n"
+  "}\n";
+
+const char* VERTEX_SHADER_ROUNDED_CORNER =
+  "INPUT mediump vec2 aPosition;\n"
+  "OUTPUT mediump vec2 vTexCoord;\n"
+  "OUTPUT mediump vec2 vPosition;\n"
+  "OUTPUT mediump vec2 vRectSize;\n"
+  "OUTPUT mediump float vCornerRadius;\n"
+
+  "uniform highp mat4 uMvpMatrix;\n"
+  "uniform highp vec3 uSize;\n"
+  "uniform mediump vec4 pixelArea;"
+
+  "//Visual size and offset\n"
+  "uniform mediump vec2 offset;\n"
+  "uniform highp vec2 size;\n"
+  "uniform mediump vec4 offsetSizeMode;\n"
+  "uniform mediump vec2 origin;\n"
+  "uniform mediump vec2 anchorPoint;\n"
+  "uniform mediump float cornerRadius;\n"
+  "uniform mediump float cornerRadiusPolicy;\n"
+  "uniform mediump vec2 extraSize;\n"
+
+  "vec4 ComputeVertexPosition()\n"
+  "{\n"
+  "  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;\n"
+  "  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n"
+  "  mediump float minSize = min( visualSize.x, visualSize.y );\n"
+  "  vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);\n"
+  "  vCornerRadius = min( vCornerRadius, minSize * 0.5 );\n"
+  "  vRectSize = visualSize * 0.5 - vCornerRadius;\n"
+  "  vPosition = aPosition* visualSize;\n"
+  "  return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n"
+  "}\n"
+
+  "void main()\n"
+  "{\n"
+  "  gl_Position = uMvpMatrix * ComputeVertexPosition();\n"
+  "  vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n"
+  "}\n";
+
 
 //float distance = length( max( abs( position - center ), size ) - size ) - radius;
-const char* FRAGMENT_SHADER_ROUNDED_CORNER = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vTexCoord;\n
-  varying mediump vec2 vPosition;\n
-  varying mediump vec2 vRectSize;\n
-  varying mediump float vCornerRadius;\n
-  uniform sampler2D sTexture;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform lowp float preMultipliedAlpha;\n
-  \n
-  void main()\n
-  {\n
-      mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;\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 *= opacity;\n
-      gl_FragColor.rgb *= mix( 1.0, opacity, preMultipliedAlpha );\n
-  }\n
-);
+const char* FRAGMENT_SHADER_ROUNDED_CORNER =
+  "INPUT mediump vec2 vTexCoord;\n"
+  "INPUT mediump vec2 vPosition;\n"
+  "INPUT mediump vec2 vRectSize;\n"
+  "INPUT mediump float vCornerRadius;\n"
+
+  "uniform sampler2D sTexture;\n"
+  "uniform lowp vec4 uColor;\n"
+  "uniform lowp vec3 mixColor;\n"
+  "uniform lowp float preMultipliedAlpha;\n"
+
+  "void main()\n"
+  "{\n"
+  "  mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;\n"
+  "  mediump float opacity = 1.0 - smoothstep( -1.0, 1.0, dist );\n"
+
+  "  OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n"
+  "  OUT_COLOR.a *= opacity;\n"
+  "  OUT_COLOR.rgb *= mix( 1.0, opacity, preMultipliedAlpha );\n"
+  "}\n";
+
+// global string variable to caching complate vertex shader
+static std::string gVertexShader;
+
+// global string variable to caching complate fragment shader (no atlas)
+static std::string gFragmentShaderNoAtlas;
 
 } // unnamed namespace
 
@@ -201,7 +212,7 @@ Shader ImageVisualShaderFactory::GetShader( VisualFactoryCache& factoryCache, bo
       shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP );
       if( !shader )
       {
-        shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
+        shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ATLAS_CLAMP );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
         factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
       }
@@ -211,7 +222,7 @@ Shader ImageVisualShaderFactory::GetShader( VisualFactoryCache& factoryCache, bo
       shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP );
       if( !shader )
       {
-        shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP );
+        shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
         factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP, shader );
       }
@@ -224,7 +235,7 @@ Shader ImageVisualShaderFactory::GetShader( VisualFactoryCache& factoryCache, bo
       shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER );
       if( !shader )
       {
-        shader = Shader::New( VERTEX_SHADER_ROUNDED_CORNER, FRAGMENT_SHADER_ROUNDED_CORNER );
+        shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER_ROUNDED_CORNER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_ROUNDED_CORNER );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
         factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER, shader );
       }
@@ -234,7 +245,7 @@ Shader ImageVisualShaderFactory::GetShader( VisualFactoryCache& factoryCache, bo
       shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER );
       if( !shader )
       {
-        shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_NO_ATLAS );
+        shader = Shader::New( Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER, Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_NO_ATLAS );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
         factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER, shader );
       }
@@ -244,14 +255,23 @@ Shader ImageVisualShaderFactory::GetShader( VisualFactoryCache& factoryCache, bo
   return shader;
 }
 
-const char* ImageVisualShaderFactory::GetVertexShaderSource()
+std::string_view ImageVisualShaderFactory::GetVertexShaderSource()
 {
-  return VERTEX_SHADER;
+  if(gVertexShader.empty())
+  {
+    gVertexShader = Dali::Shader::GetVertexShaderPrefix() + VERTEX_SHADER;
+  }
+
+  return gVertexShader;
 }
 
-const char* ImageVisualShaderFactory::GetFragmentShaderSource()
+std::string_view ImageVisualShaderFactory::GetFragmentShaderSource()
 {
-  return FRAGMENT_SHADER_NO_ATLAS;
+  if(gFragmentShaderNoAtlas.empty())
+  {
+    gFragmentShaderNoAtlas = Dali::Shader::GetFragmentShaderPrefix() + FRAGMENT_SHADER_NO_ATLAS;
+  }
+  return gFragmentShaderNoAtlas;
 }
 
 } // namespace Internal
index c5344d3..6d38fbd 100644 (file)
@@ -21,6 +21,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <string_view>
 
 namespace Dali
 {
@@ -63,13 +64,13 @@ public:
    * Request the default vertex shader source.
    * @return The default vertex shader source.
    */
-  const char* GetVertexShaderSource();
+  std::string_view GetVertexShaderSource();
 
   /**
    * Request the default fragment shader source.
    * @return The default fragment shader source.
    */
-  const char* GetFragmentShaderSource();
+  std::string_view GetFragmentShaderSource();
 
 protected:
 
index b0324ed..ec130e2 100644 (file)
@@ -543,7 +543,7 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet )
   }
   else
   {
-    vertexShader = mImageVisualShaderFactory.GetVertexShaderSource();
+    vertexShader = mImageVisualShaderFactory.GetVertexShaderSource().data();
   }
 
   std::string fragmentShader;
@@ -553,7 +553,7 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet )
   }
   else
   {
-    fragmentShader = mImageVisualShaderFactory.GetFragmentShaderSource();
+    fragmentShader = mImageVisualShaderFactory.GetFragmentShaderSource().data();
   }
 
   // If the texture is native, we may need to change prefix and sampler in
index 75286ca..8bd9f0a 100644 (file)
@@ -121,15 +121,20 @@ PixelData RasterizingTask::GetPixelData() const
   return mPixelData;
 }
 
-SvgRasterizeThread::SvgRasterizeThread( EventThreadCallback* trigger )
-: mTrigger( std::unique_ptr< EventThreadCallback >(trigger) ),
+SvgRasterizeThread::SvgRasterizeThread()
+: mTrigger( new EventThreadCallback( MakeCallback( this, &SvgRasterizeThread::ApplyRasterizedSVGToSampler ) ) ),
   mLogFactory( Dali::Adaptor::Get().GetLogFactory() ),
-  mIsThreadWaiting( false )
+  mIsThreadWaiting( false ),
+  mProcessorRegistered( false )
 {
 }
 
 SvgRasterizeThread::~SvgRasterizeThread()
 {
+  if( mProcessorRegistered )
+  {
+    Adaptor::Get().UnregisterProcessor( *this );
+  }
 }
 
 void SvgRasterizeThread::TerminateThread( SvgRasterizeThread*& thread )
@@ -168,6 +173,12 @@ void SvgRasterizeThread::AddTask( RasterizingTaskPtr task )
       }
     }
     mRasterizeTasks.push_back( task );
+
+    if( !mProcessorRegistered )
+    {
+      Adaptor::Get().RegisterProcessor( *this );
+      mProcessorRegistered = true;
+    }
   }
 
   if( wasEmpty)
@@ -209,6 +220,8 @@ void SvgRasterizeThread::RemoveTask( SvgVisual* visual )
       }
     }
   }
+
+  UnregisterProcessor();
 }
 
 void SvgRasterizeThread::DeleteImage( VectorImageRenderer vectorRenderer )
@@ -276,6 +289,34 @@ void SvgRasterizeThread::Run()
   }
 }
 
+void SvgRasterizeThread::ApplyRasterizedSVGToSampler()
+{
+  while( RasterizingTaskPtr task = NextCompletedTask() )
+  {
+    task->GetSvgVisual()->ApplyRasterizedImage(task->GetVectorRenderer(), task->GetPixelData(), task->IsLoaded());
+  }
+
+  UnregisterProcessor();
+}
+
+void SvgRasterizeThread::Process()
+{
+  ApplyRasterizedSVGToSampler();
+}
+
+void SvgRasterizeThread::UnregisterProcessor()
+{
+  if ( mProcessorRegistered )
+  {
+    if( mRasterizeTasks.empty() && mCompletedTasks.empty() )
+    {
+      Adaptor::Get().UnregisterProcessor( *this );
+      mProcessorRegistered = false;
+    }
+  }
+}
+
+
 } // namespace Internal
 
 } // namespace Toolkit
index d7eb16b..705d411 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali/public-api/rendering/texture-set.h>
 #include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/processor-interface.h>
 #include <memory>
 
 // INTERNAL INCLUDES
@@ -128,7 +129,7 @@ private:
 /**
  * The worker thread for SVG rasterization.
  */
-class SvgRasterizeThread : public Thread
+class SvgRasterizeThread : public Thread, Integration::Processor
 {
 public:
 
@@ -137,7 +138,7 @@ public:
    *
    * @param[in] trigger The trigger to wake up the main thread.
    */
-  SvgRasterizeThread( EventThreadCallback* trigger );
+  SvgRasterizeThread();
 
   /**
    * Terminate the svg rasterize thread, join and delete.
@@ -176,6 +177,11 @@ public:
    */
   void DeleteImage( VectorImageRenderer vectorImage );
 
+    /**
+   * @copydoc Dali::Integration::Processor::Process()
+   */
+  void Process() override;
+
 private:
 
   /**
@@ -192,6 +198,17 @@ private:
    */
   void AddCompletedTask( RasterizingTaskPtr task );
 
+  /**
+   * Applies the rasterized image to material
+   */
+  void ApplyRasterizedSVGToSampler();
+
+  /**
+   * @brief Unregister a previously registered processor
+   *
+   */
+  void UnregisterProcessor();
+
 protected:
 
   /**
@@ -225,6 +242,7 @@ private:
   std::unique_ptr< EventThreadCallback > mTrigger;
   const Dali::LogFactoryInterface&       mLogFactory;
   bool                       mIsThreadWaiting;
+  bool                       mProcessorRegistered;
 };
 
 } // namespace Internal
index 32ff4cf..09d8de2 100644 (file)
@@ -145,8 +145,8 @@ void SvgVisual::DoSetOnScene( Actor& actor )
   }
   else
   {
-    shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource() : mImpl->mCustomShader->mVertexShader,
-                          mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource() : mImpl->mCustomShader->mFragmentShader,
+    shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
+                          mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
                           mImpl->mCustomShader->mHints );
 
     shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
index 64bbb5b..5e0b506 100644 (file)
@@ -819,6 +819,8 @@ void TextureManager::QueueLoadTexture( TextureInfo& textureInfo, TextureUploadOb
 {
   auto textureId = textureInfo.textureId;
   mLoadQueue.PushBack( LoadQueueElement( textureId, observer) );
+
+  observer->DestructionSignal().Connect( this, &TextureManager::ObserverDestroyed );
 }
 
 void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
@@ -853,6 +855,11 @@ void TextureManager::ProcessQueuedTextures()
 {
   for( auto&& element : mLoadQueue )
   {
+    if( !element.mObserver )
+    {
+      continue;
+    }
+
     int cacheIndex = GetCacheIndexFromId( element.mTextureId );
     if( cacheIndex != INVALID_CACHE_INDEX )
     {
@@ -1312,6 +1319,15 @@ void TextureManager::ObserverDestroyed( TextureUploadObserver* observer )
       }
     }
   }
+
+  // Remove element from the LoadQueue
+  for( auto&& element : mLoadQueue )
+  {
+    if( element.mObserver == observer )
+    {
+      element.mObserver = nullptr;
+    }
+  }
 }
 
 
index 885bc72..748bcec 100755 (executable)
@@ -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.
@@ -413,6 +413,11 @@ bool Visual::Base::IsPreMultipliedAlphaEnabled() const
   return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA;
 }
 
+bool Visual::Base::IsAdvancedBlendEquationApplied() const
+{
+  return IsPreMultipliedAlphaEnabled() && DevelRenderer::IsAdvancedBlendEquationApplied( mImpl->mRenderer );
+}
+
 void Visual::Base::DoSetOffScene( Actor& actor )
 {
   actor.RemoveRenderer( mImpl->mRenderer );
@@ -446,7 +451,7 @@ void Visual::Base::RegisterMixColor()
       Vector3(mImpl->mMixColor) );
   }
 
-  if( mImpl->mMixColor.a < 1.f )
+  if( mImpl->mMixColor.a < 1.f || IsAdvancedBlendEquationApplied() )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
   }
@@ -469,7 +474,7 @@ void Visual::Base::SetMixColor( const Vector4& color )
   {
     mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) );
     mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, color.a );
-    if( color.a < 1.f )
+    if( color.a < 1.f || IsAdvancedBlendEquationApplied() )
     {
       mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
     }
@@ -770,7 +775,8 @@ void Visual::Base::SetupBlendMode( Animation& transition, bool isInitialOpaque,
 {
   // Ensure the blend mode is turned on if we are animating opacity, and
   // turned off after the animation ends if the final value is opaque
-  if( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f )
+  if( ( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f ) ||
+      ( mImpl->mRenderer && IsAdvancedBlendEquationApplied() ) )
   {
     if( mImpl->mRenderer )
     {
@@ -795,8 +801,16 @@ void Visual::Base::OnMixColorFinished( Animation& animation )
   if( mImpl->mRenderer )
   {
     DALI_LOG_INFO( gVisualBaseLogFilter, Debug::General, "Visual::Base::OnMixColorFinished()\n");
-    mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE,
-                                  ( mImpl->mMixColor.a < 1.0 ) ? BlendMode::ON : BlendMode::AUTO );
+
+    if( mImpl->mMixColor.a >= 1.f &&
+        !IsAdvancedBlendEquationApplied() )
+    {
+      mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO );
+    }
+    else
+    {
+      mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+    }
   }
   delete mImpl->mBlendSlotDelegate;
   mImpl->mBlendSlotDelegate = NULL;
index d9ff2dd..8fa2e5e 100644 (file)
@@ -170,6 +170,13 @@ public:
   bool IsPreMultipliedAlphaEnabled() const;
 
   /**
+   * @brief Query whether advanced blend equation is applied.
+   *
+   * @return True is advanced blend equation is applied, false otherwise.
+   */
+  bool IsAdvancedBlendEquationApplied() const;
+
+  /**
    * @brief Sets properties of custom shader
    * @param[in] propertyMap Property map containing the custom shader data
    */
index 0fa35b9..bb6eb81 100644 (file)
@@ -125,7 +125,7 @@ SvgRasterizeThread* VisualFactoryCache::GetSVGRasterizationThread()
 {
   if( !mSvgRasterizeThread )
   {
-    mSvgRasterizeThread = new SvgRasterizeThread( new EventThreadCallback( MakeCallback( this, &VisualFactoryCache::ApplyRasterizedSVGToSampler ) ) );
+    mSvgRasterizeThread = new SvgRasterizeThread();
     mSvgRasterizeThread->Start();
   }
   return mSvgRasterizeThread;
@@ -140,14 +140,6 @@ VectorAnimationManager& VisualFactoryCache::GetVectorAnimationManager()
   return *mVectorAnimationManager;
 }
 
-void VisualFactoryCache::ApplyRasterizedSVGToSampler()
-{
-  while( RasterizingTaskPtr task = mSvgRasterizeThread->NextCompletedTask() )
-  {
-    task->GetSvgVisual()->ApplyRasterizedImage(task->GetVectorRenderer(), task->GetPixelData(), task->IsLoaded());
-  }
-}
-
 Geometry VisualFactoryCache::CreateGridGeometry( Uint16Pair gridSize )
 {
   uint16_t gridWidth = gridSize.GetWidth();
index 5fab354..8037857 100644 (file)
@@ -220,13 +220,6 @@ public:
    */
   VectorAnimationManager& GetVectorAnimationManager();
 
-private: // for svg rasterization thread
-
-  /**
-   * Applies the rasterized image to material
-   */
-  void ApplyRasterizedSVGToSampler();
-
 protected:
 
   /**
index 0f1b716..2367539 100644 (file)
@@ -27,9 +27,9 @@ namespace Dali
 {
 namespace Toolkit
 {
-const unsigned int TOOLKIT_MAJOR_VERSION = 1;
-const unsigned int TOOLKIT_MINOR_VERSION = 9;
-const unsigned int TOOLKIT_MICRO_VERSION = 36;
+const unsigned int TOOLKIT_MAJOR_VERSION = 2;
+const unsigned int TOOLKIT_MINOR_VERSION = 0;
+const unsigned int TOOLKIT_MICRO_VERSION = 0;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index a9c3953..aae6b64 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.9.36
+Version:    2.0.0
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT