[dali_1.1.21] Merge branch 'devel/master' 15/59315/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 12 Feb 2016 10:33:02 +0000 (10:33 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 12 Feb 2016 10:33:02 +0000 (10:33 +0000)
Change-Id: I57c848e415a6d08ce9ea20dcbc6744d065f6a048

43 files changed:
automated-tests/README.md
automated-tests/build.sh
automated-tests/execute.sh
automated-tests/scripts/output_summary.pl [new file with mode: 0755]
automated-tests/scripts/summarize.pl
automated-tests/src/dali-toolkit-internal/tct-dali-toolkit-internal-core.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h
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/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h
automated-tests/src/dali-toolkit/tct-dali-toolkit-core.cpp
automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp
automated-tests/src/dali-toolkit/utc-Dali-ControlRenderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp
dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.cpp
dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp
dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
dali-toolkit/internal/controls/renderers/color/color-renderer.cpp
dali-toolkit/internal/controls/renderers/control-renderer-impl.cpp
dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec
plugins/dali-script-v8/src/constants/constants-wrapper.cpp
plugins/dali-script-v8/src/rendering/material-api.cpp
plugins/dali-script-v8/src/rendering/material-api.h
plugins/dali-script-v8/src/rendering/material-wrapper.cpp
plugins/dali-script-v8/src/rendering/renderer-api.cpp
plugins/dali-script-v8/src/rendering/renderer-api.h
plugins/dali-script-v8/src/rendering/renderer-wrapper.cpp

index 12d0769..6761a3b 100644 (file)
@@ -80,29 +80,34 @@ Or without cleaning down the build area (Useful for fast build/run/debug cycles)
 Executing the tests
 -------------------
 
+To see a list of all of the options:
+
+    ./execute.sh -h
+
 To execute tests, cd into automated-tests and run
 
     ./execute.sh
 
 This will execute dali and dali-internal test sets. Note that the output summary for the first will be printed before running the second.
 
-By default the tests execute in parallel, which is faster but does not produce any test case output.  Use this to execute the tests in series:
+By default the tests execute in parallel, which is faster but does not produce any test case output files.  Use this to execute the tests in series and log test output to stdout/err
 
-    ./execute.sh -s
+    ./execute.sh -S
 
-To see the results, copy the style folder from web-tct_2.2.1_r1/tools/tct-mgr/style into automated-tests and run
+To use test kit lite, (which is very slow),
 
-    firefox --new-window summary.xml
+    ./execute.sh -s
 
-To see a list of all of the options:
+To see the test kit lite results, copy the style folder from web-tct_2.2.1_r1/tools/tct-mgr/style into automated-tests and run
 
-    ./execute.sh -h
+    firefox --new-window summary.xml
 
 To execute a subset of tests, you can run individual test sets, e.g.
 
-    ./execute.sh dali
+    ./execute.sh dali-toolkit
 
-To get coverage output, run
+To get coverage output (you need to first build dali libraries with
+--coverage), run
 
     ./coverage.sh
 
@@ -188,15 +193,15 @@ Debugging
 On desktop, you can debug the tests by running gdb on the test program:
 
     $ cd automated-tests
-    $ gdb build/src/dali/tct-dali-core
+    $ gdb build/src/dali-toolkit/tct-dali-toolkit-core
     gdb> r <TestCase>
 
 replace `<TestCase>` with the name of the failing testcase.
 
-For example, using testcase UtcDaliNinePatch01 from the dali-core test suite:
+For example, using testcase UtcDaliControlBackgroundProperties from the dali-toolkit test suite:
 
-    $ gdb build/src/dali/tct-dali-core
-    gdb> r UtcDaliNinePatch01
+    $ gdb build/src/dali-toolkit/tct-dali-toolkit-core
+    gdb> r UtcDaliControlBackgroundProperties
 
 
 On target, you can re-install the test RPM and associated debug RPMs manually using
@@ -206,7 +211,7 @@ On target, you can re-install the test RPM and associated debug RPMs manually us
 After installing the rpm and it's debug RPMs, you can find the executable in /opt/usr/bin/tct-dali-core. First ensure you have smack permissions set:
 
     chsmack -e "^" /usr/bin/gdb
-    chsmack -e "^" /opt/usr/bin/tct-dali-core/tct-dali-core
+    chsmack -e "^" /opt/usr/bin/tct-dali-toolkit-core/tct-dali-toolkit-core
 
 then run it under gdb as above.
 
index 7c7584b..2f92135 100755 (executable)
@@ -48,3 +48,6 @@ else
     fi
   done
 fi
+
+echo "Build succeeded"
+exit 0
index 04dbd1f..64e27ee 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-TEMP=`getopt -o hsr --long help,serial,rerun -n 'execute.sh' -- "$@"`
+TEMP=`getopt -o hsSm --long help,serial,tct,modules -n 'execute.sh' -- "$@"`
 
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
 
@@ -9,41 +9,70 @@ eval set -- "$TEMP"
 
 function usage
 {
-    echo -e "Usage: execute.sh\t\tExecute test cases from all modules in parallel"
-    echo -e "       execute.sh <testmodule>\tExecute test cases from the given module in parallel"
-    echo -e "       execute.sh -s\t\tExecute test cases in serial using Testkit-Lite"
-    echo -e "       execute.sh -r\t\tExecute test cases in parallel, re-running failed test cases in serial afterwards"
+    echo -e "Usage: execute.sh [-s|-S|-r] [module|testcase]"
+    echo -e "       execute.sh\t\tExecute test cases from all modules in parallel"
+    echo -e "       execute.sh [module]\tExecute test cases from the given module in parallel"
+    echo -e "       execute.sh -s [module]\t\tExecute test cases in serial using Testkit-Lite"
+    echo -e "       execute.sh -S [module]\t\tExecute test cases in serial"
     echo -e "       execute.sh <testcase>\tFind and execute the given test case"
     exit 2
 }
 
-opt_serial=0
-opt_rerun=""
+opt_tct=0
+opt_serial=""
+opt_modules=0
 while true ; do
     case "$1" in
         -h|--help)     usage ;;
-        -s|--serial)   opt_serial=1 ; shift ;;
-        -r|--rerun)    opt_rerun="-r" ; shift ;;
+        -s|--tct)      opt_tct=1 ; shift ;;
+        -S|--serial)   opt_serial="-s" ; shift ;;
+        -m|--modules)  opt_modules=1 ; shift ;;
         --) shift; break;;
         *) echo "Internal error $1!" ; exit 1 ;;
     esac
 done
 
-function execute
+function execute_tct
 {
     scripts/tctestsgen.sh $1 `pwd` desktop $2
     testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml  -A --comm localhost
     scripts/add_style.pl $1
 }
 
+function summary_start
+{
+    start=`date +"%Y-%m-%d_%H_%M_%S"`
+    cat > summary.xml <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
+<result_summary plan_name="Core">
+  <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
+  <summary test_plan_name="Dali">
+    <start_at>$start</start_at>
+    <end_at>$start</end_at>
+  </summary>
+EOF
+}
+
+function summary_end
+{
+    cat >> summary.xml <<EOF
+</result_summary>
+EOF
+}
 
+if [ $opt_modules == 1 ] ; then
+    modules= get_modules
+    echo $modules
+    exit 0
+fi
 
 # Clean up old test results
 rm -f tct*core-tests.xml
 
 # Clean up old coverage data
 if [ -d ../build/tizen ] ; then
-    rm -f ../build/tizen/dali-core/.libs/*.gcda
+    rm -f ../build/tizen/dali-toolkit/.libs/*.gcda
 fi
 
 find build \( -name "*.gcda" \) -exec rm '{}' \;
@@ -51,47 +80,56 @@ find build \( -name "*.gcda" \) -exec rm '{}' \;
 ASCII_BOLD="\e[1m"
 ASCII_RESET="\e[0m"
 
-if [ $opt_serial = 1 ] ; then
+modules=`ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
+if [ -f summary.xml ] ; then unlink summary.xml ; fi
+
+if [ $opt_tct == 1 ] ; then
+    # Use Test-kit lite
     # Run all test case executables serially, create XML output
     if [ -n "$1" ] ; then
-        execute $1 $*
+        execute_tct $1 $*
     else
-        for mod in `ls -1 src/ | grep -v CMakeList `
+        for mod in $modules
         do
             if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
 
                 echo -ne "$ASCII_BOLD"
                 echo -e "Executing $mod$ASCII_RESET"
-                execute $mod $*
+                execute_tct $mod $*
             fi
         done
     fi
 
     scripts/summarize.pl
+
 else
-    # if $1 is an executable filename, execute it·
+    # Execute test cases using own test harness
 
     if [ -z "$1" ] ; then
         # No arguments:
-        # Execute each test executable in turn, using parallel execution
-        for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
+        # Execute each test executable in turn (by default, runs tests in parallel)
+        summary_start
+        for mod in $modules
         do
             echo -e "$ASCII_BOLD"
             echo -e "Executing $mod$ASCII_RESET"
-            build/src/$mod/tct-$mod-core $opt_rerun
+            build/src/$mod/tct-$mod-core -r $opt_serial
         done
+        summary_end
 
     elif [ -f "build/src/$1/tct-$1-core" ] ; then
         # First argument is an executable filename - execute only that with any
         # remaining arguments
+        summary_start
         module=$1
         shift;
-        build/src/$module/tct-$module-core $opt_rerun $*
+        build/src/$module/tct-$module-core -r $opt_serial $*
+        summary_end
 
     else
        # First argument is not an executable. Is it a test case name?
        # Try executing each executable with the test case name until success/known failure
-        for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
+        for mod in $modules
         do
             output=`build/src/$mod/tct-$mod-core $1`
             ret=$?
@@ -104,3 +142,9 @@ else
         echo $1 not found
     fi
 fi
+
+if [ -f summary.xml ] ; then
+    scripts/output_summary.pl
+fi
+
+exit $?
diff --git a/automated-tests/scripts/output_summary.pl b/automated-tests/scripts/output_summary.pl
new file mode 100755 (executable)
index 0000000..dec392d
--- /dev/null
@@ -0,0 +1,78 @@
+#!/usr/bin/perl
+
+# Reads summary.xml and produces human readable output
+
+use strict;
+use XML::Parser;
+use Encode;
+use Getopt::Long;
+use Cwd;
+
+my $pwd = getcwd;
+my $text = "";
+my $module="";
+my %modules=();
+
+sub handle_start
+{
+    my ($p, $elt, %attrs) = @_;
+
+    if($elt =~ /suite/)
+    {
+        $module=$attrs{"name"};
+    }
+    if($elt =~ /_case/)
+    {
+        $text = "";
+    }
+}
+
+sub handle_end
+{
+  my ($p, $elt) = @_;
+  if($elt =~ /pass_case/)
+  {
+      $modules{$module}->{"pass"}=$text;
+      $text="";
+  }
+  elsif($elt =~ /fail_case/)
+  {
+      $modules{$module}->{"fail"}=$text;
+      $text="";
+  }
+}
+
+sub handle_char
+{
+  my ($p, $str) = @_;
+  $text .= $str;
+}
+
+my($parser) = new XML::Parser(Handlers => {Start => \&handle_start,
+                                           End   => \&handle_end,
+                                           Char  => \&handle_char});
+$parser->parsefile("summary.xml");
+
+my $RED_COLOR="\e[1;31m";
+my $GREEN_COLOR="\e[1;32m";
+my $ASCII_RESET="\e[0m";
+my $ASCII_BOLD="\e[1m";
+
+print "\n";
+my $totalFailures=0;
+foreach $module (keys(%modules))
+{
+    my $result_colour = $GREEN_COLOR;
+    if( $modules{$module}->{"fail"} )
+    {
+        $result_colour = $RED_COLOR;
+    }
+    my $numPasses = $modules{$module}->{"pass"};
+    my $numFailures = $modules{$module}->{"fail"};
+    $totalFailures += $numFailures;
+    print( "$ASCII_BOLD$module results:$ASCII_RESET\n" );
+    printf("Number of test passes:   %s%4d (%5.2f%%)%s\n", $ASCII_BOLD, $numPasses, 100.0 * $numPasses / ($numPasses+$numFailures),  $ASCII_RESET);
+    printf("%sNumber of test failures:%s %s%4d%s\n\n", $result_colour, $ASCII_RESET, $ASCII_BOLD, $numFailures, $ASCII_RESET);
+}
+
+exit $totalFailures == 0;
index c90eb89..8270376 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+# Generates an XML summary of test cases from Test-kit lite output XML.
+
 use strict;
 use XML::Parser;
 use Encode;
index 0a37d05..fcf09c6 100644 (file)
@@ -8,8 +8,9 @@ int main(int argc, char * const argv[])
 {
   int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
 
-  const char* optString = "r";
-  bool optRerunFailed(false);
+  const char* optString = "rs";
+  bool optRerunFailed(true);
+  bool optRunSerially(false);
 
   int nextOpt = 0;
   do
@@ -20,6 +21,9 @@ int main(int argc, char * const argv[])
       case 'r':
         optRerunFailed = true;
         break;
+      case 's':
+        optRunSerially = true;
+        break;
       case '?':
         TestHarness::Usage(argv[0]);
         exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
@@ -29,7 +33,14 @@ int main(int argc, char * const argv[])
 
   if( optind == argc ) // no testcase name in argument list
   {
-    result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
+    if( optRunSerially )
+    {
+      result = TestHarness::RunAll( argv[0], tc_array );
+    }
+    else
+    {
+      result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+    }
   }
   else
   {
index 995e117..5fb6e11 100644 (file)
@@ -59,6 +59,9 @@ TestApplication::TestApplication( bool   initialize,
 
 void TestApplication::Initialize()
 {
+  // We always need the first update!
+  mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING;
+
   mCore = Dali::Integration::Core::New(
     mRenderController,
     mPlatformAbstraction,
@@ -153,11 +156,20 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
 
 void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
 {
+  if( GetUpdateStatus() == 0 &&
+      mRenderStatus.NeedsUpdate() == false &&
+      ! GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc) )
+  {
+    fprintf(stderr, "WARNING - Update not required\n");
+  }
+
   unsigned int nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
   float elapsedSeconds = intervalMilliseconds / 1e3f;
 
   mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
 
+  GetRenderController().Initialize();
+
   mLastVSyncTime = nextVSyncTime;
 }
 
@@ -182,6 +194,15 @@ bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds  )
   return mStatus.KeepUpdating();
 }
 
+bool TestApplication::GetRenderNeedsUpdate()
+{
+  return mRenderStatus.NeedsUpdate();
+}
+bool TestApplication::GetRenderHasRendered()
+{
+  return mRenderStatus.HasRendered();
+}
+
 bool TestApplication::RenderOnly( )
 {
   // Update Time values
index 3f61b93..cb5a92c 100644 (file)
@@ -78,6 +78,8 @@ public:
   bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
   bool RenderOnly( );
   void ResetContext();
+  bool GetRenderNeedsUpdate();
+  bool GetRenderHasRendered();
 
 private:
   void DoUpdate( unsigned int intervalMilliseconds );
index d8af042..4a12bdb 100644 (file)
@@ -43,24 +43,19 @@ void TestGlAbstraction::Initialize()
   mIsRenderbufferResult = 0;
   mIsShaderResult = 0;
   mIsTextureResult = 0;
-  mVertexAttribArrayChanged = false;
-
+  mActiveTextureUnit = 0;
   mCheckFramebufferStatusResult = 0;
   mFramebufferStatus = 0;
   mFramebufferColorAttached = 0;
   mFramebufferDepthAttached = 0;
   mFramebufferStencilAttached = 0;
-
   mNumBinaryFormats = 0;
   mBinaryFormats = 0;
   mProgramBinaryLength = 0;
-  mGetProgramBinaryCalled = false;
 
-  mLastAutoTextureIdUsed = 0;
+  mVertexAttribArrayChanged = false;
+  mGetProgramBinaryCalled = false;
 
-  mLastShaderIdUsed = 0;
-  mLastProgramIdUsed = 0;
-  mLastUniformIdUsed = 0;
   mLastShaderCompiled = 0;
   mLastClearBitMask = 0;
   mClearCount = 0;
@@ -71,6 +66,10 @@ void TestGlAbstraction::Initialize()
   mLastBlendFuncDstRgb    = 0;
   mLastBlendFuncSrcAlpha  = 0;
   mLastBlendFuncDstAlpha  = 0;
+  mLastAutoTextureIdUsed = 0;
+  mLastShaderIdUsed = 0;
+  mLastProgramIdUsed = 0;
+  mLastUniformIdUsed = 0;
 
   mUniforms.clear();
   mProgramUniforms1i.clear();
@@ -78,6 +77,11 @@ void TestGlAbstraction::Initialize()
   mProgramUniforms2f.clear();
   mProgramUniforms3f.clear();
   mProgramUniforms4f.clear();
+
+  for( unsigned int i=0; i<MAX_ATTRIBUTE_CACHE_SIZE; ++i )
+  {
+    mVertexAttribArrayState[i] = false;
+  }
 }
 
 void TestGlAbstraction::PreRender()
index dea1c90..3d35394 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <sstream>
 #include <string>
+#include <cstring>
 #include <map>
 #include <cstdio>
 #include <cstring> // for strcmp
@@ -350,11 +351,11 @@ public:
   inline void DeleteTextures(GLsizei n, const GLuint* textures)
   {
     std::stringstream out;
-    out << n << ", " << textures << " = [" ;
+    out << n << ", " << textures << " = [";
 
     for(GLsizei i=0; i<n; i++)
     {
-      out << textures[i] << ", " ;
+      out << textures[i] << ", ";
       mDeletedTextureIds.push_back(textures[i]);
     }
     out << "]";
index 533355c..65a884e 100644 (file)
@@ -132,5 +132,10 @@ void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
  */
 TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }
 
+int TestGlSyncAbstraction::GetNumberOfSyncObjects()
+{
+  return mSyncObjects.size();
+}
+
 
 } // Dali
index e233176..278bcd7 100644 (file)
@@ -100,6 +100,13 @@ public: // TEST FUNCTIONS
    */
   TraceCallStack& GetTrace();
 
+  /**
+   * Get the number of sync objects
+   *
+   * @return the number of sync objects
+   */
+  int GetNumberOfSyncObjects();
+
 private:
   typedef std::vector<TestSyncObject*>   SyncContainer;
   typedef SyncContainer::iterator SyncIter;
index 55beebc..332ddaa 100644 (file)
@@ -29,15 +29,18 @@ namespace TestHarness
 
 typedef std::map<int, TestCase> RunningTestCases;
 
-namespace
+const char* basename(const char* path)
 {
-const char* RED_COLOR="\e[1;31m";
-const char* GREEN_COLOR="\e[1;32m";
-const char* ASCII_RESET="\e[0m";
-const char* ASCII_BOLD="\e[1m";
+  const char* ptr=path;
+  const char* slash=NULL;
+  for( ; *ptr != '\0' ; ++ptr )
+  {
+    if(*ptr == '/') slash=ptr;
+  }
+  if(slash != NULL) ++slash;
+  return slash;
 }
 
-
 int RunTestCase( struct ::testcase_s& testCase )
 {
   int result = EXIT_STATUS_TESTCASE_FAILED;
@@ -71,7 +74,24 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu
       close(STDOUT_FILENO);
       close(STDERR_FILENO);
     }
-    exit( RunTestCase( testCase ) );
+    else
+    {
+      printf("\n");
+      for(int i=0; i<80; ++i) printf("#");
+      printf("\nTC: %s\n", testCase.name);
+      fflush(stdout);
+    }
+
+    int status = RunTestCase( testCase );
+
+    if( ! suppressOutput )
+    {
+      fflush(stdout);
+      fflush(stderr);
+      fclose(stdout);
+      fclose(stderr);
+    }
+    exit( status );
   }
   else if(pid == -1)
   {
@@ -81,7 +101,7 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu
   else // Parent process
   {
     int status = 0;
-    int childPid = waitpid(-1, &status, 0);
+    int childPid = waitpid(pid, &status, 0);
     if( childPid == -1 )
     {
       perror("waitpid");
@@ -100,38 +120,55 @@ int RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutpu
     }
     else if(WIFSIGNALED(status) )
     {
+      int signal = WTERMSIG(status);
       testResult = EXIT_STATUS_TESTCASE_ABORTED;
-
-#ifdef WCOREDUMP
-      if(WCOREDUMP(status))
+      if( signal == SIGABRT )
+      {
+        printf("Test case %s failed: test case asserted\n", testCase.name );
+      }
+      else
       {
-        printf("Test case %s failed: due to a crash\n", testCase.name);
+        printf("Test case %s failed: exit with signal %s\n", testCase.name, strsignal(WTERMSIG(status)));
       }
-#endif
-      printf("Test case %s failed: exit with signal %s\n", testCase.name, strsignal(WTERMSIG(status)));
     }
     else if(WIFSTOPPED(status))
     {
       printf("Test case %s failed: stopped with signal %s\n", testCase.name, strsignal(WSTOPSIG(status)));
     }
   }
+  fflush(stdout);
+  fflush(stderr);
   return testResult;
 }
 
-void OutputStatistics( int numPasses, int numFailures )
+void OutputStatistics( const char* processName, int numPasses, int numFailures )
 {
-  const char* failureColor = GREEN_COLOR;
-  if( numFailures > 0 )
+  FILE* fp=fopen("summary.xml", "a");
+  if( fp != NULL )
   {
-    failureColor = RED_COLOR;
+    fprintf( fp,
+             "  <suite name=\"%s\">\n"
+             "    <total_case>%d</total_case>\n"
+             "    <pass_case>%d</pass_case>\n"
+             "    <pass_rate>%5.2f</pass_rate>\n"
+             "    <fail_case>%d</fail_case>\n"
+             "    <fail_rate>%5.2f</fail_rate>\n"
+             "    <block_case>0</block_case>\n"
+             "    <block_rate>0.00</block_rate>\n"
+             "    <na_case>0</na_case>\n"
+             "    <na_rate>0.00</na_rate>\n"
+             "  </suite>\n",
+             basename(processName),
+             numPasses+numFailures,
+             numPasses,
+             (float)numPasses/(numPasses+numFailures),
+             numFailures,
+             (float)numFailures/(numPasses+numFailures) );
+    fclose(fp);
   }
-  printf("\rNumber of test passes:   %s%4d (%5.2f%%)%s\n", ASCII_BOLD, numPasses, 100.0f * (float)numPasses / (numPasses+numFailures),  ASCII_RESET);
-  printf("%sNumber of test failures:%s %s%4d%s\n", failureColor, ASCII_RESET, ASCII_BOLD, numFailures, ASCII_RESET);
-
 }
 
-
-int RunAll(const char* processName, ::testcase tc_array[], bool reRunFailed)
+int RunAll( const char* processName, ::testcase tc_array[] )
 {
   int numFailures = 0;
   int numPasses = 0;
@@ -139,7 +176,7 @@ int RunAll(const char* processName, ::testcase tc_array[], bool reRunFailed)
   // Run test cases in child process( to kill output/handle signals ), but run serially.
   for( unsigned int i=0; tc_array[i].name; i++)
   {
-    int result = RunTestCaseInChildProcess( tc_array[i], true );
+    int result = RunTestCaseInChildProcess( tc_array[i], false );
     if( result == 0 )
     {
       numPasses++;
@@ -150,13 +187,11 @@ int RunAll(const char* processName, ::testcase tc_array[], bool reRunFailed)
     }
   }
 
-  OutputStatistics(numPasses, numFailures);
+  OutputStatistics( processName, numPasses, numFailures);
 
   return numFailures;
 }
 
-
-
 // Constantly runs up to MAX_NUM_CHILDREN processes
 int RunAllInParallel(  const char* processName, ::testcase tc_array[], bool reRunFailed)
 {
@@ -250,7 +285,7 @@ int RunAllInParallel(  const char* processName, ::testcase tc_array[], bool reRu
     }
   }
 
-  OutputStatistics( numPasses, numFailures );
+  OutputStatistics( processName, numPasses, numFailures );
 
   if( reRunFailed )
   {
index e6dc517..53ac0b9 100644 (file)
@@ -85,10 +85,9 @@ int RunAllInParallel(const char* processName, testcase tc_array[], bool reRunFai
  * Run all test cases in serial
  * @param[in] processName The name of this process
  * @param[in] tc_array The array of auto-generated testkit-lite test cases
- * @param[in] reRunFailed True if failed test cases should be re-run
  * @return 0 on success
  */
-int RunAll(const char* processName, testcase tc_array[], bool reRunFailed);
+int RunAll( const char* processName, testcase tc_array[] );
 
 /**
  * Find the named test case in the given array, and run it
index 921088b..bda38d3 100644 (file)
@@ -84,7 +84,6 @@ int TraceCallStack::CountMethod(std::string method) const
   return numCalls;
 }
 
-
 /**
  * Search for a method in the stack with the given parameter list
  * @param[in] method The name of the method
@@ -93,16 +92,27 @@ int TraceCallStack::CountMethod(std::string method) const
  */
 bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const
 {
-  bool found = false;
+  return FindIndexFromMethodAndParams( method, params ) > -1;
+}
+
+/**
+ * Search for a method in the stack with the given parameter list
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ * @return index in the stack where the method was found or -1 otherwise
+ */
+int TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string params) const
+{
+  int index = -1;
   for( size_t i=0; i < mCallStack.size(); i++ )
   {
     if( 0 == mCallStack[i][0].compare(method) && 0 == mCallStack[i][1].compare(params) )
     {
-      found = true;
+      index = i;
       break;
     }
   }
-  return found;
+  return index;
 }
 
 /**
index 25b77f8..d319487 100644 (file)
@@ -78,6 +78,14 @@ public:
   bool FindMethodAndParams(std::string method, std::string params) const;
 
   /**
+   * Search for a method in the stack with the given parameter list
+   * @param[in] method The name of the method
+   * @param[in] params A comma separated list of parameter values
+   * @return index in the stack where the method was found or -1 otherwise
+   */
+  int FindIndexFromMethodAndParams(std::string method, std::string params) const;
+
+  /**
    * Test if the given method and parameters are at a given index in the stack
    * @param[in] index Index in the call stack
    * @param[in] method Name of method to test
index 87b2f56..b603310 100644 (file)
@@ -8,8 +8,9 @@ int main(int argc, char * const argv[])
 {
   int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
 
-  const char* optString = "r";
-  bool optRerunFailed(false);
+  const char* optString = "rs";
+  bool optRerunFailed(true);
+  bool optRunSerially(false);
 
   int nextOpt = 0;
   do
@@ -20,6 +21,9 @@ int main(int argc, char * const argv[])
       case 'r':
         optRerunFailed = true;
         break;
+      case 's':
+        optRunSerially = true;
+        break;
       case '?':
         TestHarness::Usage(argv[0]);
         exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
@@ -29,7 +33,14 @@ int main(int argc, char * const argv[])
 
   if( optind == argc ) // no testcase name in argument list
   {
-    result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
+    if( optRunSerially )
+    {
+      result = TestHarness::RunAll( argv[0], tc_array );
+    }
+    else
+    {
+      result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+    }
   }
   else
   {
index 2140f2a..f17e30e 100644 (file)
@@ -284,44 +284,6 @@ int UtcDaliBubbleEmitterSetBubbleDensity02(void)
   END_TEST;
 }
 
-int UtcDaliBubbleEmitterSetBlendMode(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " );
-
-  Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
-  BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f ));
-  DALI_TEST_CHECK(emitter);
-  Actor root = emitter.GetRootActor();
-  Stage::GetCurrent().Add( root );
-  root.SetPosition( Vector3::ZERO );
-  root.SetParentOrigin( ParentOrigin::CENTER );
-  root.SetAnchorPoint( AnchorPoint::CENTER );
-
-  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  Wait(application);
-  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
-
-  emitter.SetBlendMode( true );
-  Wait(application);
-  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ZERO, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
-
-  emitter.SetBlendMode( false );
-  Wait(application);
-  DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
-  DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliBubbleEmitterEmitBubble(void)
 {
   ToolkitTestApplication application;
index fbcbcee..da69b02 100644 (file)
@@ -92,11 +92,13 @@ int UtcDaliControlRendererSetGetDepthIndex(void)
   Stage::GetCurrent().Add( actor );
   controlRenderer.SetOnStage( actor );
 
-  DALI_TEST_EQUALS( actor.GetRendererAt(0u).GetDepthIndex(), 1, TEST_LOCATION );
+  int depthIndex = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::DEPTH_INDEX );
+  DALI_TEST_EQUALS( depthIndex, 1, TEST_LOCATION );
   DALI_TEST_EQUALS( controlRenderer.GetDepthIndex(), 1.f, TEST_LOCATION );
 
   controlRenderer.SetDepthIndex( -1.f );
-  DALI_TEST_EQUALS( actor.GetRendererAt(0u).GetDepthIndex(), -1, TEST_LOCATION );
+  depthIndex = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::DEPTH_INDEX );
+  DALI_TEST_EQUALS( depthIndex, -1, TEST_LOCATION );
   DALI_TEST_EQUALS( controlRenderer.GetDepthIndex(), -1.f, TEST_LOCATION );
 
   END_TEST;
index 32d987f..864d7eb 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/scripting/scripting.h>
-#include <dali/devel-api/rendering/material.h>
 #include <dali/devel-api/rendering/renderer.h>
 
 #include <test-native-image.h>
@@ -330,36 +329,36 @@ int UtcDaliImageViewSetGetProperty03(void)
   application.Render();
 
  // conventional alpha blending
-  Material material = imageView.GetRendererAt( 0 ).GetMaterial();
+  Renderer renderer = imageView.GetRendererAt( 0 );
   BlendingFactor::Type srcFactorRgb;
   BlendingFactor::Type destFactorRgb;
   BlendingFactor::Type srcFactorAlpha;
   BlendingFactor::Type destFactorAlpha;
-  material.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
+  renderer.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
   DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
   DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
   DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
   DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-
-  float alphaBlendingUniform;
-  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uAlphaBlending", alphaBlendingUniform ) );
-  DALI_TEST_EQUALS( alphaBlendingUniform, 1.f, TEST_LOCATION );
+  Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+  bool enable;
+  DALI_TEST_CHECK( value.Get( enable ) );
+  DALI_TEST_CHECK( !enable );
 
   // pre-multiplied alpha blending
   imageView.SetProperty( Toolkit::ImageView::Property::PRE_MULTIPLIED_ALPHA, true );
   application.SendNotification();
   application.Render();
 
-  material.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
+  renderer.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
   DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::ONE );
   DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
   DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
   DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
 
-  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uAlphaBlending", alphaBlendingUniform ) );
-  DALI_TEST_EQUALS( alphaBlendingUniform, 0.f, TEST_LOCATION );
+  value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+  DALI_TEST_CHECK( value.Get( enable ) );
+  DALI_TEST_CHECK( enable );
 
   END_TEST;
 }
index 9a66d4b..c9a87e3 100644 (file)
@@ -354,7 +354,8 @@ int UtcDaliRendererFactoryGetBorderRenderer1(void)
   controlRenderer.SetOnStage( actor );
 
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  DALI_TEST_EQUALS( actor.GetRendererAt(0).GetMaterial().GetBlendMode(), BlendingMode::ON, TEST_LOCATION );
+  int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+  DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
 
   TestGlAbstraction& gl = application.GetGlAbstraction();
 
@@ -402,7 +403,8 @@ int UtcDaliRendererFactoryGetBorderRenderer2(void)
   application.SendNotification();
   application.Render(0);
 
-  DALI_TEST_EQUALS( actor.GetRendererAt(0).GetMaterial().GetBlendMode(), BlendingMode::AUTO, TEST_LOCATION );
+  int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+  DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::AUTO, TEST_LOCATION );
 
   Vector4 actualColor(Vector4::ZERO);
   DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "borderColor", actualColor ) );
@@ -420,8 +422,8 @@ int UtcDaliRendererFactoryGetBorderRenderer2(void)
 
   application.SendNotification();
   application.Render(0);
-  DALI_TEST_EQUALS( actor.GetRendererAt(0).GetMaterial().GetBlendMode(), BlendingMode::ON, TEST_LOCATION );
-
+  blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+  DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
 
   END_TEST;
 }
index da3a099..16faba4 100644 (file)
@@ -99,11 +99,6 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density )
   GetImpl(*this).SetBubbleDensity( density );
 }
 
-void BubbleEmitter::SetBlendMode( bool enable )
-{
-  GetImpl(*this).SetBlendMode( enable );
-}
-
 void BubbleEmitter::EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement )
 {
   GetImpl(*this).EmitBubble( animation, emitPosition, direction, displacement );
index 5140144..8408fcc 100644 (file)
@@ -140,13 +140,6 @@ public:
   void SetBubbleDensity( unsigned int density );
 
   /**
-   * @brief Enable different blending mode for rendering.
-   *
-   * @param[in] enable If false, the default blending function if ImageActor is used.
-   */
-  void SetBlendMode( bool enable );
-
-  /**
    * @brief Add a bubble movement to the animation.
    *
    * @param[in] animation The animation reference.
index 8b248ce..26f6798 100644 (file)
@@ -226,22 +226,6 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density )
   }
 }
 
-void BubbleEmitter::SetBlendMode( bool enable )
-{
-  if(enable)
-  {
-    // linear overlay
-    mMaterial.SetBlendFunc(BlendingFactor::SRC_ALPHA, BlendingFactor::ONE,
-                           BlendingFactor::ZERO, BlendingFactor::ONE);
-  }
-  else
-  {
-    // using default blend func
-    mMaterial.SetBlendFunc( BlendingFactor::SRC_ALPHA,   BlendingFactor::ONE_MINUS_SRC_ALPHA,
-                            BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA );
-  }
-}
-
 // clear the resources created for the off screen rendering
 void BubbleEmitter::OnRenderFinished(RenderTask& source)
 {
index 08185a0..37cbbb9 100644 (file)
@@ -92,11 +92,6 @@ public:
   void SetBubbleDensity( unsigned int density );
 
   /**
-   * @copydoc Toolkit::BubbleEmitter::SetBlendMode
-   */
-  void SetBlendMode( bool enable );
-
-  /**
    * @copydoc Toolkit::BubbleEmitter::EmitBubble
    */
   void EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
index 2c27f85..ce4169f 100644 (file)
@@ -606,11 +606,10 @@ void Model3dView::CreateMaterial()
 
   mMaterial = Material::New( mShader );
 
-  mMaterial.SetFaceCullingMode(Material::NONE);
-
   if( mRenderer )
   {
     mRenderer.SetMaterial( mMaterial );
+    mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::NONE);
   }
 
   UpdateShaderUniforms();
index 396d02c..dd02796 100644 (file)
@@ -152,7 +152,7 @@ void BorderRenderer::DoSetOnStage( Actor& actor )
   mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( COLOR_NAME, mBorderColor );
   if( mBorderColor.a < 1.f || mAntiAliasing)
   {
-    (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+    mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
   }
   mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( SIZE_NAME, mBorderSize );
 }
@@ -187,7 +187,7 @@ void BorderRenderer::SetBorderColor(const Vector4& color)
     (mImpl->mRenderer).SetProperty( mBorderColorIndex, color );
     if( color.a < 1.f )
     {
-      (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+      mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
     }
   }
 }
@@ -214,7 +214,7 @@ void BorderRenderer::RequireAntiAliasing( bool antiAliasing )
       material.SetShader( shader );
       if( mAntiAliasing )
       {
-        material.SetBlendMode( BlendingMode::ON );
+        mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
       }
     }
   }
index c7e4ed5..2f6f374 100644 (file)
@@ -137,7 +137,7 @@ void ColorRenderer::InitializeRenderer()
   mBlendColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mBlendColor );
   if( mBlendColor.a < 1.f )
   {
-    mImpl->mRenderer.GetMaterial().SetBlendMode( BlendingMode::ON );
+    mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
   }
 }
 
@@ -148,9 +148,9 @@ void ColorRenderer::SetColor(const Vector4& color)
   if( mImpl->mRenderer )
   {
     (mImpl->mRenderer).SetProperty( mBlendColorIndex, color );
-    if( color.a < 1.f &&  (mImpl->mRenderer).GetMaterial().GetBlendMode() != BlendingMode::ON)
+    if( color.a < 1.f )
     {
-      (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+      mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
     }
   }
 }
index 7ac2490..307818f 100644 (file)
@@ -107,7 +107,7 @@ void ControlRenderer::SetDepthIndex( float index )
   mImpl->mDepthIndex = index;
   if( mImpl->mRenderer )
   {
-    mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
+    mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
   }
 }
 
@@ -120,7 +120,7 @@ void ControlRenderer::SetOnStage( Actor& actor )
 {
   DoSetOnStage( actor );
 
-  mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
+  mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
   actor.AddRenderer( mImpl->mRenderer );
   mImpl->mFlags |= Impl::IS_ON_STAGE;
 }
index b9fcec9..2ab916d 100644 (file)
@@ -75,9 +75,6 @@ const std::string TEXTURE_UNIFORM_NAME = "sTexture";
 const std::string ATLAS_RECT_UNIFORM_NAME = "uAtlasRect";
 const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
 
-// Set this uniform to 1.0 for conventional alpha blending; if pre-multiplied alpha blending, set this uniform to 0.0
-const std::string ALPHA_BLENDING_UNIFORM_NAME = "uAlphaBlending";
-
 const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
 const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
@@ -105,11 +102,10 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   varying mediump vec2 vTexCoord;\n
   uniform sampler2D sTexture;\n
   uniform lowp vec4 uColor;\n
-  uniform lowp float uAlphaBlending; // Set to 1.0 for conventional alpha blending; if pre-multiplied alpha blending, set to 0.0
   \n
   void main()\n
   {\n
-    gl_FragColor = texture2D( sTexture, vTexCoord ) * vec4( uColor.rgb*max( uAlphaBlending, uColor.a ), uColor.a );\n
+    gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
   }\n
 );
 
@@ -429,7 +425,6 @@ Renderer ImageRenderer::CreateRenderer() const
       {
         shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-        shader.RegisterProperty( ALPHA_BLENDING_UNIFORM_NAME, 1.f );
       }
     }
   }
@@ -450,7 +445,6 @@ Renderer ImageRenderer::CreateNativeImageRenderer() const
     shader  = Shader::New( VERTEX_SHADER, mNativeFragmentShaderCode );
     shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
     shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-    shader.RegisterProperty( ALPHA_BLENDING_UNIFORM_NAME, 1.f );
   }
   else
   {
@@ -468,7 +462,6 @@ Renderer ImageRenderer::CreateNativeImageRenderer() const
       {
         shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
         shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-        shader.RegisterProperty( ALPHA_BLENDING_UNIFORM_NAME, 1.f );
       }
     }
   }
@@ -553,7 +546,7 @@ void ImageRenderer::DoSetOnStage( Actor& actor )
     InitializeRenderer( mImage );
   }
 
-  EnablePreMultipliedAlpha( mIsAlphaPreMultiplied );
+  mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, mIsAlphaPreMultiplied);
 }
 
 void ImageRenderer::DoSetOffStage( Actor& actor )
@@ -678,7 +671,6 @@ Shader ImageRenderer::GetImageShader( RendererFactoryCache& factoryCache )
     factoryCache.SaveShader( RendererFactoryCache::IMAGE_SHADER, shader );
     shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
     shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
-    shader.RegisterProperty( ALPHA_BLENDING_UNIFORM_NAME, 1.f );
   }
   return shader;
 }
@@ -809,29 +801,7 @@ void ImageRenderer::EnablePreMultipliedAlpha( bool preMultipled )
   mIsAlphaPreMultiplied = preMultipled;
   if( mImpl->mRenderer )
   {
-    Material material = mImpl->mRenderer.GetMaterial();
-
-    if( preMultipled )
-    {
-      material.SetBlendFunc( BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA,
-                             BlendingFactor::ONE, BlendingFactor::ONE );
-      if( !mImpl->mCustomShader || mImpl->mCustomShader->mVertexShader.empty())
-      {
-        material.RegisterProperty( ALPHA_BLENDING_UNIFORM_NAME, 0.f );
-      }
-    }
-    else
-    {
-      // using default blend func
-      material.SetBlendFunc( BlendingFactor::SRC_ALPHA, BlendingFactor::ONE_MINUS_SRC_ALPHA,
-                              BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA );
-
-      Property::Index index = material.GetPropertyIndex( ALPHA_BLENDING_UNIFORM_NAME );
-      if( index != Property::INVALID_INDEX ) // only set value when the property already exist on the Material
-      {
-        material.SetProperty( index, 1.f );
-      }
-    }
+    mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, mIsAlphaPreMultiplied);
   }
 }
 
index bc27da3..e06ea8b 100644 (file)
@@ -1091,7 +1091,7 @@ struct Decorator::Impl : public ConnectionTracker
 
       if( mHighlightRenderer )
       {
-        mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+        mHighlightRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mTextDepth - 2 ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
       }
     }
   }
index c8ea1e2..49dd310 100644 (file)
@@ -101,7 +101,6 @@ void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
     Pixel::Format pixelFormat = mAtlasManager.GetPixelFormat( slot.mAtlasId );
     Material material = Material::New( pixelFormat == Pixel::L8 ? mShaderL8 : mShaderRgba );
     material.AddTexture( atlas, "sTexture" );
-    material.SetBlendMode( BlendingMode::ON );
     mAtlasManager.SetMaterial( slot.mAtlasId, material );
   }
 
index 35bb46f..7b82d21 100644 (file)
@@ -425,7 +425,8 @@ struct AtlasRenderer::Impl
           if( actor.GetRendererCount() )
           {
             Dali::Renderer renderer( shadowActor.GetRendererAt( 0 ) );
-            renderer.SetDepthIndex( renderer.GetDepthIndex() - 1 );
+            int depthIndex = renderer.GetProperty<int>(Dali::Renderer::Property::DEPTH_INDEX);
+            renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1 );
             shadowActor.SetParentOrigin( ParentOrigin::CENTER );
             shadowActor.SetSize( actorSize );
             containerActor.Add( shadowActor );
@@ -490,7 +491,8 @@ struct AtlasRenderer::Impl
 
     Material material = mGlyphManager.GetMaterial( meshRecord.mAtlasId );
     Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
-    renderer.SetDepthIndex( DepthIndex::CONTENT + mDepth );
+    renderer.SetProperty( Dali::Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+    renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
     Actor actor = Actor::New();
 #if defined(DEBUG_ENABLED)
     actor.SetName( "Text renderable actor" );
index 757858f..bcd4b07 100644 (file)
@@ -281,7 +281,7 @@ void CubeTransitionEffect::OnStageConnection( int depth )
   }
   mCurrentRenderer = Renderer::New( geometry, material );
 
-  mCurrentRenderer.SetDepthIndex( depth );
+  mCurrentRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depth );
   Self().AddRenderer( mCurrentRenderer );
 }
 
@@ -394,7 +394,8 @@ void CubeTransitionEffect::StartTransition( Vector2 panPosition, Vector2 panDisp
   Geometry geometry = mCurrentRenderer.GetGeometry();
   mTargetRenderer = Renderer::New( geometry, material );
 
-  mTargetRenderer.SetDepthIndex( mCurrentRenderer.GetDepthIndex() );
+  int depthIndex = mCurrentRenderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX);
+  mTargetRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex );
 
   for( size_t i = 0; i < mBoxes.size(); ++i )
   {
index 4c4bb99..62db485 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 20;
+const unsigned int TOOLKIT_MICRO_VERSION = 21;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 770367d..08efc1f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.1.20
+Version:    1.1.21
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT
index a3a3dd7..1311506 100644 (file)
@@ -33,7 +33,7 @@
 #include <dali/public-api/actors/sampling.h>
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/common/loading-state.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/renderer.h>
 #include <dali/devel-api/rendering/geometry.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
@@ -217,10 +217,10 @@ const IntegerPair EnumTable[] =
     { "WRAP_MODE_REPEAT",                     WrapMode::REPEAT           },
     { "WRAP_MODE_MIRRORED_REPEAT",            WrapMode::MIRRORED_REPEAT  },
 
-    { "MATERIAL_NONE",                        Material::NONE                      },
-    { "MATERIAL_CULL_BACK",                   Material::CULL_BACK                 },
-    { "MATERIAL_CULL_FRONT",                  Material::CULL_FRONT                },
-    { "MATERIAL_CULL_BACK_AND_FRONT",         Material::CULL_BACK_AND_FRONT       },
+    { "MATERIAL_NONE",                        Renderer::NONE                      },
+    { "MATERIAL_CULL_BACK",                   Renderer::CULL_BACK                 },
+    { "MATERIAL_CULL_FRONT",                  Renderer::CULL_FRONT                },
+    { "MATERIAL_CULL_BACK_AND_FRONT",         Renderer::CULL_BACK_AND_FRONT       },
 
     { "GEOMETRY_POINTS",                      Geometry::POINTS          },
     { "GEOMETRY_LINES",                       Geometry::LINES           },
index cb173fa..b21c376 100644 (file)
@@ -368,253 +368,6 @@ void MaterialApi::GetNumberOfTextures( const v8::FunctionCallbackInfo< v8::Value
   args.GetReturnValue().Set( v8::Integer::New( isolate, material.GetNumberOfTextures() ) );
 }
 
-/**
- * Set the culling mode for this material
- *
- * @method setFaceCullingMode
- * @for Material
- * @param {integer} cullingMode The culling mode for this material
- * @example
- *      // face culling mode is one of the following
- *      dali.MATERIAL_NONE                           // None of the faces should be culled
- *      dali.MATERIAL_CULL_BACK                      // Cull back face, back face should never be shown
- *      dali.MATERIAL_CULL_FRONT                     // Cull front face, back face should never be shown
- *      dali.MATERIAL_CULL_BACK_AND_FRONT            // Cull back and front faces, if the geometry is composed of triangles none of the faces will be shown
- *
- *      material.setFaceCullingMode( dali.MATERIAL_NONE );
- */
-void MaterialApi::SetFaceCullingMode( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid cullingMode parameter" );
-  }
-  else
-  {
-    material.SetFaceCullingMode( static_cast<Material::FaceCullingMode>(mode) );
-  }
-}
-
-/**
- * Set the blending mode.
- *
- * If blending is disabled (BLENDING_OFF) fade in and fade out animations do not work.
- *
- * @for Material
- * @method setBlendMode
- * @param { integer } mode The blending mode.
- * @example
- *      // blend mode is one of the following
- *      dali.BLENDING_OFF       // Blending is disabled.
- *      dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *      dali.BLENDING_ON        // Blending is enabled.
- *
- *      material.setBlendMode( dali.BLENDING_AUTO );
- */
-void MaterialApi::SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  bool found( false );
-  int mode = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid blendMode parameter" );
-  }
-  else
-  {
-    material.SetBlendMode( static_cast<Dali::BlendingMode::Type>( mode ) );
-  }
-}
-
-/**
- * Retrieves the blending mode.
- *
- * @for Material
- * @method getBlendMode
- * @return { integer } blendMode
- * @example returns one of the following:
- *
- *        dali.BLENDING_OFF       // Blending is disabled.
- *        dali.BLENDING_AUTO      // Blending is enabled if there is alpha channel.
- *        dali.BLENDING_ON        // Blending is enabled.
- */
-void MaterialApi::GetBlendMode( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  args.GetReturnValue().Set( v8::Integer::New( isolate, material.GetBlendMode() ) );
-}
-
-/**
- * Specify the pixel arithmetic used when the actor is blended.
- *
- * @for Material
- * @method setBlendFunc
- * @param {integer} srcFactorRgb Source Blending RGB
- * @param {integer} destFactorRgb Destination Blending RGB
- * @param {integer} srcFactorAlpha Source Blending Alpha
- * @param {integer} destFactorAlpha Destinatino Blending Alpha
- * @example
- *    //blending constants
- *    dali.BLEND_FACTOR_ZERO
- *    dali.BLEND_FACTOR_ONE
- *    dali.BLEND_FACTOR_SRC_COLOR
- *    dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
- *    dali.BLEND_FACTOR_SRC_ALPHA
- *    dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
- *    dali.BLEND_FACTOR_DST_ALPHA
- *    dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
- *    dali.BLEND_FACTOR_DST_COLOR
- *    dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
- *    dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
- *    dali.BLEND_FACTOR_CONSTANT_COLOR
- *    dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
- *    dali.BLEND_FACTOR_CONSTANT_ALPHA
- *    dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
- *
- *    material.setBlendFunc( dali.BLEND_FACTOR_CONSTANT_COLOR, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
- *                           dali.BLEND_FACTOR_CONSTANT_ALPHA, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA );
- */
-void MaterialApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  int params[4];
-  bool foundAllParams(false);
-  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args, 0 );
-  if( foundAllParams )
-  {
-    material.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]),
-                           static_cast< Dali::BlendingFactor::Type>(params[1]),
-                           static_cast< Dali::BlendingFactor::Type>(params[2]),
-                           static_cast< Dali::BlendingFactor::Type>(params[3]) );
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid blendFunc parameter");
-  }
-}
-
-/**
- * Query the pixel arithmetic used when the actor is blended.
- *
- * @for Material
- * @method getBlendFunc
- * @return {Object} Blend properties
- * @example Blend properties object has 4 fields
- *
- *      blendProperties.sourceRgb // source rgb enum
- *      blendProperties.destinationRgb // destination rgb enum
- *      blendProperties.sourceAlpha source // alpha enum
- *      blendProperties.destinationAlpha // destination alpha enum
- */
-void MaterialApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  // Pass by reference doesn't work in Javascript
-  // For now just return a vector 4...
-
-  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
-  v8::Local<v8::Object> blendProperties = v8::Object::New( isolate );
-
-  blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
-  blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
-  blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
-  blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
-
-  args.GetReturnValue().Set( blendProperties );
-}
-
-/**
- * Specify the equation used when the actor is blended.
- *
- * @for Material
- * @method setBlendEquation
- * @param { integer } equationRgb The equation used for combining red, green, and blue components.
- * @param { integer } equationAlpha The equation used for combining the alpha component.
- * @example
- *      // blend equation is one of the following
- *      dali.BLEND_EQUATION_ADD
- *      dali.BLEND_EQUATION_SUBTRACT
- *      dali.BLEND_EQUATION_REVERSE_SUBTRACT
- *
- *      material.setBlendEquation( dali.BLEND_EQUATION_ADD, dali.BLEND_EQUATION_REVERSE_SUBTRACT );
- */
-void MaterialApi::SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  int params[2];
-  bool foundAllParams(false);
-  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 2, args, 0 );
-  if( foundAllParams )
-  {
-    material.SetBlendEquation( static_cast< BlendingEquation::Type>(params[0]), static_cast< BlendingEquation::Type>(params[1]) );
-  }
-  else
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendEquation parameter");
-  }
-}
-
-/**
- * Query the equation used when the actor is blended.
- *
- * @for Material
- * @method getBlendEquation
- * @return {Object} Blend equations
- * @example Blend equations object has 2 fields
- *
- *      blendEquations.equationRgb // equation used for combining rgb components
- *      blendEquations.equationAlpha // equation used for combining alpha components
- */
-void MaterialApi::GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
-  // Pass by reference doesn't work in Javascript
-  // For now just return a vector 2...
-
-  BlendingEquation::Type equationRgb, equationAlpha;
-  v8::Isolate* isolate = args.GetIsolate();
-  v8::HandleScope handleScope( isolate );
-
-  Material material = GetMaterial( isolate, args );
-
-  material.GetBlendEquation( equationRgb, equationAlpha );
-
-  v8::Local<v8::Object> blendEquations = v8::Object::New( isolate );
-
-  blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationRgb" ),   v8::Integer::New( isolate, equationRgb) );
-  blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationAlpha" ), v8::Integer::New( isolate, equationAlpha ) );
-
-  args.GetReturnValue().Set( blendEquations );
-}
-
 } // namespace V8Plugin
 
 } // namespace Dali
index 314ba2a..6cf64a0 100644 (file)
@@ -66,13 +66,6 @@ namespace MaterialApi
    void SetTextureUniformName( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetTextureIndex( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetNumberOfTextures( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetFaceCullingMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
-   void GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
 
 }; // namespace MaterialApi
 
index 2ebdb81..fb69a7e 100644 (file)
@@ -54,13 +54,6 @@ const ApiFunction MaterialFunctionTable[]=
    { "SetTextureUniformName"           , MaterialApi::SetTextureUniformName },
    { "GetTextureIndex"                 , MaterialApi::GetTextureIndex },
    { "GetNumberOfTextures"             , MaterialApi::GetNumberOfTextures },
-   { "SetFaceCullingMode"              , MaterialApi::SetFaceCullingMode },
-   { "SetBlendMode"                    , MaterialApi::SetBlendMode },
-   { "GetBlendMode"                    , MaterialApi::GetBlendMode },
-   { "SetBlendFunc"                    , MaterialApi::SetBlendFunc },
-   { "GetBlendFunc"                    , MaterialApi::GetBlendFunc },
-   { "SetBlendEquation"                , MaterialApi::SetBlendEquation },
-   { "GetBlendEquation"                , MaterialApi::GetBlendEquation },
 };
 
 const unsigned int MaterialFunctionTableCount = sizeof(MaterialFunctionTable)/sizeof(MaterialFunctionTable[0]);
index fb2c0a8..2ec736d 100644 (file)
@@ -204,6 +204,162 @@ void RendererApi::GetMaterial( const v8::FunctionCallbackInfo<v8::Value>& args )
   args.GetReturnValue().Set( localObject );
 }
 
+/**
+ * Specify the pixel arithmetic used when the actor is blended.
+ *
+ * @for Renderer
+ * @method setBlendFunc
+ * @param {integer} srcFactorRgb Source Blending RGB
+ * @param {integer} destFactorRgb Destination Blending RGB
+ * @param {integer} srcFactorAlpha Source Blending Alpha
+ * @param {integer} destFactorAlpha Destination Blending Alpha
+ * @example
+ *    //blending constants
+ *    dali.BLEND_FACTOR_ZERO
+ *    dali.BLEND_FACTOR_ONE
+ *    dali.BLEND_FACTOR_SRC_COLOR
+ *    dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
+ *    dali.BLEND_FACTOR_SRC_ALPHA
+ *    dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
+ *    dali.BLEND_FACTOR_DST_ALPHA
+ *    dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
+ *    dali.BLEND_FACTOR_DST_COLOR
+ *    dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
+ *    dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
+ *    dali.BLEND_FACTOR_CONSTANT_COLOR
+ *    dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
+ *    dali.BLEND_FACTOR_CONSTANT_ALPHA
+ *    dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
+ *
+ *    renderer.setBlendFunc( dali.BLEND_FACTOR_CONSTANT_COLOR, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
+ *                           dali.BLEND_FACTOR_CONSTANT_ALPHA, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA );
+ */
+void RendererApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  Renderer renderer = GetRenderer( isolate, args );
+
+  int params[4];
+  bool foundAllParams(false);
+  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 4, args, 0 );
+  if( foundAllParams )
+  {
+    renderer.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]),
+                           static_cast< Dali::BlendingFactor::Type>(params[1]),
+                           static_cast< Dali::BlendingFactor::Type>(params[2]),
+                           static_cast< Dali::BlendingFactor::Type>(params[3]) );
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid blendFunc parameter");
+  }
+}
+
+/**
+ * Query the pixel arithmetic used when the actor is blended.
+ *
+ * @for Renderer
+ * @method getBlendFunc
+ * @return {Object} Blend properties
+ * @example Blend properties object has 4 fields
+ *
+ *      blendProperties.sourceRgb // source rgb enum
+ *      blendProperties.destinationRgb // destination rgb enum
+ *      blendProperties.sourceAlpha source // alpha enum
+ *      blendProperties.destinationAlpha // destination alpha enum
+ */
+void RendererApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  // Pass by reference doesn't work in Javascript
+  // For now just return a vector 4...
+
+  BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  Renderer renderer = GetRenderer( isolate, args );
+
+  renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+
+  v8::Local<v8::Object> blendProperties = v8::Object::New( isolate );
+
+  blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ),        v8::Integer::New( isolate, srcFactorRgb) );
+  blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ),   v8::Integer::New( isolate, destFactorRgb ) );
+  blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ),      v8::Integer::New( isolate, srcFactorAlpha  ) );
+  blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
+
+  args.GetReturnValue().Set( blendProperties );
+}
+
+/**
+ * Specify the equation used when the actor is blended.
+ *
+ * @for Renderer
+ * @method setBlendEquation
+ * @param { integer } equationRgb The equation used for combining red, green, and blue components.
+ * @param { integer } equationAlpha The equation used for combining the alpha component.
+ * @example
+ *      // blend equation is one of the following
+ *      dali.BLEND_EQUATION_ADD
+ *      dali.BLEND_EQUATION_SUBTRACT
+ *      dali.BLEND_EQUATION_REVERSE_SUBTRACT
+ *
+ *      renderer.setBlendEquation( dali.BLEND_EQUATION_ADD, dali.BLEND_EQUATION_REVERSE_SUBTRACT );
+ */
+void RendererApi::SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  Renderer renderer = GetRenderer( isolate, args );
+
+  int params[2];
+  bool foundAllParams(false);
+  V8Utils::ReadIntegerArguments( foundAllParams, &params[0], 2, args, 0 );
+  if( foundAllParams )
+  {
+    renderer.SetBlendEquation( static_cast< BlendingEquation::Type>(params[0]), static_cast< BlendingEquation::Type>(params[1]) );
+  }
+  else
+  {
+    DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendEquation parameter");
+  }
+}
+
+/**
+ * Query the equation used when the actor is blended.
+ *
+ * @for Renderer
+ * @method getBlendEquation
+ * @return {Object} Blend equations
+ * @example Blend equations object has 2 fields
+ *
+ *      blendEquations.equationRgb // equation used for combining rgb components
+ *      blendEquations.equationAlpha // equation used for combining alpha components
+ */
+void RendererApi::GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+  // Pass by reference doesn't work in Javascript
+  // For now just return a vector 2...
+
+  BlendingEquation::Type equationRgb, equationAlpha;
+  v8::Isolate* isolate = args.GetIsolate();
+  v8::HandleScope handleScope( isolate );
+
+  Renderer renderer = GetRenderer( isolate, args );
+
+  renderer.GetBlendEquation( equationRgb, equationAlpha );
+
+  v8::Local<v8::Object> blendEquations = v8::Object::New( isolate );
+
+  blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationRgb" ),   v8::Integer::New( isolate, equationRgb) );
+  blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationAlpha" ), v8::Integer::New( isolate, equationAlpha ) );
+
+  args.GetReturnValue().Set( blendEquations );
+}
+
 } // namespace V8Plugin
 
 } // namespace Dali
index e415e74..50e1874 100644 (file)
@@ -61,6 +61,10 @@ namespace RendererApi
    void GetGeometry( const v8::FunctionCallbackInfo< v8::Value >& args );
    void SetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args );
    void GetMaterial( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
+   void GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args );
 
 }; // namespace RendererApi
 
index ecd6649..3286b10 100644 (file)
@@ -49,6 +49,10 @@ const ApiFunction RendererFunctionTable[]=
    { "GetGeometry"             , RendererApi::GetGeometry },
    { "SetMaterial"             , RendererApi::SetMaterial },
    { "GetMaterial"             , RendererApi::GetMaterial },
+   { "SetBlendFunc"            , RendererApi::SetBlendFunc },
+   { "GetBlendFunc"            , RendererApi::GetBlendFunc },
+   { "SetBlendEquation"        , RendererApi::SetBlendEquation },
+   { "GetBlendEquation"        , RendererApi::GetBlendEquation },
 };
 
 const unsigned int RendererFunctionTableCount = sizeof(RendererFunctionTable)/sizeof(RendererFunctionTable[0]);