./execute.sh dali
-To get coverage output (you need to first build dali libraries with
+To get full coverage output (you need to first build dali libraries with
--coverage), run
./coverage.sh
+To check the coverage of your patch, (the build server uses its own copy
+of these scripts), you can use
+
+ ./patch-coverage.pl -q [diff-spec]
+
+to get a summary, or
+
+ ./patch-coverage.pl [diff-spec]
+
+to get textual output, or
+
+ ./patch-coverage.pl -o out.html [diff-spec]
+
+to get HTML output (used by build server).
+
+diff-spec is any refspec accepted by git-diff. If it's left out, it creates
+a refspec to the latest commit, or uses the index/working tree.
+
+
Testing on target
=================
-To build for target, first build and install dali-core, dali-adaptor and dali-toolkit, then build dali-capi without --keep-packs option.
+To build for target, first build and install dali-core, dali-adaptor and dali-toolkit.
You will need to install libconfig-tiny-perl:
On desktop, you can debug the tests by running gdb on the test program:
$ cd automated-tests
- $ gdb build/src/dali/tct-dali-core
+ $ ./execute.sh -d <TestCase>
gdb> r <TestCase>
replace `<TestCase>` with the name of the failing testcase.
For example, using testcase UtcDaliActorAddP from the dali-core test suite:
- $ gdb build/src/dali/tct-dali-core
+ $ ./execute.sh -d UtcDaliActorAddP
gdb> r UtcDaliActorAddP
use Git;
use Getopt::Long;
use Error qw(:try);
-use HTML::Element;
use Pod::Usage;
use File::Basename;
-#use Data::Dumper;
use File::stat;
use Scalar::Util qw /looks_like_number/;
use Cwd qw /getcwd/;
use Term::ANSIColor qw(:constants);
+use Data::Dumper;
-# Program to run gcov on files in patch (that are in source dirs - needs to be dali-aware).
+# Dali specific program to run lcov and parse output for files in patch
-# A) Get patch
-# B) Remove uninteresting files
-# C) Find matching gcno/gcda files
-# D) Copy and rename them to match source prefix (i.e. strip library name off front)
-# E) Generate patch output with covered/uncovered lines marked in green/red
-# F) Generate coverage data for changed lines
-# G) Exit status should be 0 for high coverage (90% line coverage for all new/changed lines)
+# A) Generate lcov output from lib & test cases
+# B) Get patch using git diff
+# C) Generate patch output with covered/uncovered lines marked in green/red
+# D) Generate coverage data for changed lines
+# E) Exit status should be 0 for high coverage (90% line coverage for all new/changed lines)
# or 1 for low coverage
# Sources for conversion of gcno/gcda files:
-# ~/bin/lcov
+# /usr/bin/lcov & genhtml
# Python git-coverage (From http://stef.thewalter.net/git-coverage-useful-code-coverage.html)
+# From genhtml:
+sub read_info_file($);
+sub get_info_entry($);
+sub set_info_entry($$$$$$$$$;$$$$$$);
+sub combine_info_entries($$$);
+sub combine_info_files($$);
+sub compress_brcount($);
+sub brcount_to_db($);
+sub db_to_brcount($;$);
+sub brcount_db_combine($$$);
+sub add_counts($$);
+sub info(@);
+
our $repo = Git->repository();
our $debug=0;
our $pd_debug=0;
+our $root;
+our %info_data; # Hash containing all data from .info files
+
+# Settings from genhtml:
+our $func_coverage; # If set, generate function coverage statistics
+our $no_func_coverage; # Disable func_coverage
+our $br_coverage; # If set, generate branch coverage statistics
+our $no_br_coverage; # Disable br_coverage
+our $sort = 1; # If set, provide directory listings with sorted entries
+our $no_sort; # Disable sort
+
+# Branch data combination types
+our $BR_SUB = 0;
+our $BR_ADD = 1;
+
+# Command line options
our $opt_cached;
our $opt_help;
our $opt_output;
pod2usage(1) if $opt_help;
+# From genhtml:
+#
+# read_info_file(info_filename)
+#
+# Read in the contents of the .info file specified by INFO_FILENAME. Data will
+# be returned as a reference to a hash containing the following mappings:
+#
+# %result: for each filename found in file -> \%data
+#
+# %data: "test" -> \%testdata
+# "sum" -> \%sumcount
+# "func" -> \%funcdata
+# "found" -> $lines_found (number of instrumented lines found in file)
+# "hit" -> $lines_hit (number of executed lines in file)
+# "f_found" -> $fn_found (number of instrumented functions found in file)
+# "f_hit" -> $fn_hit (number of executed functions in file)
+# "b_found" -> $br_found (number of instrumented branches found in file)
+# "b_hit" -> $br_hit (number of executed branches in file)
+# "check" -> \%checkdata
+# "testfnc" -> \%testfncdata
+# "sumfnc" -> \%sumfnccount
+# "testbr" -> \%testbrdata
+# "sumbr" -> \%sumbrcount
+#
+# %testdata : name of test affecting this file -> \%testcount
+# %testfncdata: name of test affecting this file -> \%testfnccount
+# %testbrdata: name of test affecting this file -> \%testbrcount
+#
+# %testcount : line number -> execution count for a single test
+# %testfnccount: function name -> execution count for a single test
+# %testbrcount : line number -> branch coverage data for a single test
+# %sumcount : line number -> execution count for all tests
+# %sumfnccount : function name -> execution count for all tests
+# %sumbrcount : line number -> branch coverage data for all tests
+# %funcdata : function name -> line number
+# %checkdata : line number -> checksum of source code line
+# $brdata : vector of items: block, branch, taken
+#
+# Note that .info file sections referring to the same file and test name
+# will automatically be combined by adding all execution counts.
+#
+# Note that if INFO_FILENAME ends with ".gz", it is assumed that the file
+# is compressed using GZIP. If available, GUNZIP will be used to decompress
+# this file.
+#
+# Die on error.
+#
+sub read_info_file($)
+{
+ my $tracefile = $_[0]; # Name of tracefile
+ my %result; # Resulting hash: file -> data
+ my $data; # Data handle for current entry
+ my $testdata; # " "
+ my $testcount; # " "
+ my $sumcount; # " "
+ my $funcdata; # " "
+ my $checkdata; # " "
+ my $testfncdata;
+ my $testfnccount;
+ my $sumfnccount;
+ my $testbrdata;
+ my $testbrcount;
+ my $sumbrcount;
+ my $line; # Current line read from .info file
+ my $testname; # Current test name
+ my $filename; # Current filename
+ my $hitcount; # Count for lines hit
+ my $count; # Execution count of current line
+ my $negative; # If set, warn about negative counts
+ my $changed_testname; # If set, warn about changed testname
+ my $line_checksum; # Checksum of current line
+ my $notified_about_relative_paths;
+ local *INFO_HANDLE; # Filehandle for .info file
+
+ info("Reading data file $tracefile\n");
+
+ # Check if file exists and is readable
+ stat($tracefile);
+ if (!(-r _))
+ {
+ die("ERROR: cannot read file $tracefile!\n");
+ }
+
+ # Check if this is really a plain file
+ if (!(-f _))
+ {
+ die("ERROR: not a plain file: $tracefile!\n");
+ }
+
+ # Check for .gz extension
+ if ($tracefile =~ /\.gz$/)
+ {
+ # Check for availability of GZIP tool
+ system_no_output(1, "gunzip" ,"-h")
+ and die("ERROR: gunzip command not available!\n");
+
+ # Check integrity of compressed file
+ system_no_output(1, "gunzip", "-t", $tracefile)
+ and die("ERROR: integrity check failed for ".
+ "compressed file $tracefile!\n");
+
+ # Open compressed file
+ open(INFO_HANDLE, "-|", "gunzip -c '$tracefile'")
+ or die("ERROR: cannot start gunzip to decompress ".
+ "file $tracefile!\n");
+ }
+ else
+ {
+ # Open decompressed file
+ open(INFO_HANDLE, "<", $tracefile)
+ or die("ERROR: cannot read file $tracefile!\n");
+ }
+
+ $testname = "";
+ while (<INFO_HANDLE>)
+ {
+ chomp($_);
+ $line = $_;
+
+ # Switch statement
+ foreach ($line)
+ {
+ /^TN:([^,]*)(,diff)?/ && do
+ {
+ # Test name information found
+ $testname = defined($1) ? $1 : "";
+ if ($testname =~ s/\W/_/g)
+ {
+ $changed_testname = 1;
+ }
+ $testname .= $2 if (defined($2));
+ last;
+ };
+
+ /^[SK]F:(.*)/ && do
+ {
+ # Filename information found
+ # Retrieve data for new entry
+ $filename = File::Spec->rel2abs($1, $root);
+
+ if (!File::Spec->file_name_is_absolute($1) &&
+ !$notified_about_relative_paths)
+ {
+ info("Resolved relative source file ".
+ "path \"$1\" with CWD to ".
+ "\"$filename\".\n");
+ $notified_about_relative_paths = 1;
+ }
+
+ $data = $result{$filename};
+ ($testdata, $sumcount, $funcdata, $checkdata,
+ $testfncdata, $sumfnccount, $testbrdata,
+ $sumbrcount) =
+ get_info_entry($data);
+
+ if (defined($testname))
+ {
+ $testcount = $testdata->{$testname};
+ $testfnccount = $testfncdata->{$testname};
+ $testbrcount = $testbrdata->{$testname};
+ }
+ else
+ {
+ $testcount = {};
+ $testfnccount = {};
+ $testbrcount = {};
+ }
+ last;
+ };
+
+ /^DA:(\d+),(-?\d+)(,[^,\s]+)?/ && do
+ {
+ # Fix negative counts
+ $count = $2 < 0 ? 0 : $2;
+ if ($2 < 0)
+ {
+ $negative = 1;
+ }
+ # Execution count found, add to structure
+ # Add summary counts
+ $sumcount->{$1} += $count;
+
+ # Add test-specific counts
+ if (defined($testname))
+ {
+ $testcount->{$1} += $count;
+ }
+
+ # Store line checksum if available
+ if (defined($3))
+ {
+ $line_checksum = substr($3, 1);
+
+ # Does it match a previous definition
+ if (defined($checkdata->{$1}) &&
+ ($checkdata->{$1} ne
+ $line_checksum))
+ {
+ die("ERROR: checksum mismatch ".
+ "at $filename:$1\n");
+ }
+
+ $checkdata->{$1} = $line_checksum;
+ }
+ last;
+ };
+
+ /^FN:(\d+),([^,]+)/ && do
+ {
+ last if (!$func_coverage);
+
+ # Function data found, add to structure
+ $funcdata->{$2} = $1;
+
+ # Also initialize function call data
+ if (!defined($sumfnccount->{$2})) {
+ $sumfnccount->{$2} = 0;
+ }
+ if (defined($testname))
+ {
+ if (!defined($testfnccount->{$2})) {
+ $testfnccount->{$2} = 0;
+ }
+ }
+ last;
+ };
+
+ /^FNDA:(\d+),([^,]+)/ && do
+ {
+ last if (!$func_coverage);
+ # Function call count found, add to structure
+ # Add summary counts
+ $sumfnccount->{$2} += $1;
+
+ # Add test-specific counts
+ if (defined($testname))
+ {
+ $testfnccount->{$2} += $1;
+ }
+ last;
+ };
+
+ /^BRDA:(\d+),(\d+),(\d+),(\d+|-)/ && do {
+ # Branch coverage data found
+ my ($line, $block, $branch, $taken) =
+ ($1, $2, $3, $4);
+
+ last if (!$br_coverage);
+ $sumbrcount->{$line} .=
+ "$block,$branch,$taken:";
+
+ # Add test-specific counts
+ if (defined($testname)) {
+ $testbrcount->{$line} .=
+ "$block,$branch,$taken:";
+ }
+ last;
+ };
+
+ /^end_of_record/ && do
+ {
+ # Found end of section marker
+ if ($filename)
+ {
+ # Store current section data
+ if (defined($testname))
+ {
+ $testdata->{$testname} =
+ $testcount;
+ $testfncdata->{$testname} =
+ $testfnccount;
+ $testbrdata->{$testname} =
+ $testbrcount;
+ }
+
+ set_info_entry($data, $testdata,
+ $sumcount, $funcdata,
+ $checkdata, $testfncdata,
+ $sumfnccount,
+ $testbrdata,
+ $sumbrcount);
+ $result{$filename} = $data;
+ last;
+ }
+ };
+
+ # default
+ last;
+ }
+ }
+ close(INFO_HANDLE);
+
+ # Calculate lines_found and lines_hit for each file
+ foreach $filename (keys(%result))
+ {
+ $data = $result{$filename};
+
+ ($testdata, $sumcount, undef, undef, $testfncdata,
+ $sumfnccount, $testbrdata, $sumbrcount) =
+ get_info_entry($data);
+
+ # Filter out empty files
+ if (scalar(keys(%{$sumcount})) == 0)
+ {
+ delete($result{$filename});
+ next;
+ }
+ # Filter out empty test cases
+ foreach $testname (keys(%{$testdata}))
+ {
+ if (!defined($testdata->{$testname}) ||
+ scalar(keys(%{$testdata->{$testname}})) == 0)
+ {
+ delete($testdata->{$testname});
+ delete($testfncdata->{$testname});
+ }
+ }
+
+ $data->{"found"} = scalar(keys(%{$sumcount}));
+ $hitcount = 0;
+
+ foreach (keys(%{$sumcount}))
+ {
+ if ($sumcount->{$_} > 0) { $hitcount++; }
+ }
+
+ $data->{"hit"} = $hitcount;
+
+ # Get found/hit values for function call data
+ $data->{"f_found"} = scalar(keys(%{$sumfnccount}));
+ $hitcount = 0;
+
+ foreach (keys(%{$sumfnccount})) {
+ if ($sumfnccount->{$_} > 0) {
+ $hitcount++;
+ }
+ }
+ $data->{"f_hit"} = $hitcount;
+
+ # Combine branch data for the same branches
+ (undef, $data->{"b_found"}, $data->{"b_hit"}) = compress_brcount($sumbrcount);
+ foreach $testname (keys(%{$testbrdata})) {
+ compress_brcount($testbrdata->{$testname});
+ }
+ }
+
+ if (scalar(keys(%result)) == 0)
+ {
+ die("ERROR: no valid records found in tracefile $tracefile\n");
+ }
+ if ($negative)
+ {
+ warn("WARNING: negative counts found in tracefile ".
+ "$tracefile\n");
+ }
+ if ($changed_testname)
+ {
+ warn("WARNING: invalid characters removed from testname in ".
+ "tracefile $tracefile\n");
+ }
+
+ return(\%result);
+}
+
+sub print_simplified_info
+{
+ for my $key (keys(%info_data))
+ {
+ print "K $key: \n";
+ my $sumcountref = $info_data{$key}->{"sum"};
+ for my $line (sort{$a<=>$b}(keys(%$sumcountref)))
+ {
+ print "L $line: $sumcountref->{$line}\n";
+ }
+ }
+}
+
+# From genhtml:
+#
+# get_info_entry(hash_ref)
+#
+# Retrieve data from an entry of the structure generated by read_info_file().
+# Return a list of references to hashes:
+# (test data hash ref, sum count hash ref, funcdata hash ref, checkdata hash
+# ref, testfncdata hash ref, sumfnccount hash ref, lines found, lines hit,
+# functions found, functions hit)
+#
+
+sub get_info_entry($)
+{
+ my $testdata_ref = $_[0]->{"test"};
+ my $sumcount_ref = $_[0]->{"sum"};
+ my $funcdata_ref = $_[0]->{"func"};
+ my $checkdata_ref = $_[0]->{"check"};
+ my $testfncdata = $_[0]->{"testfnc"};
+ my $sumfnccount = $_[0]->{"sumfnc"};
+ my $testbrdata = $_[0]->{"testbr"};
+ my $sumbrcount = $_[0]->{"sumbr"};
+ my $lines_found = $_[0]->{"found"};
+ my $lines_hit = $_[0]->{"hit"};
+ my $fn_found = $_[0]->{"f_found"};
+ my $fn_hit = $_[0]->{"f_hit"};
+ my $br_found = $_[0]->{"b_found"};
+ my $br_hit = $_[0]->{"b_hit"};
+
+ return ($testdata_ref, $sumcount_ref, $funcdata_ref, $checkdata_ref,
+ $testfncdata, $sumfnccount, $testbrdata, $sumbrcount,
+ $lines_found, $lines_hit, $fn_found, $fn_hit,
+ $br_found, $br_hit);
+}
+
+
+# From genhtml:
+#
+# set_info_entry(hash_ref, testdata_ref, sumcount_ref, funcdata_ref,
+# checkdata_ref, testfncdata_ref, sumfcncount_ref,
+# testbrdata_ref, sumbrcount_ref[,lines_found,
+# lines_hit, f_found, f_hit, $b_found, $b_hit])
+#
+# Update the hash referenced by HASH_REF with the provided data references.
+#
+
+sub set_info_entry($$$$$$$$$;$$$$$$)
+{
+ my $data_ref = $_[0];
+
+ $data_ref->{"test"} = $_[1];
+ $data_ref->{"sum"} = $_[2];
+ $data_ref->{"func"} = $_[3];
+ $data_ref->{"check"} = $_[4];
+ $data_ref->{"testfnc"} = $_[5];
+ $data_ref->{"sumfnc"} = $_[6];
+ $data_ref->{"testbr"} = $_[7];
+ $data_ref->{"sumbr"} = $_[8];
+
+ if (defined($_[9])) { $data_ref->{"found"} = $_[9]; }
+ if (defined($_[10])) { $data_ref->{"hit"} = $_[10]; }
+ if (defined($_[11])) { $data_ref->{"f_found"} = $_[11]; }
+ if (defined($_[12])) { $data_ref->{"f_hit"} = $_[12]; }
+ if (defined($_[13])) { $data_ref->{"b_found"} = $_[13]; }
+ if (defined($_[14])) { $data_ref->{"b_hit"} = $_[14]; }
+}
+
+# From genhtml:
+#
+# combine_info_entries(entry_ref1, entry_ref2, filename)
+#
+# Combine .info data entry hashes referenced by ENTRY_REF1 and ENTRY_REF2.
+# Return reference to resulting hash.
+#
+sub combine_info_entries($$$)
+{
+ my $entry1 = $_[0]; # Reference to hash containing first entry
+ my $testdata1;
+ my $sumcount1;
+ my $funcdata1;
+ my $checkdata1;
+ my $testfncdata1;
+ my $sumfnccount1;
+ my $testbrdata1;
+ my $sumbrcount1;
+
+ my $entry2 = $_[1]; # Reference to hash containing second entry
+ my $testdata2;
+ my $sumcount2;
+ my $funcdata2;
+ my $checkdata2;
+ my $testfncdata2;
+ my $sumfnccount2;
+ my $testbrdata2;
+ my $sumbrcount2;
+
+ my %result; # Hash containing combined entry
+ my %result_testdata;
+ my $result_sumcount = {};
+ my $result_funcdata;
+ my $result_testfncdata;
+ my $result_sumfnccount;
+ my $result_testbrdata;
+ my $result_sumbrcount;
+ my $lines_found;
+ my $lines_hit;
+ my $fn_found;
+ my $fn_hit;
+ my $br_found;
+ my $br_hit;
+
+ my $testname;
+ my $filename = $_[2];
+
+ # Retrieve data
+ ($testdata1, $sumcount1, $funcdata1, $checkdata1, $testfncdata1,
+ $sumfnccount1, $testbrdata1, $sumbrcount1) = get_info_entry($entry1);
+ ($testdata2, $sumcount2, $funcdata2, $checkdata2, $testfncdata2,
+ $sumfnccount2, $testbrdata2, $sumbrcount2) = get_info_entry($entry2);
+
+# # Merge checksums
+# $checkdata1 = merge_checksums($checkdata1, $checkdata2, $filename);
+#
+# # Combine funcdata
+# $result_funcdata = merge_func_data($funcdata1, $funcdata2, $filename);
+#
+# # Combine function call count data
+# $result_testfncdata = add_testfncdata($testfncdata1, $testfncdata2);
+# ($result_sumfnccount, $fn_found, $fn_hit) =
+# add_fnccount($sumfnccount1, $sumfnccount2);
+#
+# # Combine branch coverage data
+# $result_testbrdata = add_testbrdata($testbrdata1, $testbrdata2);
+# ($result_sumbrcount, $br_found, $br_hit) =
+# combine_brcount($sumbrcount1, $sumbrcount2, $BR_ADD);
+#
+ # Combine testdata
+ foreach $testname (keys(%{$testdata1}))
+ {
+ if (defined($testdata2->{$testname}))
+ {
+ # testname is present in both entries, requires
+ # combination
+ ($result_testdata{$testname}) =
+ add_counts($testdata1->{$testname},
+ $testdata2->{$testname});
+ }
+ else
+ {
+ # testname only present in entry1, add to result
+ $result_testdata{$testname} = $testdata1->{$testname};
+ }
+
+ # update sum count hash
+ ($result_sumcount, $lines_found, $lines_hit) =
+ add_counts($result_sumcount,
+ $result_testdata{$testname});
+ }
+
+ foreach $testname (keys(%{$testdata2}))
+ {
+ # Skip testnames already covered by previous iteration
+ if (defined($testdata1->{$testname})) { next; }
+
+ # testname only present in entry2, add to result hash
+ $result_testdata{$testname} = $testdata2->{$testname};
+
+ # update sum count hash
+ ($result_sumcount, $lines_found, $lines_hit) =
+ add_counts($result_sumcount,
+ $result_testdata{$testname});
+ }
+
+ # Calculate resulting sumcount
+
+ # Store result
+ set_info_entry(\%result, \%result_testdata, $result_sumcount,
+ $result_funcdata, $checkdata1, $result_testfncdata,
+ $result_sumfnccount, $result_testbrdata,
+ $result_sumbrcount, $lines_found, $lines_hit,
+ $fn_found, $fn_hit, $br_found, $br_hit);
+
+ return(\%result);
+}
+
+# From genhtml:
+#
+# combine_info_files(info_ref1, info_ref2)
+#
+# Combine .info data in hashes referenced by INFO_REF1 and INFO_REF2. Return
+# reference to resulting hash.
+#
+sub combine_info_files($$)
+{
+ my %hash1 = %{$_[0]};
+ my %hash2 = %{$_[1]};
+ my $filename;
+
+ foreach $filename (keys(%hash2))
+ {
+ if ($hash1{$filename})
+ {
+ # Entry already exists in hash1, combine them
+ $hash1{$filename} =
+ combine_info_entries($hash1{$filename},
+ $hash2{$filename},
+ $filename);
+ }
+ else
+ {
+ # Entry is unique in both hashes, simply add to
+ # resulting hash
+ $hash1{$filename} = $hash2{$filename};
+ }
+ }
+
+ return(\%hash1);
+}
+
+# From genhtml:
+#
+# add_counts(data1_ref, data2_ref)
+#
+# DATA1_REF and DATA2_REF are references to hashes containing a mapping
+#
+# line number -> execution count
+#
+# Return a list (RESULT_REF, LINES_FOUND, LINES_HIT) where RESULT_REF
+# is a reference to a hash containing the combined mapping in which
+# execution counts are added.
+#
+sub add_counts($$)
+{
+ my $data1_ref = $_[0]; # Hash 1
+ my $data2_ref = $_[1]; # Hash 2
+ my %result; # Resulting hash
+ my $line; # Current line iteration scalar
+ my $data1_count; # Count of line in hash1
+ my $data2_count; # Count of line in hash2
+ my $found = 0; # Total number of lines found
+ my $hit = 0; # Number of lines with a count > 0
+
+ foreach $line (keys(%$data1_ref))
+ {
+ $data1_count = $data1_ref->{$line};
+ $data2_count = $data2_ref->{$line};
+
+ # Add counts if present in both hashes
+ if (defined($data2_count)) { $data1_count += $data2_count; }
+
+ # Store sum in %result
+ $result{$line} = $data1_count;
+
+ $found++;
+ if ($data1_count > 0) { $hit++; }
+ }
+
+ # Add lines unique to data2_ref
+ foreach $line (keys(%$data2_ref))
+ {
+ # Skip lines already in data1_ref
+ if (defined($data1_ref->{$line})) { next; }
+
+ # Copy count from data2_ref
+ $result{$line} = $data2_ref->{$line};
+
+ $found++;
+ if ($result{$line} > 0) { $hit++; }
+ }
+
+ return (\%result, $found, $hit);
+}
+
+
+# From genhtml:
+sub compress_brcount($)
+{
+ my ($brcount) = @_;
+ my $db;
+
+ $db = brcount_to_db($brcount);
+ return db_to_brcount($db, $brcount);
+}
+
+#
+# brcount_to_db(brcount)
+#
+# Convert brcount data to the following format:
+#
+# db: line number -> block hash
+# block hash: block number -> branch hash
+# branch hash: branch number -> taken value
+#
+
+sub brcount_to_db($)
+{
+ my ($brcount) = @_;
+ my $line;
+ my $db;
+
+ # Add branches to database
+ foreach $line (keys(%{$brcount})) {
+ my $brdata = $brcount->{$line};
+
+ foreach my $entry (split(/:/, $brdata)) {
+ my ($block, $branch, $taken) = split(/,/, $entry);
+ my $old = $db->{$line}->{$block}->{$branch};
+
+ if (!defined($old) || $old eq "-") {
+ $old = $taken;
+ } elsif ($taken ne "-") {
+ $old += $taken;
+ }
+
+ $db->{$line}->{$block}->{$branch} = $old;
+ }
+ }
+
+ return $db;
+}
+
+
+#
+# db_to_brcount(db[, brcount])
+#
+# Convert branch coverage data back to brcount format. If brcount is specified,
+# the converted data is directly inserted in brcount.
+#
+
+sub db_to_brcount($;$)
+{
+ my ($db, $brcount) = @_;
+ my $line;
+ my $br_found = 0;
+ my $br_hit = 0;
+
+ # Convert database back to brcount format
+ foreach $line (sort({$a <=> $b} keys(%{$db}))) {
+ my $ldata = $db->{$line};
+ my $brdata;
+ my $block;
+
+ foreach $block (sort({$a <=> $b} keys(%{$ldata}))) {
+ my $bdata = $ldata->{$block};
+ my $branch;
+
+ foreach $branch (sort({$a <=> $b} keys(%{$bdata}))) {
+ my $taken = $bdata->{$branch};
+
+ $br_found++;
+ $br_hit++ if ($taken ne "-" && $taken > 0);
+ $brdata .= "$block,$branch,$taken:";
+ }
+ }
+ $brcount->{$line} = $brdata;
+ }
+
+ return ($brcount, $br_found, $br_hit);
+}
+
+
+#
+# brcount_db_combine(db1, db2, op)
+#
+# db1 := db1 op db2, where
+# db1, db2: brcount data as returned by brcount_to_db
+# op: one of $BR_ADD and BR_SUB
+#
+sub brcount_db_combine($$$)
+{
+ my ($db1, $db2, $op) = @_;
+
+ foreach my $line (keys(%{$db2})) {
+ my $ldata = $db2->{$line};
+
+ foreach my $block (keys(%{$ldata})) {
+ my $bdata = $ldata->{$block};
+
+ foreach my $branch (keys(%{$bdata})) {
+ my $taken = $bdata->{$branch};
+ my $new = $db1->{$line}->{$block}->{$branch};
+
+ if (!defined($new) || $new eq "-") {
+ $new = $taken;
+ } elsif ($taken ne "-") {
+ if ($op == $BR_ADD) {
+ $new += $taken;
+ } elsif ($op == $BR_SUB) {
+ $new -= $taken;
+ $new = 0 if ($new < 0);
+ }
+ }
+
+ $db1->{$line}->{$block}->{$branch} = $new;
+ }
+ }
+ }
+}
+
+# From genhtml
+sub info(@)
+{
+ if($debug)
+ {
+ # Print info string
+ printf(@_);
+ }
+}
+
+# NEW STUFF
+
## Format per file, repeated, no linebreak
# <diffcmd>
# index c1..c2 c3
# 3 lines of context
#
# output:
+# <dali-source-file>: source / header files in dali/dali-toolkit
+# \%filter: <dali-source-file> -> \%filedata
+# %filedata: "patch" -> \@checklines
+# "b_lines" -> \%b_lines
+# @checklines: vector of \[start, length] # line numbers of new/modified lines
+# %b_lines: <line-number> -> patch line in b-file.
sub parse_diff
{
my $patchref = shift;
}
}
- return {%filter};
+ return {%filter};#copy? - test and fixme
}
sub show_patch_lines
}
}
-sub get_gcno_file
-{
- # Assumes test cases have been run, and "make rename_cov_data" has been executed
-
- my $file = shift;
- my ($name, $path, $suffix) = fileparse($file, (".c", ".cpp", ".h"));
- my $gcno_file = $repo->wc_path() . "/build/tizen/.cov/$name.gcno";
-
- # Note, will translate headers to their source's object, which
- # may miss execution code in the headers (e.g. inlines are usually
- # not all used in the implementation, and require getting coverage
- # from test cases.
-
- if( -f $gcno_file )
- {
- my $gcno_st = stat($gcno_file);
- my $fq_file = $repo->wc_path() . $file;
- my $src_st = stat($fq_file);
- if($gcno_st->ctime < $src_st->mtime)
- {
- print "WARNING: GCNO $gcno_file older than SRC $fq_file\n";
- $gcno_file="";
- }
-
- }
- else
- {
- print("WARNING: No equivalent gcno file for $file\n");
- }
- return $gcno_file;
-}
-
-our %gcovfiles=();
-sub get_coverage
-{
- my $file = shift;
- my $filesref = shift;
- print("get_coverage($file)\n") if $debug;
- my $gcno_file = get_gcno_file($file);
- my @gcov_files = ();
- my $gcovfile;
- if( $gcno_file )
- {
- print "Running gcov on $gcno_file:\n" if $debug;
- open( my $fh, "gcov --preserve-paths $gcno_file |") || die "Can't run gcov:$!\n";
- while( <$fh> )
- {
- print $_ if $debug>=3;
- chomp;
- if( m!'(.*\.gcov)'$! )
- {
- my $coverage_file = $1; # File has / replaced with # and .. replaced with ^
- my $source_file = $coverage_file;
- $source_file =~ s!\^!..!g; # Change ^ to ..
- $source_file =~ s!\#!/!g; # change #'s to /s
- $source_file =~ s!.gcov$!!; # Strip off .gcov suffix
-
- print "Matching $file against $source_file\n" if $debug >= 3;
- # Only want the coverage files matching source file:
- if(index( $source_file, $file ) > 0 )
- {
- $gcovfile = $coverage_file;
- # Some header files do not produce an equivalent gcov file so we shouldn't parse them
- if(($source_file =~ /\.h$/) && (! -e $gcovfile))
- {
- print "Omitting Header: $source_file\n" if $debug;
- $gcovfile = ""
- }
- last;
- }
- }
- }
- close($fh);
-
- if($gcovfile)
- {
- if($gcovfiles{$gcovfile} == undef)
- {
- # Only parse a gcov file once
- $gcovfiles{$gcovfile}->{"seen"}=1;
-
- print "Getting coverage data from $gcovfile\n" if $debug;
-
- open( FH, "< $gcovfile" ) || die "Can't open $gcovfile for reading:$!\n";
- while(<FH>)
- {
- my ($cov, $line, @code ) = split( /:/, $_ );
- $cov =~ s/^\s+//; # Strip leading space
- $line =~ s/^\s+//;
- my $code=join(":", @code);
- if($cov =~ /\#/)
- {
- # There is no coverage data for these executable lines
- $gcovfiles{$gcovfile}->{"uncovered"}->{$line}++;
- $gcovfiles{$gcovfile}->{"src"}->{$line}=$code;
- }
- elsif( $cov ne "-" && looks_like_number($cov) && $cov > 0 )
- {
- $gcovfiles{$gcovfile}->{"covered"}->{$line}=$cov;
- $gcovfiles{$gcovfile}->{"src"}->{$line}=$code;
- }
- else
- {
- # All other lines are not executable.
- $gcovfiles{$gcovfile}->{"src"}->{$line}=$code;
- }
- }
- close( FH );
- }
- $filesref->{$file}->{"coverage"} = $gcovfiles{$gcovfile}; # store hashref
- }
- else
- {
- # No gcov output - the gcno file produced no coverage of the source/header
- # Probably means that there is no coverage for the file (with the given
- # test case - there may be some somewhere, but for the sake of speed, don't
- # check (yet).
- }
- }
-}
-
-# Run the git diff command to get the patch, then check the coverage
-# output for the patch.
+# Run the git diff command to get the patch
+# Output - see parse_diff
sub run_diff
{
- #print "run_diff(" . join(" ", @_) . ")\n";
my ($fh, $c) = $repo->command_output_pipe(@_);
our @patch=();
while(<$fh>)
# @patch has slurped diff for all files...
my $filesref = parse_diff ( \@patch );
- show_patch_lines($filesref) if $debug;
-
- print "Checking coverage:\n" if $debug;
-
- my $cwd=getcwd();
- chdir ".cov" || die "Can't find $cwd/.cov:$!\n";
+ show_patch_lines($filesref) if $debug>1;
- for my $file (keys(%$filesref))
- {
- my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
- next if($path !~ /^dali/);
- if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h")
- {
- get_coverage($file, $filesref);
- }
- }
- chdir $cwd;
return $filesref;
}
my $uncovered_lines = 0;
my $patchref = $filesref->{$file}->{"patch"};
- my $coverage_ref = $filesref->{$file}->{"coverage"};
- if( $coverage_ref )
+
+ my $abs_filename = File::Spec->rel2abs($file, $root);
+ my $sumcountref = $info_data{$abs_filename}->{"sum"};
+
+ if( $sumcountref )
{
for my $patch (@$patchref)
{
for(my $i = 0; $i < $patch->[1]; $i++ )
{
my $line = $i + $patch->[0];
- if($coverage_ref->{"covered"}->{$line})
- {
- $covered_lines++;
- $total_covered_lines++;
- }
- if($coverage_ref->{"uncovered"}->{$line})
+ if(exists($sumcountref->{$line}))
{
- $uncovered_lines++;
- $total_uncovered_lines++;
+ if( $sumcountref->{$line} > 0 )
+ {
+ $covered_lines++;
+ $total_covered_lines++;
+ }
+ else
+ {
+ $uncovered_lines++;
+ $total_uncovered_lines++;
+ }
}
}
}
- $coverage_ref->{"covered_lines"} = $covered_lines;
- $coverage_ref->{"uncovered_lines"} = $uncovered_lines;
+ $filesref->{$file}->{"covered_lines"} = $covered_lines;
+ $filesref->{$file}->{"uncovered_lines"} = $uncovered_lines;
my $total = $covered_lines + $uncovered_lines;
my $percent = 0;
if($total > 0)
{
$percent = $covered_lines / $total;
}
- $coverage_ref->{"percent_covered"} = 100 * $percent;
+ $filesref->{$file}->{"percent_covered"} = 100 * $percent;
+ }
+ else
+ {
+ print "Can't find coverage data for $abs_filename\n";
}
}
my $total_exec = $total_covered_lines + $total_uncovered_lines;
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 ];
}
+#
+#
sub patch_output
{
my $filesref = shift;
my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
next if($path !~ /^dali/);
- my $patchref = $filesref->{$file}->{"patch"};
- my $b_lines_ref = $filesref->{$file}->{"b_lines"};
- my $coverage_ref = $filesref->{$file}->{"coverage"};
+ my $fileref = $filesref->{$file};
+ my $patchref = $fileref->{"patch"};
+ my $b_lines_ref = $fileref->{"b_lines"};
+
+ my $abs_filename = File::Spec->rel2abs($file, $root);
+ my $sumcountref = $info_data{$abs_filename}->{"sum"};
+
print BOLD, "$file ";
- if($coverage_ref)
+ if($fileref)
{
- if( $coverage_ref->{"covered_lines"} > 0
+ if( $fileref->{"covered_lines"} > 0
||
- $coverage_ref->{"uncovered_lines"} > 0 )
+ $fileref->{"uncovered_lines"} > 0 )
{
- print GREEN, "Covered: " . $coverage_ref->{"covered_lines"}, RED, " Uncovered: " . $coverage_ref->{"uncovered_lines"}, RESET;
+ print GREEN, "Covered: " . $fileref->{"covered_lines"}, RED, " Uncovered: " . $fileref->{"uncovered_lines"}, RESET;
}
}
else
my $line = $i + $patch->[0];
printf "%-6s ", $line;
- if($coverage_ref)
+ if($sumcountref)
{
my $color;
- if($coverage_ref->{"covered"}->{$line})
+ if(exists($sumcountref->{$line}))
{
- $color=GREEN;
- }
- elsif($coverage_ref->{"uncovered"}->{$line})
- {
- $color=BOLD . RED;
+ if($sumcountref->{$line} > 0)
+ {
+ $color=GREEN;
+ }
+ else
+ {
+ $color=BOLD . RED;
+ }
}
else
{
- $color=BLACK;
+ $color=CYAN;
}
- my $src=$coverage_ref->{"src"}->{$line};
- chomp($src);
+ my $src = $b_lines_ref->{$line};
print $color, "$src\n", RESET;
}
else
{
- # We don't have coverage data, so print it from the patch instead.
my $src = $b_lines_ref->{$line};
print "$src\n";
}
}
}
-
+#
+#
sub patch_html_output
{
my $filesref = shift;
- my $html = HTML::Element->new('html');
- my $head = HTML::Element->new('head');
- my $title = HTML::Element->new('title');
- $title->push_content("Patch Coverage");
- $head->push_content($title, "\n");
- $html->push_content($head, "\n");
+ open( my $filehandle, ">", $opt_output ) || die "Can't open $opt_output for writing:$!\n";
- my $body = HTML::Element->new('body');
- $body->attr('bgcolor', "white");
+ my $OUTPUT_FH = select;
+ select $filehandle;
+ print <<EOH;
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>Patch Coverage</title>
+</head>
+<body bgcolor="white">
+EOH
- foreach my $file (sort(keys(%$filesref)))
+ foreach my $file (keys(%$filesref))
{
my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
next if($path !~ /^dali/);
- my $patchref = $filesref->{$file}->{"patch"};
- my $b_lines_ref = $filesref->{$file}->{"b_lines"};
- my $coverage_ref = $filesref->{$file}->{"coverage"};
-
- my $header = HTML::Element->new('h2');
- $header->push_content($file);
- $body->push_content($header);
- $body->push_content("\n");
- if($coverage_ref)
+ my $fileref = $filesref->{$file};
+ my $patchref = $fileref->{"patch"};
+ my $b_lines_ref = $fileref->{"b_lines"};
+
+ my $abs_filename = File::Spec->rel2abs($file, $root);
+ my $sumcountref = $info_data{$abs_filename}->{"sum"};
+
+ print "<h2>$file</h2>\n";
+
+ if($fileref)
{
- if( $coverage_ref->{"covered_lines"} > 0
+ if( $fileref->{"covered_lines"} > 0
||
- $coverage_ref->{"uncovered_lines"} > 0 )
+ $fileref->{"uncovered_lines"} > 0 )
{
- my $para = HTML::Element->new('p');
- my $covered = HTML::Element->new('span');
- $covered->attr('style', "color:green;");
- $covered->push_content("Covered: " . $coverage_ref->{"covered_lines"} );
- $para->push_content($covered);
-
- my $para2 = HTML::Element->new('p');
- my $uncovered = HTML::Element->new('span');
- $uncovered->attr('style', "color:red;");
- $uncovered->push_content("Uncovered: " . $coverage_ref->{"uncovered_lines"} );
- $para2->push_content($uncovered);
- $body->push_content($para, $para2);
- }
- else
- {
- #print "coverage ref exists for $file:\n" . Data::Dumper::Dumper($coverage_ref) . "\n";
+ print "<p style=\"color:green;\">Covered: " .
+ $fileref->{"covered_lines"} . "<p>" .
+ "<p style=\"color:red;\">Uncovered: " .
+ $fileref->{"uncovered_lines"} . "</span></p>";
}
}
else
{
- my $para = HTML::Element->new('p');
- my $span = HTML::Element->new('span');
+ print "<p>";
+ my $span=0;
if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h")
{
- $span->attr('style', "color:red;");
+ print "<span style=\"color:red;\">";
+ $span=1;
}
- $span->push_content("No coverage found");
- $para->push_content($span);
- $body->push_content($para);
+ print "No coverage found";
+ print "</span>" if $span;
}
+ print "</p>";
for my $patch (@$patchref)
{
{
$hunkstr .= " - " . ($patch->[0]+$patch->[1]-1);
}
+ print "<p style=\"font-weight:bold;\">" . $hunkstr . "</p>";
- my $para = HTML::Element->new('p');
- my $span = HTML::Element->new('span');
- $span->attr('style', "font-weight:bold;");
- $span->push_content($hunkstr);
- $para->push_content($span);
- $body->push_content($para);
-
- my $codeHunk = HTML::Element->new('pre');
+ print "<pre>";
for(my $i = 0; $i < $patch->[1]; $i++ )
{
my $line = $i + $patch->[0];
my $num_line_digits=log($line)/log(10);
for $i (0..(6-$num_line_digits-1))
{
- $codeHunk->push_content(" ");
+ print " ";
}
+ print "$line ";
- $codeHunk->push_content("$line ");
-
- my $srcLine = HTML::Element->new('span');
- if($coverage_ref)
+ if($sumcountref)
{
my $color;
-
- if($coverage_ref->{"covered"}->{$line})
+ if(exists($sumcountref->{$line}))
{
- $srcLine->attr('style', "color:green;");
- }
- elsif($coverage_ref->{"uncovered"}->{$line})
- {
- $srcLine->attr('style', "color:red;font-weight:bold;");
+ if($sumcountref->{$line} > 0)
+ {
+ print("<span style=\"color:green;\">");
+ }
+ else
+ {
+ print("<span style=\"color:red;font-weight:bold;\">");
+ }
}
else
{
- $srcLine->attr('style', "color:black;font-weight:normal;");
+ print("<span style=\"color:black;font-weight:normal;\">");
}
- my $src=$coverage_ref->{"src"}->{$line};
+ my $src=$b_lines_ref->{$line};
chomp($src);
- $srcLine->push_content($src);
+ print "$src</span>\n";
}
else
{
- # We don't have coverage data, so print it from the patch instead.
my $src = $b_lines_ref->{$line};
- $srcLine->attr('style', "color:black;font-weight:normal;");
- $srcLine->push_content($src);
+ print "$src\n";
}
- $codeHunk->push_content($srcLine, "\n");
}
- $body->push_content($codeHunk, "\n");
+ print "<\pre>\n";
}
}
- $body->push_content(HTML::Element->new('hr'));
- $html->push_content($body, "\n");
- open( my $filehandle, ">", $opt_output ) || die "Can't open $opt_output for writing:$!\n";
-
- print $filehandle <<EOH;
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-EOH
-;
- print $filehandle $html->as_HTML();
+ print $filehandle "<hr>\n</body>\n</html>\n";
close $filehandle;
+ select $OUTPUT_FH;
}
## MAIN ##
################################################################################
-my $cwd = getcwd();
-chdir $repo->wc_path();
-chdir "build/tizen";
-`make rename_cov_data`;
+my $cwd = getcwd(); # expect this to be automated-tests folder
-my @cmd=('--no-pager','diff','--no-ext-diff','-U0','--no-color');
+# execute coverage.sh, generating build/tizen/dali.info from lib, and
+# *.dir/dali.info. Don't generate html
+print `./coverage.sh -n`;
+chdir "..";
+$root = getcwd();
+
+our %info_data; # Hash of all data from .info files
+my @info_files = split(/\n/, `find . -name dali.info`);
+my %new_info;
+
+# Read in all specified .info files
+foreach (@info_files)
+{
+ %new_info = %{read_info_file($_)};
+
+ # Combine %new_info with %info_data
+ %info_data = %{combine_info_files(\%info_data, \%new_info)};
+}
+
+# Generate git diff command
+my @cmd=('--no-pager','diff','--no-ext-diff','-U0','--no-color');
my $status = $repo->command("status", "-s");
+
if( $status eq "" && !scalar(@ARGV))
{
# There are no changes in the index or working tree, and
}
push @cmd, @ARGV;
+
+# Execute diff & coverage from root directory
my $filesref = run_diff(@cmd);
chdir $cwd;
exit 0; # Exit with no error.
}
+#print_simplified_info() if $debug;
+#exit 0;
+
my $percentref = calc_patch_coverage_percentage($filesref);
if($percentref->[0] == 0)
{
print RESET;
}
+printf("Line Coverage: %d/%d\n", $percentref->[2], $percentref->[0]);
printf("Percentage of change covered: %5.2f%\n", $percent);
exit($percent<90);
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));
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 */
{
}
+ inline void BlendBarrier(void)
+ {
+ }
+
private:
inline void AddUniformCallToTraceStack(GLint location, std::string& value)
{
#include <sys/types.h>
#include <sys/wait.h>
#include <testcase.h>
+
+#include <time.h>
#include <unistd.h>
+#include <chrono>
#include <cstring>
#include <map>
#include <vector>
{
typedef std::map<int32_t, TestCase> RunningTestCases;
+const double MAXIMUM_CHILD_LIFETIME(60.0f); // 1 minute
+
const char* basename(const char* path)
{
const char* ptr = path;
else // Parent process
{
TestCase tc(nextTestCase, tc_array[nextTestCase].name);
+ tc.startTime = std::chrono::steady_clock::now();
+
children[pid] = tc;
nextTestCase++;
numRunningChildren++;
}
}
- // Wait for the next child to finish
-
+ // Check to see if any children have finished yet
int32_t status = 0;
- int32_t childPid = waitpid(-1, &status, 0);
- if(childPid == -1)
+ int32_t childPid = waitpid(-1, &status, WNOHANG);
+ if(childPid == 0)
+ {
+ // No children have finished.
+ // Check if any have exceeded execution time
+ auto endTime = std::chrono::steady_clock::now();
+
+ for(auto& tc : children)
+ {
+ std::chrono::steady_clock::duration timeSpan = endTime - tc.second.startTime;
+ std::chrono::duration<double> seconds = std::chrono::duration_cast<std::chrono::duration<double>>(timeSpan);
+ if(seconds.count() > MAXIMUM_CHILD_LIFETIME)
+ {
+ // Kill the child process. A subsequent call to waitpid will process signal result below.
+ kill(tc.first, SIGKILL);
+ }
+ }
+ }
+ else if(childPid == -1) // waitpid errored
{
perror("waitpid");
exit(EXIT_STATUS_WAITPID_FAILED);
}
-
- if(WIFEXITED(status))
+ else // a child has finished
{
- if(childPid > 0)
+ if(WIFEXITED(status))
{
int32_t testResult = WEXITSTATUS(status);
if(testResult)
}
numRunningChildren--;
}
- }
-
- else if(WIFSIGNALED(status) || WIFSTOPPED(status))
- {
- status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status);
- if(childPid > 0)
+ else if(WIFSIGNALED(status) || WIFSTOPPED(status))
{
+ status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status);
+
RunningTestCases::iterator iter = children.find(childPid);
if(iter != children.end())
{
#include <stdio.h>
#include <testcase.h>
+#include <chrono>
#include <cstdint>
namespace TestHarness
struct TestCase
{
- int32_t testCase;
- const char* testCaseName;
+ int32_t testCase;
+ const char* testCaseName;
+ std::chrono::steady_clock::time_point startTime;
TestCase()
: testCase(0),
- testCaseName(NULL)
+ testCaseName(NULL),
+ startTime()
{
}
TestCase(int32_t tc, const char* name)
: testCase(tc),
- testCaseName(name)
+ testCaseName(name),
+ startTime()
{
}
TestCase(const TestCase& rhs)
: testCase(rhs.testCase),
- testCaseName(rhs.testCaseName)
+ testCaseName(rhs.testCaseName),
+ startTime(rhs.startTime)
{
}
TestCase& operator=(const TestCase& rhs)
{
testCase = rhs.testCase;
testCaseName = rhs.testCaseName;
+ startTime = rhs.startTime;
return *this;
}
};
#include <dali/integration-api/debug.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/devel-api/common/capabilities.h>
#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
END_TEST;
}
+int UtcDaliActorTouchAreaPropertyP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Vector2 touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get<Vector2>();
+ DALI_TEST_EQUALS(touchArea, Vector2::ZERO, TEST_LOCATION);
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(10.f, 10.f));
+ touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get<Vector2>();
+ DALI_TEST_EQUALS(touchArea, Vector2(10.f, 10.f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliActorTouchAreaPropertyN(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Make sure setting invalid types does not cause a crash
+ try
+ {
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, 1.0f);
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2::ONE);
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector3::ONE);
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector4::ONE);
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Map());
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Property::Array());
+ tet_result(TET_PASS);
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+ END_TEST;
+}
+
int UtcDaliActorLowerBelowNegative(void)
{
TestApplication application;
}
END_TEST;
}
+
+int UtcDaliActorPropertyBlendEquation(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test SetProperty AdvancedBlendEquation");
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer1 = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::OPACITY, 0.1f);
+
+ actor.AddRenderer(renderer1);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
+ application.GetScene().Add(actor);
+
+ if( !Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
+ int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
+ DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), false, TEST_LOCATION );
+ }
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
+ int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
+ DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), true, TEST_LOCATION );
+ }
+
+ Renderer renderer2 = Renderer::New( geometry, shader );
+ actor.AddRenderer(renderer2);
+
+ END_TEST;
+}
END_TEST;
}
-int UtcDaliLayerRaise(void)
+int UtcDaliLayerRaise1(void)
{
tet_infoline("Testing Dali::Layer::Raise()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerLower(void)
+int UtcDaliLayerRaise2(void)
+{
+ tet_infoline("Testing Dali::Layer raise Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+
+ layer1.Raise();
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+ // get root
+ Layer root = application.GetScene().GetLayer(0);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+ GetImplementation(root).DoAction("raise", Property::Map());
+
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliLayerLower1(void)
{
tet_infoline("Testing Dali::Layer::Lower()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerRaiseToTop(void)
+
+int UtcDaliLayerLower2(void)
+{
+ tet_infoline("Testing Dali::Layer lower Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+ layer2.Lower();
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+
+ // get root
+ Layer root = application.GetScene().GetLayer(0);
+ GetImplementation(root).DoAction("lower", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+ GetImplementation(layer2).DoAction("lower", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliLayerRaiseToTop1(void)
{
tet_infoline("Testing Dali::Layer::RaiseToTop()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerLowerToBottom(void)
+int UtcDaliLayerRaiseToTop2(void)
+{
+ tet_infoline("Testing Dali::Layer raiseToTop Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ application.GetScene().Add(layer3);
+ Layer root = application.GetScene().GetLayer(0);
+
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(layer1).DoAction("raiseToTop", Property::Map());
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(root).DoAction("raiseToTop", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliLayerLowerToBottom1(void)
{
tet_infoline("Testing Dali::Layer::LowerToBottom()");
TestApplication application;
END_TEST;
}
+int UtcDaliLayerLowerToBottom2(void)
+{
+ tet_infoline("Testing Dali::Layer lowerToBottom Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ application.GetScene().Add(layer3);
+
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(layer3).DoAction("lowerToBottom", Property::Map());
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+
int UtcDaliLayerSetClipping(void)
{
tet_infoline("Testing Dali::Layer::SetClipping()");
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/render-task-list-integ.h>
#include <dali/public-api/dali-core.h>
-
+#include <dali/devel-api/common/capabilities.h>
#include <cstdio>
#include <string>
DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelRenderer::Property::OPACITY )
DALI_PROPERTY( "renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR )
+ DALI_PROPERTY( "blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION )
*/
Geometry geometry = CreateQuadGeometry();
Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS(renderer.GetPropertyCount(), 26, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), 27, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION);
TEST_RENDERER_PROPERTY(renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendEquation", Property::INTEGER, true, false, false, DevelRenderer::Property::BLEND_EQUATION, TEST_LOCATION);
END_TEST;
}
END_TEST;
}
+int UtcDaliRendererBlendOptions05(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test SetAdvancedBlendEquation ");
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::OPACITY, 0.1f);
+
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
+ application.GetScene().Add(actor);
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::MAX ) )
+ {
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::MAX );
+ int equationRgb = renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::MAX, equationRgb, TEST_LOCATION );
+ }
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SCREEN );
+ int equation = renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION );
+
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::SCREEN, equation, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelRenderer::IsAdvancedBlendEquationApplied( renderer ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+ }
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::MULTIPLY ) )
+ {
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::ADD );
+ renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION_RGB, DevelBlendEquation::SCREEN );
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION_ALPHA, DevelBlendEquation::MULTIPLY );
+ int equationRgb = renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION_RGB );
+ int equationAlpha = renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION_ALPHA );
+
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::ADD, equationRgb, TEST_LOCATION );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::ADD, equationAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelRenderer::IsAdvancedBlendEquationApplied( renderer ), false, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+ }
+
+ tet_infoline("Error Checking\n");
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::MULTIPLY ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::OVERLAY ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::DARKEN ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::LIGHTEN ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::COLOR_DODGE ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::COLOR_BURN ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::HARD_LIGHT ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SOFT_LIGHT ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::DIFFERENCE ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::EXCLUSION ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::HUE ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SATURATION ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::COLOR ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::LUMINOSITY ) )
+ {
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::MULTIPLY );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::MULTIPLY, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SCREEN );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::SCREEN, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::OVERLAY );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::OVERLAY, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::DARKEN );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::DARKEN, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::LIGHTEN );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::LIGHTEN, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::COLOR_DODGE );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::COLOR_DODGE, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::COLOR_BURN );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::COLOR_BURN, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::HARD_LIGHT );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::HARD_LIGHT, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SOFT_LIGHT );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::SOFT_LIGHT, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::DIFFERENCE );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::DIFFERENCE, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::EXCLUSION );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::EXCLUSION, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::HUE );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::HUE, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::SATURATION );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::SATURATION, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::COLOR );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::COLOR, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::LUMINOSITY );
+ DALI_TEST_EQUALS( (int)DevelBlendEquation::LUMINOSITY, renderer.GetProperty<int>( DevelRenderer::Property::BLEND_EQUATION ), TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
int UtcDaliRendererSetBlendMode01(void)
{
TestApplication application;
CheckEnumerationProperty<StencilOperation::Type>(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT");
CheckEnumerationProperty<StencilOperation::Type>(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT");
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::MAX ) &&
+ Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::MIN ) )
+ {
+ application.SendNotification();
+ application.Render();
+ CheckEnumerationProperty< DevelBlendEquation::Type >( application, renderer, DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::REVERSE_SUBTRACT, DevelBlendEquation::MAX, DevelBlendEquation::MIN, "MIN" );
+ }
+
+ if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ {
+ application.SendNotification();
+ application.Render();
+ CheckEnumerationProperty< DevelBlendEquation::Type >( application, renderer, DevelRenderer::Property::BLEND_EQUATION, DevelBlendEquation::MIN, DevelBlendEquation::MULTIPLY, DevelBlendEquation::SCREEN, "SCREEN" );
+ }
+
END_TEST;
}
signalData.receivedTouchEvent = handle;
}
+ // Allows functor to be used for signal connection by string.
+ // No data stored, though, so quite useless.
void operator()()
{
signalData.functorCalled = true;
WheelEventSignalData& signalData;
};
+// Functor that sets the data when wheel-event signal is received
+struct WheelEventReceivedVoidFunctor
+{
+ WheelEventReceivedVoidFunctor(WheelEventSignalData& data)
+ : signalData(data)
+ {
+ }
+
+ // Signals connected through BaseObject::DoConnectSignal can only take void() methods
+ bool operator()(void)
+ {
+ signalData.functorCalled = true;
+ return true;
+ }
+
+ WheelEventSignalData& signalData;
+};
+
+
bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
{
return true;
END_TEST;
}
+int UtcDaliStageEventProcessingFinishedP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageEventProcessingFinishedSignalP2 - check event processing finished signal connection by name\n");
+
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ GetImplementation(stage).ConnectSignal(&application, "eventProcessingFinished", functor);
+
+ Actor actor(Actor::New());
+ stage.Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(eventProcessingFinished);
+
+ END_TEST;
+}
+
int UtcDaliStageEventProcessingFinishedN(void)
{
TestApplication application;
END_TEST;
}
+
+int UtcDaliStageTouchedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageTouchedSignalP2 - check touched signal connection by name\n");
+
+ TouchedSignalData data;
+ TouchFunctor functor(data);
+ GetImplementation(stage).ConnectSignal(&application, "touched", functor);
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Basic test: No actors, single touch (down then up).
+ {
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+ }
+ END_TEST;
+}
+
int UtcDaliStageTouchedSignalN(void)
{
TestApplication application;
END_TEST;
}
+
+int UtcDaliStageSignalWheelEventP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageSignalWheelEventP2 - check wheel signal connection by name\n");
+
+ WheelEventSignalData data;
+ WheelEventReceivedVoidFunctor functor(data);
+ GetImplementation(stage).ConnectSignal(&application, "wheelEvent", functor);
+
+ Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
+ application.ProcessEvent(event);
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ // It's meaningless, since there's no data passed to the functor :/
+
+ data.Reset();
+
+ Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
+ application.ProcessEvent(event2);
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliStageContextLostSignalP(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageContextLostSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageContextLostSignalP2 - check context loss signal connection by name\n");
+
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor(contextLost);
+ GetImplementation(stage).ConnectSignal(&application, "contextLost", contextLostFunctor);
+
+ Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliStageContextLostSignalN(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageContextRegainedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageContextRegainedSignalP2 - check context regained signal connection by name\n");
+
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor(contextRegained);
+ GetImplementation(stage).ConnectSignal(&application, "contextRegained", contextRegainedFunctor);
+
+ Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ notifier->NotifyContextRegained();
+ DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+
+
int UtcDaliStageContextRegainedSignalN(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageSceneCreatedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
+ GetImplementation(stage).ConnectSignal(&application, "sceneCreated", sceneCreatedFunctor);
+
+ Integration::Core& core = application.GetCore();
+ core.SceneCreated();
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliStageSceneCreatedSignalN(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliTouchArea(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.GetScene().Add(actor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchEventFunctor functor(data, false /* Do not consume */);
+ actor.TouchedSignal().Connect(&application, functor);
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(110.0f, 110.0f)));
+ // The actor touched signal is not called because the touch area is outside actor.
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // set a bigger touch area
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(200.0f, 200.0f));
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(110.0f, 110.0f)));
+ // The actor touched signal is called because the touch area is inside touchArea.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ data.Reset();
+
+ // set a smaller touch area
+ actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(50.0f, 50.0f));
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(80.0f, 80.0f)));
+ // The actor touched signal is not called because the touch area is outside touchArea.
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(30.0f, 30.0f)));
+ // The actor touched signal is called because the touch area is inside touchArea.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ data.Reset();
+
+ END_TEST;
+}
* @details Name "captureAllTouchAfterStart", type Property::BOOLEAN
* @note Default is false, i.e. actor under touch event will receive the touch even if touch started on this actor
*/
- CAPTURE_ALL_TOUCH_AFTER_START
+ CAPTURE_ALL_TOUCH_AFTER_START,
+
+ /**
+ * @brief If you set the TOUCH_AREA on an actor, when you touch the actor, the touch area is used rather than the size of the actor
+ * @details Name "touchArea", type Property::Vector2
+ * @note Default is Vector2::ZERO.
+ * @note for example
+ * Actor actor = Actor::New();
+ * actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ * actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(200.0f, 200.0f));
+ * actor.TouchedSignal().Connect(OnTouchCallback);
+ *
+ * If you want to reset the touch area to an area different with the size of the actor, you can set this TOUCH_AREA property.
+ */
+ TOUCH_AREA,
+
+ /**
+ * @brief Determines which blend equation will be used to render renderers of this actor.
+ * @pre To use Advanced Blend Equation(DevelBlendEquation::MULTIPLY ~ DevelBlendEquation::LUMINOSITY), the color to be rendered should be pre-multipled alpha.
+ * @details Name "blendEquation", type Property::INTEGER.
+ * @note Color of each renderer will be blended with rendering framebuffer.
+ * @note To check the blend equation is supported in the system, use Dali::Capabilities::IsBlendEquationSupported
+ */
+ BLEND_EQUATION
};
} // namespace Property
namespace Dali
{
-AnimationData::AnimationData()
-{
-}
+AnimationData::AnimationData() = default;
AnimationData::~AnimationData()
{
return PathConstrainer(dynamic_cast<Dali::Internal::PathConstrainer*>(handle.GetObjectPtr()));
}
-PathConstrainer::PathConstrainer()
-{
-}
+PathConstrainer::PathConstrainer() = default;
-PathConstrainer::~PathConstrainer()
-{
-}
+PathConstrainer::~PathConstrainer() = default;
-PathConstrainer::PathConstrainer(const PathConstrainer& handle)
-: Handle(handle)
-{
-}
+PathConstrainer::PathConstrainer(const PathConstrainer& handle) = default;
PathConstrainer::PathConstrainer(Internal::PathConstrainer* internal)
: Handle(internal)
--- /dev/null
+/*\r
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// CLASS HEADER\r
+#include <dali/devel-api/common/capabilities.h>\r
+#include <dali/internal/event/common/thread-local-storage.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace Capabilities\r
+{\r
+\r
+bool IsBlendEquationSupported( BlendEquation::Type blendEquation )\r
+{\r
+ return IsBlendEquationSupported( static_cast<DevelBlendEquation::Type>( blendEquation ) );\r
+}\r
+\r
+bool IsBlendEquationSupported( DevelBlendEquation::Type blendEquation )\r
+{\r
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();\r
+ return tls.IsBlendEquationSupported(blendEquation);\r
+}\r
+\r
+} // namespace Capabilities\r
+\r
+} // namespace Dali
\ No newline at end of file
--- /dev/null
+#ifndef DALI_CAPABILITIES_H\r
+#define DALI_CAPABILITIES_H\r
+\r
+/*\r
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/devel-api/rendering/renderer-devel.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace Capabilities\r
+{\r
+\r
+/**\r
+ * @brief Returns whether the blend equation is supported in the system or not.\r
+ * @param[in] blendEquation blend equation to be checked.\r
+ * @return True if the blend equation supported.\r
+ */\r
+DALI_CORE_API bool IsBlendEquationSupported( BlendEquation::Type blendEquation );\r
+\r
+/**\r
+ * @brief Returns whether the blend equation is supported in the system or not.\r
+ * @param[in] blendEquation blend equation to be checked.\r
+ * @return True if the blend equation supported.\r
+ */\r
+DALI_CORE_API bool IsBlendEquationSupported( DevelBlendEquation::Type blendEquation );\r
+\r
+} // namespace Capabilities\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_CAPABILITIES_H
\ No newline at end of file
/**
* Create a pointer-container.
*/
- OwnerContainer()
- {
- }
+ OwnerContainer() = default;
/**
* Non-virtual destructor; OwnerContainer<T> is not suitable as base class.
}
/**
+ * Erases a range of elements.(delete from heap).
+ */
+ Iterator Erase(Iterator first, Iterator last)
+ {
+ auto itr = first;
+ while(itr < last)
+ {
+ Delete(*itr);
+ ++itr;
+ }
+
+ return Vector<T>::Erase(first, last);
+ }
+
+ /**
* Erase an object from OwnerContainer
* @param object to remove
*/
namespace Dali
{
-SingletonService::SingletonService()
-{
-}
+SingletonService::SingletonService() = default;
SingletonService SingletonService::Get()
{
return Internal::ThreadLocalStorage::GetSingletonService();
}
-SingletonService::~SingletonService()
-{
-}
+SingletonService::~SingletonService() = default;
void SingletonService::Register(const std::type_info& info, BaseHandle singleton)
{
{
using Internal::Core;
-Stage::Stage()
-{
-}
+Stage::Stage() = default;
-Stage::~Stage()
-{
-}
+Stage::~Stage() = default;
-Stage::Stage(const Stage& handle)
-: BaseHandle(handle)
-{
-}
+Stage::Stage(const Stage& handle) = default;
-Stage& Stage::operator=(const Stage& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+Stage& Stage::operator=(const Stage& rhs) = default;
Stage::Stage(Internal::Stage* internal)
: BaseHandle(internal)
{
}
-TouchPoint::~TouchPoint()
-{
-}
+TouchPoint::~TouchPoint() = default;
} // namespace Dali
${devel_api_src_dir}/animation/animation-devel.cpp
${devel_api_src_dir}/animation/path-constrainer.cpp
${devel_api_src_dir}/common/addon-binder.cpp
+ ${devel_api_src_dir}/common/capabilities.cpp
${devel_api_src_dir}/common/hash.cpp
${devel_api_src_dir}/common/singleton-service.cpp
${devel_api_src_dir}/common/stage-devel.cpp
SET( devel_api_core_common_header_files
${devel_api_src_dir}/common/addon-binder.h
${devel_api_src_dir}/common/bitwise-enum.h
+ ${devel_api_src_dir}/common/capabilities.h
${devel_api_src_dir}/common/circular-queue.h
${devel_api_src_dir}/common/hash.h
${devel_api_src_dir}/common/singleton-service.h
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/internal/event/rendering/renderer-impl.h>
namespace Dali
{
namespace DevelRenderer
{
+bool IsAdvancedBlendEquationApplied(const Renderer& renderer)
+{
+ return GetImplementation(renderer).IsAdvancedBlendEquationApplied();
+}
+
void AddDrawCommand(Dali::Renderer renderer, const DrawCommand& drawCommand)
{
auto& impl = GetImplementation(renderer);
namespace Dali
{
+
+namespace DevelBlendEquation
+{
+
+/**
+ * @brief Enumeration for blend equation.
+ */
+enum Type
+{
+ ADD = Dali::BlendEquation::ADD,
+ SUBTRACT = Dali::BlendEquation::SUBTRACT,
+ REVERSE_SUBTRACT = Dali::BlendEquation::REVERSE_SUBTRACT,
+
+ // OpenGL es 3.0 enumeration
+ MIN = 0x8007,
+ MAX = 0x8008,
+
+ // OpenGL es 3.2 or KHR_Blend_Equation_Advanced enumeration
+ MULTIPLY = 0x9294,
+ SCREEN = 0x9295,
+ OVERLAY = 0x9296,
+ DARKEN = 0x9297,
+ LIGHTEN = 0x9298,
+ COLOR_DODGE = 0x9299,
+ COLOR_BURN = 0x929A,
+ HARD_LIGHT = 0x929B,
+ SOFT_LIGHT = 0x929C,
+ DIFFERENCE = 0x929E,
+ EXCLUSION = 0x92A0,
+ HUE = 0x92AD,
+ SATURATION = 0x92AE,
+ COLOR = 0x92AF,
+ LUMINOSITY = 0x92B0
+};
+
+} // namespace DevelBlendEquation
+
namespace DevelRenderer
{
/**
* @details Name "renderingBehavior", type Property::INTEGER.
*/
RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
+
+ /**
+ * @brief name "blendEquation", type INTEGER
+ * @note The default value is BlendEquation::ADD
+ */
+ BLEND_EQUATION,
};
} // namespace Property
} // namespace Rendering
+
+/**
+ * @brief Query whether current blend equation is advanced option.
+ * @param[in] renderer to be checked whether it has been applied advanced blend equation or not
+ * @return True if current blend equation is advanced.
+ */
+DALI_CORE_API bool IsAdvancedBlendEquationApplied( const Renderer& renderer );
+
} // namespace DevelRenderer
} // namespace Dali
/**
* @brief Destructor.
*/
- ~SignalDelegate()
- {
- }
+ ~SignalDelegate() = default;
public:
/**
{
}
-UpdateProxy::~UpdateProxy()
-{
-}
+UpdateProxy::~UpdateProxy() = default;
} // namespace Dali
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~PackedPixelsProfile()
- {
- }
+ virtual ~PackedPixelsProfile() = default;
};
/**
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~CompressedProfile()
- {
- }
+ virtual ~CompressedProfile() = default;
};
virtual const CompressedProfile* GetCompressedProfile() const
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~ContextNotifierInterface()
- {
- }
+ virtual ~ContextNotifierInterface() = default;
};
} // namespace Integration
#include <dali/integration-api/debug.h>
// EXTERNAL INCLUDES
+#include <chrono>
#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <iomanip>
-#include <sstream>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/public-api/common/constants.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/matrix3.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/vector4.h>
namespace Dali
{
#endif
-namespace // unnamed namespace
-{
-const uint64_t NANOSECONDS_PER_SECOND = 1e+9;
-
-}
-
namespace Integration
{
namespace Log
return s;
}
+#ifdef DEBUG_ENABLED
+
void GetNanoseconds(uint64_t& timeInNanoseconds)
{
- timespec timeSpec;
- clock_gettime(CLOCK_MONOTONIC, &timeSpec);
+ // Get the time of a monotonic clock since its epoch.
+ auto epoch = std::chrono::steady_clock::now().time_since_epoch();
+
+ auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(epoch);
- // Convert all values to uint64_t to match our return type
- timeInNanoseconds = (static_cast<uint64_t>(timeSpec.tv_sec) * NANOSECONDS_PER_SECOND) + static_cast<uint64_t>(timeSpec.tv_nsec);
+ timeInNanoseconds = static_cast<uint64_t>(duration.count());
}
+#endif // DEBUG_ENABLED
+
} // namespace Log
} // namespace Integration
/********************************************************************************
* Time instrumentation *
********************************************************************************/
-
#if defined(DEBUG_ENABLED)
+ /**
+ * @brief Get the monotonic time since the clock's epoch.
+ *
+ * @param[out] timeInNanoseconds The time in nanoseconds since the reference point.
+ *
+ * @note The maximum value timeInNanoseconds can hold is 0xFFFFFFFFFFFFFFFF which is 1.844674407e+19. Therefore, this can overflow after approximately 584 years.
+ */
void GetNanoseconds(uint64_t& timeInNanoseconds);
#define DALI_LOG_TIMER_START(timeVariable) \
{
namespace Integration
{
-Event::~Event()
-{
-}
+Event::~Event() = default;
Event::Event(Type eventType)
: type(eventType)
{
}
-HoverEvent::~HoverEvent()
-{
-}
+HoverEvent::~HoverEvent() = default;
} // namespace Integration
{
}
-KeyEvent::~KeyEvent()
-{
-}
+KeyEvent::~KeyEvent() = default;
} // namespace Integration
{
}
-MultiPointEvent::~MultiPointEvent()
-{
-}
+MultiPointEvent::~MultiPointEvent() = default;
void MultiPointEvent::AddPoint(const Point& point)
{
{
}
-Point::~Point()
-{
-}
+Point::~Point() = default;
void Point::SetDeviceId(int32_t deviceId)
{
DALI_ASSERT_ALWAYS(minMotionDistance.x >= 0.0f && minMotionDistance.y >= 0.0f && "Negative values not allowed\n");
}
-TouchEventCombiner::~TouchEventCombiner()
-{
-}
+TouchEventCombiner::~TouchEventCombiner() = default;
TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent)
{
{
}
-TouchEvent::~TouchEvent()
-{
-}
+TouchEvent::~TouchEvent() = default;
} // namespace Integration
{
}
-WheelEvent::~WheelEvent()
-{
-}
+WheelEvent::~WheelEvent() = default;
} // namespace Integration
*/
#include <stdint.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
/*
* This file is based on gl3.h, the following licence is included for conformance.
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~GlAbstraction()
- {
- }
+ virtual ~GlAbstraction() = default;
public:
/**
virtual bool IsSurfacelessContextSupported() const = 0;
/**
+ * Returns current gles can support advanced blend equation
+ * @Return true current gles support advanced blend equation
+ */
+ virtual bool IsAdvancedBlendEquationSupported() = 0;
+
+ /**
+ * Returns current gles can support the blend equation
+ * @Return true current gles support the blend equation
+ */
+ virtual bool IsBlendEquationSupported( DevelBlendEquation::Type blendEquation ) = 0;
+
+ /**
+ * Returns shader prefix of shading language version.
+ * @Return shader prefix of shading language version.
+ */
+ virtual std::string GetShaderVersionPrefix() = 0;
+
+ /**
+ * Returns vertex shader prefix including shading language version.
+ * @Return vertex shader prefix including shading language version.
+ */
+ virtual std::string GetVertexShaderPrefix() = 0;
+
+ /**
+ * Returns fragment shader prefix including shading language version and extension information.
+ * @Return fragment shader prefix including shading language version and extension information.
+ */
+ virtual std::string GetFragmentShaderPrefix() = 0;
+
+ /**
* Determine whether to convert pixel format or not.
* @param[in] imageGlFormat GLformat of input image.
* @param[in] textureGlFormat GLformat of Texture.
virtual void TexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) = 0;
virtual void TexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
virtual void GetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) = 0;
+ virtual void BlendBarrier (void) = 0;
// clang-format on
};
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+// GL_blend_equation_advanced / GLES 3.2
+#define GL_MULTIPLY 0x9294
+#define GL_SCREEN 0x9295
+#define GL_OVERLAY 0x9296
+#define GL_DARKEN 0x9297
+#define GL_LIGHTEN 0x9298
+#define GL_COLORDODGE 0x9299
+#define GL_COLORBURN 0x929A
+#define GL_HARDLIGHT 0x929B
+#define GL_SOFTLIGHT 0x929C
+#define GL_DIFFERENCE 0x929E
+#define GL_EXCLUSION 0x92A0
+#define GL_HSL_HUE 0x92AD
+#define GL_HSL_SATURATION 0x92AE
+#define GL_HSL_COLOR 0x92AF
+#define GL_HSL_LUMINOSITY 0x92B0
+
/*------------------------------------------------------------------------*
* EXT extension tokens
*------------------------------------------------------------------------*/
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~GlSyncAbstraction()
- {
- }
+ virtual ~GlSyncAbstraction() = default;
public:
class SyncObject
* Core from deleting SyncObjects - only Adaptor implementation is able to delete
* them.
*/
- virtual ~SyncObject()
- {
- }
+ virtual ~SyncObject() = default;
public:
/**
/**
* Virtual destructor.
*/
- virtual ~PlatformAbstraction()
- {
- }
+ virtual ~PlatformAbstraction() = default;
}; // class PlatformAbstraction
/**
* Virtual protected destructor
*/
- virtual ~Processor()
- {
- }
+ virtual ~Processor() = default;
};
} // namespace Integration
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~RenderController()
- {
- }
+ virtual ~RenderController() = default;
public:
/**
/**
* Destructor.
*/
- ~BitmapResourceType()
- {
- }
+ ~BitmapResourceType() = default;
/**
* Attributes are copied from the request.
return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
}
-Scene::Scene()
-{
-}
+Scene::Scene() = default;
-Scene::~Scene()
-{
-}
+Scene::~Scene() = default;
-Scene::Scene(const Scene& handle)
-: BaseHandle(handle)
-{
-}
+Scene::Scene(const Scene& handle) = default;
Scene::Scene(Internal::Scene* internal)
: BaseHandle(internal)
{
}
-Scene& Scene::operator=(const Scene& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+Scene& Scene::operator=(const Scene& rhs) = default;
void Scene::Add(Actor actor)
{
/*
- * 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.
const int MASK_SRC_FACTOR_ALPHA = 0x000000F0;
const int MASK_DEST_FACTOR_RGB = 0x00000F00;
const int MASK_DEST_FACTOR_ALPHA = 0x0000F000;
-const int MASK_EQUATION_RGB = 0x000F0000;
-const int MASK_EQUATION_ALPHA = 0x00F00000;
+const int MASK_EQUATION_RGB = 0x00FF0000;
+const int MASK_EQUATION_ALPHA = 0xFF000000;
const int SHIFT_TO_SRC_FACTOR_RGB = 0;
const int SHIFT_TO_SRC_FACTOR_ALPHA = 4;
const int SHIFT_TO_DEST_FACTOR_RGB = 8;
const int SHIFT_TO_DEST_FACTOR_ALPHA = 12;
const int SHIFT_TO_EQUATION_RGB = 16;
-const int SHIFT_TO_EQUATION_ALPHA = 20;
+const int SHIFT_TO_EQUATION_ALPHA = 24;
static unsigned int CLEAR_BLEND_FUNC_MASK = 0xFFFF0000; // Bottom 16 bits cleared
-static unsigned int CLEAR_BLEND_EQUATION_MASK = 0xFF00FFFF; // 8 bits cleared
+static unsigned int CLEAR_BLEND_EQUATION_MASK = 0x0000FFFF; // Top 16 bits cleared
/**
* Utility to store one of the BlendFunc values.
* @param[in] factor The BlendEquation value.
* @param[in] bitshift Used to shift to the correct part of options.
*/
-void StoreBlendEquation( unsigned int& options, BlendEquation::Type factor, int bitShift )
+void StoreBlendEquation( unsigned int& options, DevelBlendEquation::Type factor, int bitShift )
{
+ // Must be same order as BLENDING_EQUATIONS, below:
+ enum {
+ ADD_BITVAL = 0u,
+ SUBTRACT_BITVAL,
+ REVERSE_SUBTRACT_BITVAL,
+ MIN_BITVAL,
+ MAX_BITVAL,
+ MULTIPLY_BITVAL,
+ SCREEN_BITVAL,
+ OVERLAY_BITVAL,
+ DARKEN_BITVAL,
+ LIGHTEN_BITVAL,
+ COLOR_DODGE_BITVAL,
+ COLOR_BURN_BITVAL,
+ HARD_LIGHT_BITVAL,
+ SOFT_LIGHT_BITVAL,
+ DIFFERENCE_BITVAL,
+ EXCLUSION_BITVAL,
+ HUE_BITVAL,
+ SATURATION_BITVAL,
+ COLOR_BITVAL,
+ LUMINOSITY_BITVAL
+ };
+
switch ( factor )
{
- case BlendEquation::ADD:
+ case DevelBlendEquation::ADD:
{
- options |= ( 0u << bitShift );
+ options |= ( ADD_BITVAL << bitShift );
break;
}
- case BlendEquation::SUBTRACT:
+ case DevelBlendEquation::SUBTRACT:
{
- options |= ( 1u << bitShift );
+ options |= ( SUBTRACT_BITVAL << bitShift );
break;
}
- case BlendEquation::REVERSE_SUBTRACT:
+ case DevelBlendEquation::REVERSE_SUBTRACT:
{
- options |= ( 2u << bitShift );
+ options |= ( REVERSE_SUBTRACT_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::MIN:
+ {
+ options |= ( MIN_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::MAX:
+ {
+ options |= ( MAX_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::MULTIPLY:
+ {
+ options |= ( MULTIPLY_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::SCREEN:
+ {
+ options |= ( SCREEN_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::OVERLAY:
+ {
+ options |= ( OVERLAY_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::DARKEN:
+ {
+ options |= ( DARKEN_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::LIGHTEN:
+ {
+ options |= ( LIGHTEN_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::COLOR_DODGE:
+ {
+ options |= ( COLOR_DODGE_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::COLOR_BURN:
+ {
+ options |= ( COLOR_BURN_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::HARD_LIGHT:
+ {
+ options |= ( HARD_LIGHT_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::SOFT_LIGHT:
+ {
+ options |= ( SOFT_LIGHT_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::DIFFERENCE:
+ {
+ options |= ( DIFFERENCE_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::EXCLUSION:
+ {
+ options |= ( EXCLUSION_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::HUE:
+ {
+ options |= ( HUE_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::SATURATION:
+ {
+ options |= ( SATURATION_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::COLOR:
+ {
+ options |= ( COLOR_BITVAL << bitShift );
+ break;
+ }
+
+ case DevelBlendEquation::LUMINOSITY:
+ {
+ options |= ( LUMINOSITY_BITVAL << bitShift );
break;
}
}
}
const unsigned int BLENDING_FACTOR_COUNT = 15;
-const unsigned int BLENDING_EQUATION_COUNT = 3;
+const unsigned int BLENDING_EQUATION_COUNT = 20;
+const unsigned int BLENDING_EQUATION_ADVANCED_INDEX_START = 5;
+const unsigned int BLENDING_EQUATION_ADVANCED_INDEX_END = 19;
BlendFactor::Type BLENDING_FACTORS[ BLENDING_FACTOR_COUNT ] =
- { BlendFactor::ZERO,
- BlendFactor::ONE,
- BlendFactor::SRC_COLOR,
- BlendFactor::ONE_MINUS_SRC_COLOR,
- BlendFactor::SRC_ALPHA,
- BlendFactor::ONE_MINUS_SRC_ALPHA,
- BlendFactor::DST_ALPHA,
- BlendFactor::ONE_MINUS_DST_ALPHA,
- BlendFactor::DST_COLOR,
- BlendFactor::ONE_MINUS_DST_COLOR,
- BlendFactor::SRC_ALPHA_SATURATE,
- BlendFactor::CONSTANT_COLOR,
- BlendFactor::ONE_MINUS_CONSTANT_COLOR,
- BlendFactor::CONSTANT_ALPHA,
- BlendFactor::ONE_MINUS_CONSTANT_ALPHA };
-
-BlendEquation::Type BLENDING_EQUATIONS[ BLENDING_EQUATION_COUNT ] =
- { BlendEquation::ADD,
- BlendEquation::SUBTRACT,
- BlendEquation::REVERSE_SUBTRACT };
+{
+ BlendFactor::ZERO,
+ BlendFactor::ONE,
+ BlendFactor::SRC_COLOR,
+ BlendFactor::ONE_MINUS_SRC_COLOR,
+ BlendFactor::SRC_ALPHA,
+ BlendFactor::ONE_MINUS_SRC_ALPHA,
+ BlendFactor::DST_ALPHA,
+ BlendFactor::ONE_MINUS_DST_ALPHA,
+ BlendFactor::DST_COLOR,
+ BlendFactor::ONE_MINUS_DST_COLOR,
+ BlendFactor::SRC_ALPHA_SATURATE,
+ BlendFactor::CONSTANT_COLOR,
+ BlendFactor::ONE_MINUS_CONSTANT_COLOR,
+ BlendFactor::CONSTANT_ALPHA,
+ BlendFactor::ONE_MINUS_CONSTANT_ALPHA
+};
+
+DevelBlendEquation::Type BLENDING_EQUATIONS[ BLENDING_EQUATION_COUNT ] =
+{
+ DevelBlendEquation::ADD,
+ DevelBlendEquation::SUBTRACT,
+ DevelBlendEquation::REVERSE_SUBTRACT,
+ DevelBlendEquation::MIN,
+ DevelBlendEquation::MAX,
+ DevelBlendEquation::MULTIPLY,
+ DevelBlendEquation::SCREEN,
+ DevelBlendEquation::OVERLAY,
+ DevelBlendEquation::DARKEN,
+ DevelBlendEquation::LIGHTEN,
+ DevelBlendEquation::COLOR_DODGE,
+ DevelBlendEquation::COLOR_BURN,
+ DevelBlendEquation::HARD_LIGHT,
+ DevelBlendEquation::SOFT_LIGHT,
+ DevelBlendEquation::DIFFERENCE,
+ DevelBlendEquation::EXCLUSION,
+ DevelBlendEquation::HUE,
+ DevelBlendEquation::SATURATION,
+ DevelBlendEquation::COLOR,
+ DevelBlendEquation::LUMINOSITY
+};
/**
* Utility to retrieve one of the BlendFunc values.
* @param[in] bitshift Used to shift to the correct part of options.
* @return The blending equation.
*/
-BlendEquation::Type RetrieveBlendEquation( unsigned int options, int mask, int bitShift )
+DevelBlendEquation::Type RetrieveBlendEquation( unsigned int options, int mask, int bitShift )
{
unsigned int index = options & mask;
index = index >> bitShift;
SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA,
BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
- SetBlendEquation( BlendEquation::ADD, BlendEquation::ADD );
+ SetBlendEquation( DevelBlendEquation::ADD, DevelBlendEquation::ADD );
}
-BlendingOptions::~BlendingOptions()
-{
-}
+BlendingOptions::~BlendingOptions() = default;
void BlendingOptions::SetBitmask( unsigned int bitmask )
{
return RetrieveBlendFactor( mBitmask, MASK_DEST_FACTOR_ALPHA, SHIFT_TO_DEST_FACTOR_ALPHA );
}
-void BlendingOptions::SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha )
+void BlendingOptions::SetBlendEquation( DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha )
{
mBitmask &= CLEAR_BLEND_EQUATION_MASK; // Clear the BlendEquation values
StoreBlendEquation( mBitmask, equationAlpha, SHIFT_TO_EQUATION_ALPHA );
}
-BlendEquation::Type BlendingOptions::GetBlendEquationRgb() const
+DevelBlendEquation::Type BlendingOptions::GetBlendEquationRgb() const
{
return RetrieveBlendEquation( mBitmask, MASK_EQUATION_RGB, SHIFT_TO_EQUATION_RGB );
}
-BlendEquation::Type BlendingOptions::GetBlendEquationAlpha() const
+DevelBlendEquation::Type BlendingOptions::GetBlendEquationAlpha() const
{
return RetrieveBlendEquation( mBitmask, MASK_EQUATION_ALPHA, SHIFT_TO_EQUATION_ALPHA );
}
return mBlendColor.Get();
}
+bool BlendingOptions::IsAdvancedBlendEquationApplied()
+{
+ unsigned int indexRgb = mBitmask & MASK_EQUATION_RGB;
+ indexRgb = indexRgb >> SHIFT_TO_EQUATION_RGB;
+ unsigned int indexA = mBitmask & MASK_EQUATION_ALPHA;
+ indexA = indexA >> SHIFT_TO_EQUATION_ALPHA;
+
+ return ( ( ( indexRgb >= BLENDING_EQUATION_ADVANCED_INDEX_START ) && ( indexRgb <= BLENDING_EQUATION_ADVANCED_INDEX_END ) ) ||
+ ( ( indexA >= BLENDING_EQUATION_ADVANCED_INDEX_START ) && ( indexA <= BLENDING_EQUATION_ADVANCED_INDEX_END ) ) );
+}
+
+bool BlendingOptions::IsAdvancedBlendEquation( DevelBlendEquation::Type equation )
+{
+ switch ( equation )
+ {
+ case DevelBlendEquation::MULTIPLY:
+ case DevelBlendEquation::SCREEN:
+ case DevelBlendEquation::OVERLAY:
+ case DevelBlendEquation::DARKEN:
+ case DevelBlendEquation::LIGHTEN:
+ case DevelBlendEquation::COLOR_DODGE:
+ case DevelBlendEquation::COLOR_BURN:
+ case DevelBlendEquation::HARD_LIGHT:
+ case DevelBlendEquation::SOFT_LIGHT:
+ case DevelBlendEquation::DIFFERENCE:
+ case DevelBlendEquation::EXCLUSION:
+ case DevelBlendEquation::HUE:
+ case DevelBlendEquation::SATURATION:
+ case DevelBlendEquation::COLOR:
+ case DevelBlendEquation::LUMINOSITY:
+ {
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+}
+
} // namespace Internal
} // namespace Dali
#define DALI_BLENDING_OPTIONS_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.
// INTERNAL INCLUDES
#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/public-api/math/vector4.h>
#include <dali/internal/common/owner-pointer.h>
/**
* @copydoc Dali::RenderableActor::SetBlendEquation()
*/
- void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha );
+ void SetBlendEquation( DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha );
/**
* @copydoc Dali::RenderableActor::GetBlendEquation()
*/
- BlendEquation::Type GetBlendEquationRgb() const;
+ DevelBlendEquation::Type GetBlendEquationRgb() const;
/**
* @copydoc Dali::RenderableActor::GetBlendEquation()
*/
- BlendEquation::Type GetBlendEquationAlpha() const;
+ DevelBlendEquation::Type GetBlendEquationAlpha() const;
/**
* Set the blend color.
*/
const Vector4* GetBlendColor() const;
+ /**
+ * Query whether current blend equation is advanced option.
+ * @return True if current blend equation is advanced.
+ */
+ bool IsAdvancedBlendEquationApplied();
+
+ /**
+ * Query whether input blend equation is advanced option.
+ * @return True if input blend equation is advanced.
+ */
+ static bool IsAdvancedBlendEquation( DevelBlendEquation::Type equation );
+
private:
// Undefined copy constructor.
Integration::PartialUpdateAvailable partialUpdateAvailable )
: mRenderController( renderController ),
mPlatform(platform),
+ mGlAbstraction(glAbstraction),
mProcessingEvent(false),
mForceNextUpdate( false )
{
mRelayoutController->OnApplicationSceneCreated();
- for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+ for( const auto& scene : mScenes )
{
- Dali::Actor sceneRootLayer = (*iter)->GetRootLayer();
+ Dali::Actor sceneRootLayer = scene->GetRootLayer();
mRelayoutController->RequestRelayoutTree( sceneRootLayer );
}
}
return *(mAnimationPlaylist);
}
+Integration::GlAbstraction& Core::GetGlAbstraction() const
+{
+ return mGlAbstraction;
+}
+
void Core::AddScene( Scene* scene )
{
mScenes.push_back( scene );
*/
AnimationPlaylist& GetAnimationPlaylist() const;
+ /**
+ * @brief Returns GlAbstraction.
+ * @note Use only for the capability. Do not use this for bypass context
+ * @return GlAbstraction
+ */
+ Integration::GlAbstraction& GetGlAbstraction() const;
+
private:
/**
// The object registry
ObjectRegistryPtr mObjectRegistry;
+ // GlAbstraction for capabilities of GL
+ // Not to use this for bypass Context.
+ Integration::GlAbstraction& mGlAbstraction;
+
bool mProcessingEvent : 1; ///< True during ProcessEvents()
bool mForceNextUpdate:1; ///< True if the next rendering is really required.
{
}
- ~ImageAttributesImpl()
- {
- }
+ ~ImageAttributesImpl() = default;
- ImageAttributesImpl(const ImageAttributesImpl& rhs)
- : width( rhs.width ),
- height( rhs.height ),
- scaling( rhs.scaling ),
- filtering( rhs.filtering ),
- mOrientationCorrection( rhs.mOrientationCorrection )
- {
- }
+ ImageAttributesImpl(const ImageAttributesImpl& rhs) = default;
ImageAttributesImpl& operator=(const ImageAttributesImpl& rhs)
{
}
}
-MessageBuffer::Iterator::Iterator(const Iterator& copy)
-: mCurrent( copy.mCurrent ),
- mMessageSize( copy.mMessageSize )
-{
-}
+MessageBuffer::Iterator::Iterator(const Iterator& copy) = default;
} // namespace Internal
/**
* Construct the message base.
*/
- MessageBase( )
- {
- }
+ MessageBase() = default;
/**
* Virtual destructor
*/
- virtual ~MessageBase()
- {
- }
+ virtual ~MessageBase() = default;
/**
* Called to process the message.
/**
* Virtual destructor
*/
- ~Message() override
- {
- }
+ ~Message() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue1() override
- {
- }
+ ~MessageValue1() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue2() override
- {
- }
+ ~MessageValue2() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue3() override
- {
- }
+ ~MessageValue3() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue4() override
- {
- }
+ ~MessageValue4() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue5() override
- {
- }
+ ~MessageValue5() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageValue6() override
- {
- }
+ ~MessageValue6() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageDoubleBuffered0() override
- {
- }
+ ~MessageDoubleBuffered0() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageDoubleBuffered1() override
- {
- }
+ ~MessageDoubleBuffered1() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageDoubleBuffered2() override
- {
- }
+ ~MessageDoubleBuffered2() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageDoubleBuffered3() override
- {
- }
+ ~MessageDoubleBuffered3() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~MessageDoubleBuffered4() override
- {
- }
+ ~MessageDoubleBuffered4() override = default;
/**
* @copydoc MessageBase::Process
* Destructor. Protected as no derived class should ever be deleted
* through a reference to this pure abstract interface.
*/
- virtual ~ShaderSaver(){}
+ virtual ~ShaderSaver() = default;
};
} // namespace Internal
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/radian.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/devel-api/common/capabilities.h>
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/internal/event/actors/actor-property-handler.h>
#include <dali/internal/event/actors/actor-relayouter.h>
DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER )
DALI_PROPERTY( "updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT )
DALI_PROPERTY( "captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START )
+DALI_PROPERTY( "touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA )
+DALI_PROPERTY( "blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties )
// Signals
-const char* const SIGNAL_HOVERED = "hovered";
-const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
-const char* const SIGNAL_ON_SCENE = "onScene";
-const char* const SIGNAL_OFF_SCENE = "offScene";
-const char* const SIGNAL_ON_RELAYOUT = "onRelayout";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
-const char* const SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
-const char* const SIGNAL_CHILD_ADDED = "childAdded";
-const char* const SIGNAL_CHILD_REMOVED = "childRemoved";
+static constexpr std::string_view SIGNAL_HOVERED = "hovered";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_ON_SCENE = "onScene";
+static constexpr std::string_view SIGNAL_OFF_SCENE = "offScene";
+static constexpr std::string_view SIGNAL_ON_RELAYOUT = "onRelayout";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
+static constexpr std::string_view SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
+static constexpr std::string_view SIGNAL_CHILD_ADDED = "childAdded";
+static constexpr std::string_view SIGNAL_CHILD_REMOVED = "childRemoved";
// Actions
-const char* const ACTION_SHOW = "show";
-const char* const ACTION_HIDE = "hide";
+static constexpr std::string_view ACTION_SHOW = "show";
+static constexpr std::string_view ACTION_HIDE = "hide";
BaseHandle CreateActor()
{
TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties );
-SignalConnectorType signalConnector2( mType, SIGNAL_HOVERED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector3( mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector8( mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector10( mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector11( mType, SIGNAL_CHILD_REMOVED, &Actor::DoConnectSignal );
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &Actor::DoConnectSignal);
-TypeAction a1( mType, ACTION_SHOW, &Actor::DoAction );
-TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction );
+TypeAction a1(mType, std::string(ACTION_SHOW), &Actor::DoAction);
+TypeAction a2(mType, std::string(ACTION_HIDE), &Actor::DoAction);
/**
* @brief Extract a given dimension from a Vector2
if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( auto& child : actor->GetChildrenInternal() )
{
EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT );
}
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildByName( actorName );
+ child = actor->FindChildByName( actorName );
if( child )
{
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildById( id );
+ child = actor->FindChildById( id );
if( child )
{
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeW, opacity );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
float Actor::GetCurrentOpacity() const
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::Bake, color );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorRed( float red )
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeX, red );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorGreen( float green )
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeY, green );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorBlue( float blue )
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeZ, blue );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
const Vector4& Actor::GetCurrentColor() const
mRenderers = new RendererContainer;
}
+ if(mIsBlendEquationSet)
+ {
+ renderer.SetBlendMode(Dali::BlendMode::ON);
+ renderer.SetBlendEquation(static_cast<DevelBlendEquation::Type>(mBlendEquation));
+ }
+
uint32_t index = static_cast<uint32_t>( mRenderers->size() ); // 4,294,967,295 renderers per actor
RendererPtr rendererPtr = RendererPtr( &renderer );
mRenderers->push_back( rendererPtr );
}
}
+void Actor::SetBlendEquation(DevelBlendEquation::Type blendEquation)
+{
+ if(Dali::Capabilities::IsBlendEquationSupported(blendEquation))
+ {
+ if(mBlendEquation != blendEquation)
+ {
+ mBlendEquation = blendEquation;
+ uint32_t rendererCount = GetRendererCount();
+ for(uint32_t i = 0; i < rendererCount; ++i)
+ {
+ RendererPtr renderer = GetRendererAt(i);
+ renderer->SetBlendMode(Dali::BlendMode::ON);
+ renderer->SetBlendEquation(static_cast<DevelBlendEquation::Type>(blendEquation));
+ }
+ }
+ mIsBlendEquationSet = true;
+ }
+ else
+ {
+ DALI_LOG_ERROR("Invalid blend equation is entered.\n");
+ }
+}
+
+DevelBlendEquation::Type Actor::GetBlendEquation() const
+{
+ return mBlendEquation;
+}
+
void Actor::SetDrawMode( DrawMode::Type drawMode )
{
// this flag is not animatable so keep the value
bool connected( true );
Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_HOVERED ) )
+ std::string_view name(signalName);
+
+ if(name == SIGNAL_HOVERED)
{
actor->HoveredSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) )
+ else if(signalName == SIGNAL_WHEEL_EVENT)
{
actor->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_SCENE ) )
+ else if(name == SIGNAL_ON_SCENE)
{
actor->OnSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_OFF_SCENE ) )
+ else if(name == SIGNAL_OFF_SCENE)
{
actor->OffSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_RELAYOUT ) )
+ else if(name == SIGNAL_ON_RELAYOUT)
{
actor->OnRelayoutSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
actor->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) )
+ else if(name == SIGNAL_VISIBILITY_CHANGED)
{
actor->VisibilityChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_LAYOUT_DIRECTION_CHANGED ) )
+ else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
{
actor->LayoutDirectionChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_ADDED ) )
+ else if(name == SIGNAL_CHILD_ADDED)
{
actor->ChildAddedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_REMOVED ) )
+ else if(name == SIGNAL_CHILD_REMOVED)
{
actor->ChildRemovedSignal().Connect( tracker, functor );
}
mTargetPosition( Vector3::ZERO ),
mTargetScale( Vector3::ONE ),
mAnimatedSize( Vector3::ZERO ),
+ mTouchArea( Vector2::ZERO ),
mName(),
mSortedDepth( 0u ),
mDepth( 0u ),
mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ),
mDrawMode( DrawMode::NORMAL ),
mColorMode( Node::DEFAULT_COLOR_MODE ),
- mClippingMode( ClippingMode::DISABLED )
+ mClippingMode( ClippingMode::DISABLED ),
+ mBlendEquation( DevelBlendEquation::ADD ),
+ mIsBlendEquationSet( false )
{
}
// to guard against GetParent() & Unparent() calls from CustomActor destructors.
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetParent( nullptr );
+ actor->SetParent( nullptr );
}
}
delete mChildren;
RecursiveConnectToScene( connectionList, parentDepth + 1 );
// Notify applications about the newly connected actors.
- const ActorIter endIter = connectionList.end();
- for( ActorIter iter = connectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : connectionList )
{
- (*iter)->NotifyStageConnection();
+ actor->NotifyStageConnection();
}
RelayoutRequest();
// Recursively connect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetScene( *mScene );
- (*iter)->RecursiveConnectToScene( connectionList, depth + 1 );
+ actor->SetScene( *mScene );
+ actor->RecursiveConnectToScene( connectionList, depth + 1 );
}
}
}
RecursiveDisconnectFromStage( disconnectionList );
// Notify applications about the newly disconnected actors.
- const ActorIter endIter = disconnectionList.end();
- for( ActorIter iter = disconnectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : disconnectionList )
{
- (*iter)->NotifyStageDisconnection();
+ actor->NotifyStageDisconnection();
}
}
// Recursively disconnect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& child : *mChildren )
{
- (*iter)->RecursiveDisconnectFromStage( disconnectionList );
+ child->RecursiveDisconnectFromStage( disconnectionList );
}
}
// Create/add to children of this node
if( mChildren )
{
- for( ActorContainer::iterator it = mChildren->begin(); it != mChildren->end(); ++it )
+ for( const auto& child : *mChildren )
{
- Actor* childActor = (*it).Get();
+ Actor* childActor = child.Get();
++depthIndex;
childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
}
if( actor )
{
- if( 0 == actionName.compare( ACTION_SHOW ) )
+ std::string_view name(actionName);
+ if(name == ACTION_SHOW)
{
actor->SetVisible( true );
done = true;
}
- else if( 0 == actionName.compare( ACTION_HIDE ) )
+ else if(name == ACTION_HIDE)
{
actor->SetVisible( false );
done = true;
// Check that we havn't gotten into an infinite loop
ActorDimensionPair searchActor = ActorDimensionPair( this, dimension );
bool recursionFound = false;
- for( ActorDimensionStack::iterator it = recursionStack.begin(), itEnd = recursionStack.end(); it != itEnd; ++it )
+ for( auto& element : recursionStack )
{
- if( *it == searchActor )
+ if( element == searchActor )
{
recursionFound = true;
break;
{
// node is being used in a separate thread; queue a message to set the value & base value
SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty<bool>::Bake, visible );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
mVisible = visible;
ActorContainer& siblings = *(mParent->mChildren);
if( siblings.back() != this ) // If not already at end
{
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter < targetIter )
{
siblings.erase(thisIter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter > targetIter )
{
if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( const auto& child : actor->GetChildrenInternal() )
{
InheritLayoutDirectionRecursively( child, direction );
}
*/
void RemoveRenderer( uint32_t index );
+ /**
+ * Set BlendEquation at each renderer that added on this Actor.
+ */
+ void SetBlendEquation( DevelBlendEquation::Type blendEquation );
+
+ /**
+ * @brief Get Blend Equation that applied to this Actor
+ */
+ DevelBlendEquation::Type GetBlendEquation() const;
+
public:
/**
return mCaptureAllTouchAfterStart;
}
+ /**
+ * Sets the touch area of an actor.
+ * @param [in] area The new area.
+ */
+ void SetTouchArea(Vector2 area)
+ {
+ mTouchArea = area;
+ }
+
+ /**
+ * Retrieve the Actor's touch area.
+ * @return The Actor's touch area.
+ */
+ const Vector2& GetTouchArea() const
+ {
+ return mTouchArea;
+ }
+
+
// Gestures
/**
Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
Vector3 mTargetScale; ///< Event-side storage for scale
Vector3 mAnimatedSize; ///< Event-side storage for size animation
+ Vector2 mTouchArea; ///< touch area
std::string mName; ///< Name of the actor
uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
+ DevelBlendEquation::Type mBlendEquation : 16;///< Cached: Determines which blend equation will be used to render renderers.
+ bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
private:
break;
}
+ case Dali::DevelActor::Property::TOUCH_AREA:
+ {
+ Vector2 vec2Value;
+ if( property.Get( vec2Value ) )
+ {
+ actor.SetTouchArea( vec2Value );
+ }
+ break;
+ }
+
+ case Dali::DevelActor::Property::BLEND_EQUATION:
+ {
+ int value;
+ if( property.Get( value ) )
+ {
+ actor.SetBlendEquation( static_cast<DevelBlendEquation::Type>( value ) );
+ }
+ break;
+ }
+
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
break;
}
+ case Dali::DevelActor::Property::TOUCH_AREA:
+ {
+ value = actor.GetTouchArea();
+ break;
+ }
+
+ case Dali::DevelActor::Property::BLEND_EQUATION:
+ {
+ value = actor.GetBlendEquation();
+ break;
+ }
+
default:
{
// Must be a scene-graph only property
SetRelayoutEnabled( extension.IsRelayoutEnabled() );
}
-CustomActor::~CustomActor()
-{
-}
+CustomActor::~CustomActor() = default;
Dali::TypeInfo CustomActor::GetTypeInfo()
{
// Actions
-const char* const ACTION_RAISE = "raise";
-const char* const ACTION_LOWER = "lower";
-const char* const ACTION_RAISE_TO_TOP = "raiseToTop";
-const char* const ACTION_LOWER_TO_BOTTOM = "lowerToBottom";
+static constexpr std::string_view ACTION_RAISE = "raise";
+static constexpr std::string_view ACTION_LOWER = "lower";
+static constexpr std::string_view ACTION_RAISE_TO_TOP = "raiseToTop";
+static constexpr std::string_view ACTION_LOWER_TO_BOTTOM = "lowerToBottom";
BaseHandle Create()
{
TypeRegistration mType( typeid( Dali::Layer ), typeid( Dali::Actor ), Create, LayerDefaultProperties );
-TypeAction a1( mType, ACTION_RAISE, &Layer::DoAction );
-TypeAction a2( mType, ACTION_LOWER, &Layer::DoAction );
-TypeAction a3( mType, ACTION_RAISE_TO_TOP, &Layer::DoAction );
-TypeAction a4( mType, ACTION_LOWER_TO_BOTTOM, &Layer::DoAction );
+TypeAction a1(mType, std::string(ACTION_RAISE), &Layer::DoAction);
+TypeAction a2(mType, std::string(ACTION_LOWER), &Layer::DoAction);
+TypeAction a3(mType, std::string(ACTION_RAISE_TO_TOP), &Layer::DoAction);
+TypeAction a4(mType, std::string(ACTION_LOWER_TO_BOTTOM), &Layer::DoAction);
} // unnamed namespace
if( layer )
{
- if( 0 == actionName.compare( ACTION_RAISE ) )
+ std::string_view name(actionName);
+
+ if(name == ACTION_RAISE)
{
layer->Raise();
done = true;
}
- else if( 0 == actionName.compare( ACTION_LOWER ) )
+ else if(name == ACTION_LOWER)
{
layer->Lower();
done = true;
}
- else if( 0 == actionName.compare( ACTION_RAISE_TO_TOP ) )
+ else if(name == ACTION_RAISE_TO_TOP)
{
layer->RaiseToTop();
done = true;
}
- else if( 0 == actionName.compare( ACTION_LOWER_TO_BOTTOM ) )
+ else if(name == ACTION_LOWER_TO_BOTTOM)
{
layer->LowerToBottom();
done = true;
return new LayerList( updateManager );
}
-LayerList::~LayerList()
-{
-}
+LayerList::~LayerList() = default;
uint32_t LayerList::GetLayerCount() const
{
// Signals
-const char* const SIGNAL_FINISHED = "finished";
+static constexpr std::string_view SIGNAL_FINISHED = "finished";
// Actions
-const char* const ACTION_PLAY = "play";
-const char* const ACTION_STOP = "stop";
-const char* const ACTION_PAUSE = "pause";
+static constexpr std::string_view ACTION_PLAY = "play";
+static constexpr std::string_view ACTION_STOP = "stop";
+static constexpr std::string_view ACTION_PAUSE = "pause";
BaseHandle Create()
{
TypeRegistration mType( typeid( Dali::Animation ), typeid( Dali::BaseHandle ), Create );
-SignalConnectorType signalConnector1( mType, SIGNAL_FINISHED, &Animation::DoConnectSignal );
+SignalConnectorType signalConnector1(mType, std::string(SIGNAL_FINISHED), &Animation::DoConnectSignal);
-TypeAction action1( mType, ACTION_PLAY, &Animation::DoAction );
-TypeAction action2( mType, ACTION_STOP, &Animation::DoAction );
-TypeAction action3( mType, ACTION_PAUSE, &Animation::DoAction );
+TypeAction action1(mType, std::string(ACTION_PLAY), &Animation::DoAction);
+TypeAction action2(mType, std::string(ACTION_STOP), &Animation::DoAction);
+TypeAction action3(mType, std::string(ACTION_PAUSE), &Animation::DoAction);
const Dali::Animation::EndAction DEFAULT_END_ACTION( Dali::Animation::BAKE );
const Dali::Animation::EndAction DEFAULT_DISCONNECT_ACTION( Dali::Animation::BAKE_FINAL );
} // anonymous namespace
-
AnimationPtr Animation::New(float durationSeconds)
{
if( durationSeconds < 0.0f )
return animation;
}
-Animation::Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha )
-: mAnimation( nullptr ),
- mEventThreadServices( eventThreadServices ),
- mPlaylist( playlist ),
- mFinishedSignal(),
- mConnectors(),
- mConnectorTargetValues(),
- mPlayRange( Vector2(0.0f,1.0f)),
- mDurationSeconds( durationSeconds ),
- mSpeedFactor(1.0f),
- mNotificationCount( 0 ),
- mLoopCount(1),
- mCurrentLoop(0),
- mEndAction( endAction ),
- mDisconnectAction( disconnectAction ),
- mDefaultAlpha( defaultAlpha ),
- mState(Dali::Animation::STOPPED),
- mProgressReachedMarker( 0.0f ),
- mDelaySeconds( 0.0f ),
- mAutoReverseEnabled( false )
+Animation::Animation(EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha)
+: mEventThreadServices(eventThreadServices),
+ mPlaylist(playlist),
+ mDefaultAlpha(defaultAlpha),
+ mDurationSeconds(durationSeconds),
+ mEndAction(endAction),
+ mDisconnectAction(disconnectAction)
{
}
{
case Property::BOOLEAN:
{
- AddAnimatorConnector( AnimatorConnector<bool>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByBoolean(relativeValue.Get<bool>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<bool>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByBoolean(relativeValue.Get<bool>()),
+ alpha,
+ period));
break;
}
case Property::INTEGER:
{
- AddAnimatorConnector( AnimatorConnector<int32_t>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByInteger(relativeValue.Get<int32_t>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<int32_t>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByInteger(relativeValue.Get<int32_t>()),
+ alpha,
+ period));
break;
}
case Property::FLOAT:
{
- AddAnimatorConnector( AnimatorConnector<float>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByFloat(relativeValue.Get<float>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<float>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByFloat(relativeValue.Get<float>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR2:
{
- AddAnimatorConnector( AnimatorConnector<Vector2>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByVector2(relativeValue.Get<Vector2>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector2>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByVector2(relativeValue.Get<Vector2>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR3:
{
- AddAnimatorConnector( AnimatorConnector<Vector3>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByVector3(relativeValue.Get<Vector3>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector3>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByVector3(relativeValue.Get<Vector3>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR4:
{
- AddAnimatorConnector( AnimatorConnector<Vector4>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateByVector4(relativeValue.Get<Vector4>()),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector4>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateByVector4(relativeValue.Get<Vector4>()),
+ alpha,
+ period));
break;
}
{
AngleAxis angleAxis = relativeValue.Get<AngleAxis>();
- AddAnimatorConnector( AnimatorConnector<Quaternion>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new RotateByAngleAxis(angleAxis.angle, angleAxis.axis),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Quaternion>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ RotateByAngleAxis(angleAxis.angle, angleAxis.axis),
+ alpha,
+ period));
break;
}
{
case Property::BOOLEAN:
{
- AddAnimatorConnector( AnimatorConnector<bool>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToBoolean( destinationValue.Get<bool>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<bool>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToBoolean(destinationValue.Get<bool>()),
+ alpha,
+ period));
break;
}
case Property::INTEGER:
{
- AddAnimatorConnector( AnimatorConnector<int32_t>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToInteger( destinationValue.Get<int32_t>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<int32_t>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToInteger(destinationValue.Get<int32_t>()),
+ alpha,
+ period));
break;
}
case Property::FLOAT:
{
- AddAnimatorConnector( AnimatorConnector<float>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToFloat( destinationValue.Get<float>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<float>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToFloat(destinationValue.Get<float>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR2:
{
- AddAnimatorConnector( AnimatorConnector<Vector2>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToVector2( destinationValue.Get<Vector2>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector2>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToVector2(destinationValue.Get<Vector2>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR3:
{
- AddAnimatorConnector( AnimatorConnector<Vector3>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToVector3( destinationValue.Get<Vector3>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector3>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToVector3(destinationValue.Get<Vector3>()),
+ alpha,
+ period));
break;
}
case Property::VECTOR4:
{
- AddAnimatorConnector( AnimatorConnector<Vector4>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new AnimateToVector4( destinationValue.Get<Vector4>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector4>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ AnimateToVector4(destinationValue.Get<Vector4>()),
+ alpha,
+ period));
break;
}
case Property::ROTATION:
{
- AddAnimatorConnector( AnimatorConnector<Quaternion>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new RotateToQuaternion( destinationValue.Get<Quaternion>() ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Quaternion>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ RotateToQuaternion(destinationValue.Get<Quaternion>()),
+ alpha,
+ period));
break;
}
{
case Dali::Property::BOOLEAN:
{
- const KeyFrameBoolean* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameBooleanPtr kfCopy = KeyFrameBoolean::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<bool>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameBooleanFunctor(kfCopy),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameBoolean*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<bool>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameBooleanFunctor(*kf), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::INTEGER:
{
- const KeyFrameInteger* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameIntegerPtr kfCopy = KeyFrameInteger::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<int32_t>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameIntegerFunctor(kfCopy,interpolation),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameInteger*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<int32_t>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameIntegerFunctor(*kf, interpolation), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::FLOAT:
{
- const KeyFrameNumber* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameNumberPtr kfCopy = KeyFrameNumber::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<float>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameNumberFunctor(kfCopy,interpolation),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameNumber*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<float>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameNumberFunctor(*kf, interpolation), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::VECTOR2:
{
- const KeyFrameVector2* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameVector2Ptr kfCopy = KeyFrameVector2::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<Vector2>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameVector2Functor(kfCopy,interpolation),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameVector2*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<Vector2>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameVector2Functor(*kf, interpolation), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::VECTOR3:
{
- const KeyFrameVector3* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameVector3Ptr kfCopy = KeyFrameVector3::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<Vector3>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameVector3Functor(kfCopy,interpolation),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameVector3*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<Vector3>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameVector3Functor(*kf, interpolation), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::VECTOR4:
{
- const KeyFrameVector4* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameVector4Ptr kfCopy = KeyFrameVector4::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<Vector4>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameVector4Functor(kfCopy,interpolation),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameVector4*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<Vector4>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameVector4Functor(*kf, interpolation), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
case Dali::Property::ROTATION:
{
- const KeyFrameQuaternion* kf;
- GetSpecialization(keyFrames, kf);
- KeyFrameQuaternionPtr kfCopy = KeyFrameQuaternion::Clone(*kf);
- AddAnimatorConnector( AnimatorConnector<Quaternion>::New( object,
- target.propertyIndex,
- target.componentIndex,
- new KeyFrameQuaternionFunctor(kfCopy),
- alpha,
- period ) );
+ auto kf = GetSpecialization<const KeyFrameQuaternion*>(keyFrames);
+ AddAnimatorConnector(AnimatorConnector<Quaternion>::New(object,
+ target.propertyIndex,
+ target.componentIndex,
+ KeyFrameQuaternionFunctor(*kf), // takes a copy of the keyframe
+ alpha,
+ period));
break;
}
bool connected( false );
Animation* animation = static_cast< Animation* >(object); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_FINISHED ) )
+ if(SIGNAL_FINISHED == signalName)
{
animation->FinishedSignal().Connect( tracker, functor );
connected = true;
PathPtr pathCopy = Path::Clone(path);
//Position animation
- AddAnimatorConnector( AnimatorConnector<Vector3>::New( actor,
- Dali::Actor::Property::POSITION,
- Property::INVALID_COMPONENT_INDEX,
- new PathPositionFunctor( pathCopy ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Vector3>::New(actor,
+ Dali::Actor::Property::POSITION,
+ Property::INVALID_COMPONENT_INDEX,
+ PathPositionFunctor(pathCopy),
+ alpha,
+ period));
//If forward is zero, PathRotationFunctor will always return the unit quaternion
if( forward != Vector3::ZERO )
{
//Rotation animation
- AddAnimatorConnector( AnimatorConnector<Quaternion>::New( actor,
- Dali::Actor::Property::ORIENTATION,
- Property::INVALID_COMPONENT_INDEX,
- new PathRotationFunctor( pathCopy, forward ),
- alpha,
- period ) );
+ AddAnimatorConnector(AnimatorConnector<Quaternion>::New(actor,
+ Dali::Actor::Property::ORIENTATION,
+ Property::INVALID_COMPONENT_INDEX,
+ PathRotationFunctor(pathCopy, forward),
+ alpha,
+ period));
}
}
{
ExtendDuration( TimePeriod(delaySeconds, 0) );
- AddAnimatorConnector( AnimatorConnector<bool>::New( actor,
- Dali::Actor::Property::VISIBLE,
- Property::INVALID_COMPONENT_INDEX,
- new AnimateToBoolean(SHOW_VALUE),
- mDefaultAlpha,
- TimePeriod(delaySeconds, 0.0f/*immediate*/) ) );
+ AddAnimatorConnector(AnimatorConnector<bool>::New(actor,
+ Dali::Actor::Property::VISIBLE,
+ Property::INVALID_COMPONENT_INDEX,
+ AnimateToBoolean(SHOW_VALUE),
+ mDefaultAlpha,
+ TimePeriod(delaySeconds, 0.0f /*immediate*/)));
}
void Animation::Hide(Actor& actor, float delaySeconds)
{
ExtendDuration( TimePeriod(delaySeconds, 0) );
- AddAnimatorConnector( AnimatorConnector<bool>::New( actor,
- Dali::Actor::Property::VISIBLE,
- Property::INVALID_COMPONENT_INDEX,
- new AnimateToBoolean(HIDE_VALUE),
- mDefaultAlpha,
- TimePeriod(delaySeconds, 0.0f/*immediate*/) ) );
+ AddAnimatorConnector(AnimatorConnector<bool>::New(actor,
+ Dali::Actor::Property::VISIBLE,
+ Property::INVALID_COMPONENT_INDEX,
+ AnimateToBoolean(HIDE_VALUE),
+ mDefaultAlpha,
+ TimePeriod(delaySeconds, 0.0f /*immediate*/)));
}
bool Animation::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
if( animation )
{
- if( 0 == actionName.compare( ACTION_PLAY ) )
+ std::string_view name(actionName);
+
+ if(name == ACTION_PLAY)
{
if( Property::Value* value = attributes.Find("duration", Property::FLOAT) )
{
animation->Play();
done = true;
}
- else if( 0 == actionName.compare( ACTION_STOP ) )
+ else if(name == ACTION_STOP)
{
animation->Stop();
done = true;
}
- else if( 0 == actionName.compare( ACTION_PAUSE ) )
+ else if(name == ACTION_PAUSE)
{
animation->Pause();
done = true;
class Animation : public BaseObject
{
public:
-
- enum Type
+ enum Type : uint8_t
{
- TO, ///< Animating TO the given value
- BY, ///< Animating BY the given value
- BETWEEN ///< Animating BETWEEN key-frames
+ TO, ///< Animating TO the given value
+ BY, ///< Animating BY the given value
+ BETWEEN ///< Animating BETWEEN key-frames
};
using EndAction = Dali::Animation::EndAction;
Animation::Type animatorType{TO};
};
- enum class Notify
+ enum class Notify : uint8_t
{
USE_CURRENT_VALUE, ///< Set the current value for the property
USE_TARGET_VALUE, ///< Set the animator's target value for the property
void SendFinalProgressNotificationMessage();
private:
+ using AnimatorConnectorContainer = OwnerContainer<AnimatorConnectorBase*>;
+ using ConnectorTargetValuesContainer = std::vector<ConnectorTargetValues>;
- const SceneGraph::Animation* mAnimation;
+ const SceneGraph::Animation* mAnimation{ nullptr };
EventThreadServices& mEventThreadServices;
- AnimationPlaylist& mPlaylist;
-
- Dali::Animation::AnimationSignalType mFinishedSignal;
-
- Dali::Animation::AnimationSignalType mProgressReachedSignal;
-
- using AnimatorConnectorContainer = OwnerContainer<AnimatorConnectorBase*>;
- AnimatorConnectorContainer mConnectors; ///< Owned by the Animation
-
- using ConnectorTargetValuesContainer = std::vector<ConnectorTargetValues>;
- ConnectorTargetValuesContainer mConnectorTargetValues; //< Used to store animating property target value information
-
- Vector2 mPlayRange;
-
- float mDurationSeconds;
- float mSpeedFactor;
- int32_t mNotificationCount; ///< Keep track of how many Finished signals have been emitted.
- int32_t mLoopCount;
- int32_t mCurrentLoop;
- EndAction mEndAction;
- EndAction mDisconnectAction;
- AlphaFunction mDefaultAlpha;
- Dali::Animation::State mState;
- float mProgressReachedMarker;
- float mDelaySeconds;
- bool mAutoReverseEnabled; ///< Flag to identify that the looping mode is auto reverse.
+ AnimationPlaylist& mPlaylist;
+
+ Dali::Animation::AnimationSignalType mFinishedSignal{};
+ Dali::Animation::AnimationSignalType mProgressReachedSignal{};
+
+ AnimatorConnectorContainer mConnectors{}; ///< Owned by the Animation
+ ConnectorTargetValuesContainer mConnectorTargetValues{}; //< Used to store animating property target value information
+
+ AlphaFunction mDefaultAlpha;
+ Vector2 mPlayRange{0.0f, 1.0f};
+ float mDurationSeconds;
+ float mSpeedFactor{1.0f};
+ int32_t mNotificationCount{0}; ///< Keep track of how many Finished signals have been emitted.
+ int32_t mLoopCount{1};
+ int32_t mCurrentLoop{0};
+ float mProgressReachedMarker{0.0f};
+ float mDelaySeconds{0.0f};
+ EndAction mEndAction;
+ EndAction mDisconnectAction;
+ Dali::Animation::State mState{Dali::Animation::STOPPED};
+ bool mAutoReverseEnabled{false}; ///< Flag to identify that the looping mode is auto reverse.
};
} // namespace Internal
return new AnimationPlaylist();
}
-AnimationPlaylist::AnimationPlaylist()
-{
-}
+AnimationPlaylist::AnimationPlaylist() = default;
-AnimationPlaylist::~AnimationPlaylist()
-{
-}
+AnimationPlaylist::~AnimationPlaylist() = default;
void AnimationPlaylist::AnimationCreated( Animation& animation )
{
/**
* Constructor.
*/
- AnimatorConnectorBase(
- Object& object,
- Property::Index propertyIndex,
- int32_t componentIndex,
- Internal::AnimatorFunctionBase* animatorFunction,
- AlphaFunction alpha,
- const TimePeriod& period)
- : mParent( nullptr ),
- mObject( &object ),
- mAnimator( nullptr ),
- mAnimatorFunction( animatorFunction ),
+ AnimatorConnectorBase(Object& object,
+ Property::Index propertyIndex,
+ int32_t componentIndex,
+ AlphaFunction alpha,
+ const TimePeriod& period)
+ : mObject(&object),
mAlphaFunction(alpha),
mTimePeriod(period),
- mPropertyIndex( propertyIndex ),
- mComponentIndex( componentIndex )
+ mPropertyIndex(propertyIndex),
+ mComponentIndex(componentIndex)
{
object.AddObserver( *this );
}
{
mObject->RemoveObserver( *this );
}
-
- // If there is not a SceneGraph::Animator, the AnimatorConnector is responsible for deleting the mAnimatorFunction
- // otherwise, the animator function ownership is transferred to the SceneGraph::Animator
- if( !mAnimator )
- {
- delete mAnimatorFunction;
- }
}
/**
void CreateAnimator()
{
DALI_ASSERT_DEBUG( mAnimator == nullptr );
- DALI_ASSERT_DEBUG( mAnimatorFunction != nullptr );
DALI_ASSERT_DEBUG( mParent != nullptr );
//Get the PropertyOwner the animator is going to animate
}
protected:
-
- Animation* mParent; ///< The parent owns the connector.
- Object* mObject; ///< Not owned by the animator connector. Valid until ObjectDestroyed() is called.
- SceneGraph::AnimatorBase* mAnimator;
- Internal::AnimatorFunctionBase* mAnimatorFunction; ///< Owned by the animator connector until an Scenegraph::Animator is created
+ Animation* mParent{nullptr}; ///< The parent owns the connector.
+ Object* mObject; ///< Not owned by the animator connector. Valid until ObjectDestroyed() is called.
+ SceneGraph::AnimatorBase* mAnimator{nullptr};
AlphaFunction mAlphaFunction;
- TimePeriod mTimePeriod;
+ TimePeriod mTimePeriod;
Property::Index mPropertyIndex;
- int32_t mComponentIndex;
-
+ int32_t mComponentIndex;
};
} // namespace Internal
*
*/
+//EXTERNAL INCLUDES
+#include <functional>
+
// INTERNAL INCLUDES
#include <dali/internal/event/animation/animator-connector-base.h>
#include <dali/internal/event/animation/animation-impl.h>
template < typename PropertyType >
class AnimatorConnector : public AnimatorConnectorBase
{
+ using AnimatorFunction = std::function<PropertyType(float, const PropertyType&)>;
+
+ AnimatorFunction mAnimatorFunction;
+
public:
using AnimatorType = SceneGraph::Animator< PropertyType, PropertyAccessor<PropertyType> >;
* @param[in] period The time period of the animator.
* @return A pointer to a newly allocated animator connector.
*/
- static AnimatorConnectorBase* New( Object& object,
- Property::Index propertyIndex,
- int32_t componentIndex,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alpha,
- const TimePeriod& period )
+ static AnimatorConnectorBase* New(Object& object,
+ Property::Index propertyIndex,
+ int32_t componentIndex,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alpha,
+ const TimePeriod& period)
{
- return new AnimatorConnector( object,
- propertyIndex,
- componentIndex,
- animatorFunction,
- alpha,
- period );
+ return new AnimatorConnector(object,
+ propertyIndex,
+ componentIndex,
+ std::move(animatorFunction),
+ alpha,
+ period);
}
/**
* Virtual destructor.
*/
- ~AnimatorConnector() override
- {
- }
+ ~AnimatorConnector() override = default;
private:
/**
* Private constructor; see also AnimatorConnector::New().
*/
- AnimatorConnector( Object& object,
- Property::Index propertyIndex,
- int32_t componentIndex,
- Internal::AnimatorFunctionBase* animatorFunction,
- AlphaFunction alpha,
- const TimePeriod& period )
- : AnimatorConnectorBase( object, propertyIndex, componentIndex, animatorFunction, alpha, period )
+ AnimatorConnector(Object& object,
+ Property::Index propertyIndex,
+ int32_t componentIndex,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alpha,
+ const TimePeriod& period)
+ : AnimatorConnectorBase(object, propertyIndex, componentIndex, alpha, period),
+ mAnimatorFunction(std::move(animatorFunction))
{
}
{
if( baseProperty.IsTransformManagerProperty() )
{
- mAnimator = SceneGraph::AnimatorTransformProperty< PropertyType,TransformManagerPropertyAccessor<PropertyType> >::New( propertyOwner, baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+ mAnimator = SceneGraph::AnimatorTransformProperty<PropertyType, TransformManagerPropertyAccessor<PropertyType> >::New(propertyOwner,
+ baseProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
// Don't reset transform manager properties - TransformManager will do it more efficiently
}
else
else
{
// Create the animator and resetter
- mAnimator = AnimatorType::New( propertyOwner, *animatableProperty, mAnimatorFunction,
- mAlphaFunction, mTimePeriod );
+ mAnimator = AnimatorType::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
+
resetterRequired = true;
}
return resetterRequired;
template <>
class AnimatorConnector< float > : public AnimatorConnectorBase
{
+ using AnimatorFunction = std::function<float(float, const float&)>;
+
+ AnimatorFunction mAnimatorFunction;
+
public:
using AnimatorType = SceneGraph::Animator< float, PropertyAccessor<float> >;
* @param[in] period The time period of the animator.
* @return A pointer to a newly allocated animator connector.
*/
- static AnimatorConnectorBase* New( Object& object,
- Property::Index propertyIndex,
- int32_t componentIndex,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alpha,
- const TimePeriod& period )
+ static AnimatorConnectorBase* New(Object& object,
+ Property::Index propertyIndex,
+ int32_t componentIndex,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alpha,
+ const TimePeriod& period)
{
- return new AnimatorConnector( object,
- propertyIndex,
- componentIndex,
- animatorFunction,
- alpha,
- period );
+ return new AnimatorConnector(object,
+ propertyIndex,
+ componentIndex,
+ std::move(animatorFunction),
+ alpha,
+ period);
}
/**
* Virtual destructor.
*/
- ~AnimatorConnector() override
- {
- }
+ ~AnimatorConnector() override = default;
private:
/**
* Private constructor; see also AnimatorConnector::New().
*/
- AnimatorConnector( Object& object,
- Property::Index propertyIndex,
- int32_t componentIndex,
- Internal::AnimatorFunctionBase* animatorFunction,
- AlphaFunction alpha,
- const TimePeriod& period )
- : AnimatorConnectorBase( object, propertyIndex, componentIndex, animatorFunction, alpha, period )
+ AnimatorConnector(Object& object,
+ Property::Index propertyIndex,
+ int32_t componentIndex,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alpha,
+ const TimePeriod& period)
+ : AnimatorConnectorBase(object, propertyIndex, componentIndex, alpha, period),
+ mAnimatorFunction(std::move(animatorFunction))
{
}
{
if( baseProperty.IsTransformManagerProperty() )
{
- mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyAccessor<float> >::New( propertyOwner, baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+ mAnimator = SceneGraph::AnimatorTransformProperty<float, TransformManagerPropertyAccessor<float> >::New(propertyOwner,
+ baseProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
// Don't reset transform manager properties - TransformManager will do it more efficiently
}
else
else
{
// Create the animator and resetter
- mAnimator = AnimatorType::New( propertyOwner, *animatableProperty, mAnimatorFunction,
- mAlphaFunction, mTimePeriod );
+ mAnimator = AnimatorType::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
+
resetterRequired = true;
}
}
{
case 0:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector2> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorX<Vector2> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 1:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector2> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorY<Vector2> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
default:
{
if( mComponentIndex == 0 )
{
- mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,0> >::New( propertyOwner, baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+ mAnimator = SceneGraph::AnimatorTransformProperty<float, TransformManagerPropertyComponentAccessor<Vector3, 0> >::New(propertyOwner,
+ baseProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
}
else if( mComponentIndex == 1 )
{
- mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,1> >::New( propertyOwner, baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+ mAnimator = SceneGraph::AnimatorTransformProperty<float, TransformManagerPropertyComponentAccessor<Vector3, 1> >::New(propertyOwner,
+ baseProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
}
else if( mComponentIndex == 2 )
{
- mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,2> >::New( propertyOwner, baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+ mAnimator = SceneGraph::AnimatorTransformProperty<float, TransformManagerPropertyComponentAccessor<Vector3, 2> >::New(propertyOwner,
+ baseProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
}
}
else
{
case 0:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector3> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorX<Vector3> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 1:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector3> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorY<Vector3> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 2:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector3> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorZ<Vector3> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
default:
{
case 0:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector4> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorX<Vector4> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 1:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector4> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorY<Vector4> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 2:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector4> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorZ<Vector4> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
case 3:
{
- mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorW<Vector4> >::New( propertyOwner,
- *animatableProperty,
- mAnimatorFunction,
- mAlphaFunction,
- mTimePeriod );
+ mAnimator = SceneGraph::Animator<float, PropertyComponentAccessorW<Vector4> >::New(propertyOwner,
+ *animatableProperty,
+ std::move(mAnimatorFunction),
+ mAlphaFunction,
+ mTimePeriod);
break;
}
*
*/
+// EXTERNAL INCLUDES
+#include <algorithm>
+
// INTERNAL INCLUDES
#include <dali/internal/event/animation/progress-value.h>
#include <dali/public-api/animation/animation.h>
{
namespace Internal
{
-
-class KeyFrameChannelBase
-{
-public:
- enum KeyFrameChannelId
- {
- Translate, Rotate, Scale,
- };
-
- KeyFrameChannelBase(KeyFrameChannelId channel_id)
- : mChannelId(channel_id)
- {
- }
-
- virtual ~KeyFrameChannelBase()
- {
- }
-
- KeyFrameChannelId GetId() const
- {
- return mChannelId;
- }
-
- virtual bool IsActive(float progress) = 0;
-
-protected:
- KeyFrameChannelId mChannelId;
-};
-
-
-template <typename V>
-class KeyFrameChannel : public KeyFrameChannelBase
+template<typename V>
+struct KeyFrameChannel
{
-public:
- using ProgressValues = std::vector<ProgressValue<V> >;
-
- KeyFrameChannel(KeyFrameChannelId channel_id, ProgressValues& values )
- : KeyFrameChannelBase(channel_id),
- mValues(values)
- {
- }
-
-
- ~KeyFrameChannel() override
- {
- }
-
- bool IsActive (float progress) override;
-
- V GetValue(float progress, Dali::Animation::Interpolation interpolation) const;
-
- bool FindInterval(typename ProgressValues::iterator& start,
- typename ProgressValues::iterator& end,
- float progress) const;
-
- ProgressValues& mValues;
-};
+ using ProgressValues = std::vector<ProgressValue<V>>;
-template <class V>
-bool KeyFrameChannel<V>::IsActive (float progress)
-{
- bool active = false;
- if(!mValues.empty())
+ bool IsActive(float progress) const
{
- ProgressValue<V>& first = mValues.front();
-
- if( progress >= first.GetProgress() )
+ if(!mValues.empty() && (progress >= mValues[0].GetProgress()))
{
- active = true;
+ return true;
}
+ return false;
}
- return active;
-}
-
-/**
- * Use a linear search to find the interval containing progress
- */
-template <class V>
-bool KeyFrameChannel<V>::FindInterval(
- typename ProgressValues::iterator& start,
- typename ProgressValues::iterator& end,
- float progress) const
-{
- bool found = false;
- typename std::vector<ProgressValue<V> >::iterator iter = mValues.begin();
- typename std::vector<ProgressValue<V> >::iterator prevIter = iter;
-
- while(iter != mValues.end() && iter->GetProgress() <= progress)
- {
- prevIter = iter;
- ++iter;
- }
-
- if(iter == mValues.end())
- {
- --prevIter;
- --iter;
- }
-
- if(prevIter->GetProgress() <= progress
- &&
- iter->GetProgress() > progress)
- {
- found = true;
- start = prevIter;
- end = iter;
- }
-
- return found;
-}
-template <class V>
-V KeyFrameChannel<V>::GetValue (float progress, Dali::Animation::Interpolation interpolation) const
-{
- ProgressValue<V>& firstPV = mValues.front();
-
- typename std::vector<ProgressValue<V> >::iterator start;
- typename std::vector<ProgressValue<V> >::iterator end;
-
- V interpolatedV = firstPV.GetValue();
- if(progress >= mValues.back().GetProgress() )
- {
- interpolatedV = mValues.back().GetValue(); // This should probably be last value...
- }
- else if(FindInterval(start, end, progress))
+ V GetValue(float progress, Dali::Animation::Interpolation interpolation) const
{
- float frameProgress = (progress - start->GetProgress()) / (end->GetProgress() - start->GetProgress());
+ V interpolatedV{};
- if( interpolation == Dali::Animation::LINEAR )
+ if(progress >= mValues.back().GetProgress())
{
- Interpolate(interpolatedV, start->GetValue(), end->GetValue(), frameProgress);
+ interpolatedV = mValues.back().GetValue();
}
else
{
- //Calculate prev and next values
- V prev;
- if( start != mValues.begin() )
- {
- prev = (start-1)->GetValue();
- }
- else
- {
- //Project next value through start point
- prev = start->GetValue() + (start->GetValue()-(start+1)->GetValue());
- }
+ auto end = std::find_if(mValues.begin(), mValues.end(), [=](const auto& element) { return element.GetProgress() > progress; });
+ auto start = end - 1;
- V next;
- if( end != mValues.end()-1)
- {
- next = (end+1)->GetValue();
- }
- else
+ const bool validInterval = (end != mValues.end()) && (start->GetProgress() <= progress);
+
+ if(validInterval)
{
- //Project prev value through end point
- next = end->GetValue() + (end->GetValue()-(end-1)->GetValue());
+ float frameProgress = (progress - start->GetProgress()) / (end->GetProgress() - start->GetProgress());
+ if(interpolation == Dali::Animation::LINEAR)
+ {
+ Interpolate(interpolatedV, start->GetValue(), end->GetValue(), frameProgress);
+ }
+ else
+ {
+ //Calculate prev and next values
+ V prev;
+ if(start != mValues.begin())
+ {
+ prev = (start - 1)->GetValue();
+ }
+ else
+ {
+ //Project next value through start point
+ prev = start->GetValue() + (start->GetValue() - (start + 1)->GetValue());
+ }
+
+ V next;
+ if(end != mValues.end() - 1)
+ {
+ next = (end + 1)->GetValue();
+ }
+ else
+ {
+ //Project prev value through end point
+ next = end->GetValue() + (end->GetValue() - (end - 1)->GetValue());
+ }
+
+ CubicInterpolate(interpolatedV, prev, start->GetValue(), end->GetValue(), next, frameProgress);
+ }
}
-
- CubicInterpolate(interpolatedV, prev, start->GetValue(), end->GetValue(), next, frameProgress);
}
+ return interpolatedV;
}
- return interpolatedV;
-}
-
-using KeyFrameChannelNumber = KeyFrameChannel<float>;
-using KeyFrameChannelVector2 = KeyFrameChannel<Vector2>;
-using KeyFrameChannelVector3 = KeyFrameChannel<Vector3>;
-using KeyFrameChannelVector4 = KeyFrameChannel<Vector4>;
-using KeyFrameChannelQuaternion = KeyFrameChannel<Quaternion>;
-using KeyFrameChannelAngleAxis = KeyFrameChannel<AngleAxis>;
+ ProgressValues mValues;
+};
} // Internal
} // namespace Dali
return new KeyFrames();
}
-KeyFrames::KeyFrames()
- : mType(Property::NONE),
- mKeyFrames(nullptr)
-{
-}
-
-KeyFrames::~KeyFrames()
-{
-}
-
-
void KeyFrames::CreateKeyFramesSpec(Property::Type type)
{
mType = type;
{
case Property::BOOLEAN:
{
- mKeyFrames = Internal::KeyFrameBoolean::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameBoolean>();
break;
}
case Property::INTEGER:
{
- mKeyFrames = Internal::KeyFrameInteger::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameInteger>();
break;
}
case Property::FLOAT:
{
- mKeyFrames = Internal::KeyFrameNumber::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameNumber>();
break;
}
case Property::VECTOR2:
{
- mKeyFrames = Internal::KeyFrameVector2::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameVector2>();
break;
}
case Property::VECTOR3:
{
- mKeyFrames = Internal::KeyFrameVector3::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameVector3>();
break;
}
case Property::VECTOR4:
{
- mKeyFrames = Internal::KeyFrameVector4::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameVector4>();
break;
}
case Property::ROTATION:
{
- mKeyFrames = Internal::KeyFrameQuaternion::New();
+ mKeyFrames = std::make_unique<Internal::KeyFrameQuaternion>();
break;
}
default:
return mType;
}
-void KeyFrames::Add(float time, Property::Value value, AlphaFunction alpha)
+void KeyFrames::Add(float time, const Property::Value& value, AlphaFunction alpha)
{
if(mType == Property::NONE)
{
// Once we have created a type, can only add values of the same type
DALI_ASSERT_ALWAYS( mType == value.GetType() && "Can only add values of the same type to a KeyFrame" );
- DALI_ASSERT_DEBUG(mKeyFrames);
+ auto keyframes = mKeyFrames.get();
+
+ DALI_ASSERT_DEBUG(keyframes);
switch(mType)
{
case Property::BOOLEAN:
{
- Internal::KeyFrameBoolean* kf = static_cast<Internal::KeyFrameBoolean*>(mKeyFrames.Get());
+ Internal::KeyFrameBoolean* kf = static_cast<Internal::KeyFrameBoolean*>(keyframes);
kf->AddKeyFrame(time, value.Get<bool>(), alpha);
break;
}
case Property::INTEGER:
{
- Internal::KeyFrameInteger* kf = static_cast<Internal::KeyFrameInteger*>(mKeyFrames.Get());
+ Internal::KeyFrameInteger* kf = static_cast<Internal::KeyFrameInteger*>(keyframes);
kf->AddKeyFrame(time, value.Get<int>(), alpha);
break;
}
case Property::FLOAT:
{
- Internal::KeyFrameNumber* kf = static_cast<Internal::KeyFrameNumber*>(mKeyFrames.Get());
+ Internal::KeyFrameNumber* kf = static_cast<Internal::KeyFrameNumber*>(keyframes);
kf->AddKeyFrame(time, value.Get<float>(), alpha);
break;
}
case Property::VECTOR2:
{
- Internal::KeyFrameVector2* kf = static_cast<Internal::KeyFrameVector2*>(mKeyFrames.Get());
+ Internal::KeyFrameVector2* kf = static_cast<Internal::KeyFrameVector2*>(keyframes);
kf->AddKeyFrame(time, value.Get<Vector2>(), alpha);
break;
}
case Property::VECTOR3:
{
- Internal::KeyFrameVector3* kf = static_cast<Internal::KeyFrameVector3*>(mKeyFrames.Get());
+ Internal::KeyFrameVector3* kf = static_cast<Internal::KeyFrameVector3*>(keyframes);
kf->AddKeyFrame(time, value.Get<Vector3>(), alpha);
break;
}
case Property::VECTOR4:
{
- Internal::KeyFrameVector4* kf = static_cast<Internal::KeyFrameVector4*>(mKeyFrames.Get());
+ Internal::KeyFrameVector4* kf = static_cast<Internal::KeyFrameVector4*>(keyframes);
kf->AddKeyFrame(time, value.Get<Vector4>(), alpha);
break;
}
case Property::ROTATION:
{
- Internal::KeyFrameQuaternion* kf = static_cast<Internal::KeyFrameQuaternion*>(mKeyFrames.Get());
+ Internal::KeyFrameQuaternion* kf = static_cast<Internal::KeyFrameQuaternion*>(keyframes);
kf->AddKeyFrame(time, value.Get<Quaternion>(), alpha);
break;
}
KeyFrameSpec* KeyFrames::GetKeyFramesBase() const
{
- return mKeyFrames.Get();
+ return mKeyFrames.get();
}
Property::Value KeyFrames::GetLastKeyFrameValue() const
*
*/
+// EXTERNAL INCLUDES
+#include <memory>
+
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/animation/key-frames.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/animation/alpha-function.h>
-#include <dali/internal/event/animation/progress-value.h>
#include <dali/internal/event/animation/key-frame-channel.h>
namespace Dali
{
class KeyFrameSpec;
class KeyFrames;
-using KeyFramesPtr = IntrusivePtr<KeyFrames>;
/**
* KeyFrames class is responsible for creating and building a specialized KeyFrame class
public:
static KeyFrames* New();
- /**
- * Instantiate an empty KeyFrames object
- */
- KeyFrames();
-
-protected:
- ~KeyFrames() override;
-
private:
- /**
- * Don't allow copy constructor
- */
- KeyFrames(const KeyFrames& rhs);
-
- /**
- * Don't allow copy operator
- */
- KeyFrames& operator=(const KeyFrames& rhs);
/**
* Create a specialization from the given type, and store it to the mSpec
* @param[in] alpha An alpha function to blend between this key frame and the
* next key frame.
*/
- void Add(float time, Property::Value value, AlphaFunction alpha);
+ void Add(float time, const Property::Value& value, AlphaFunction alpha);
/**
* Return the key frames without specialization. The GetSpecialization methods
Dali::Property::Value GetLastKeyFrameValue() const;
private:
- Dali::Property::Type mType; // Type of the specialization
- IntrusivePtr<KeyFrameSpec> mKeyFrames; // Pointer to the specialized key frame object
+ Dali::Property::Type mType{Property::NONE}; // Type of the specialization
+ std::unique_ptr<KeyFrameSpec> mKeyFrames; // Pointer to the specialized key frame object
};
-
/**
* This is the base class for the individual template specializations, allowing a ptr to be
- * stored in the handle object above. It inherits from RefObject to allow smart pointers
- * to be used for the specializations. Note that the derived template class below
- * allows for a copy constructor so that the specialization object can be cloned before
- * being passed to the scene-graph for animation.
+ * stored in the handle object above.
*/
-class KeyFrameSpec : public RefObject
+class KeyFrameSpec
{
public:
-
- KeyFrameSpec() {}
+ virtual ~KeyFrameSpec() = default;
virtual std::size_t GetNumberOfKeyFrames() const = 0;
* @param[out] value The value of the given key frame
*/
virtual void GetKeyFrameAsValue( std::size_t index, Property::Value& value ) = 0;
-
-protected:
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- ~KeyFrameSpec() override {}
};
-
/**
- * The base template class for each key frame specialization. It stores a vector of
- * ProgressValue pairs in mPVs, and uses the existing interface for KeyFrameChannel
- * to point at this vector.
+ * The base template class for each key frame specialization.
*/
template<typename V>
class KeyFrameBaseSpec : public KeyFrameSpec
{
-private:
- using PV = ProgressValue<V>;
- using PVContainer = std::vector<PV>;
-
- PVContainer mPVs; // The ProgressValue pairs
- KeyFrameChannel<V>* mKeyFrames; // The key frame interpolator
-
-public:
- static KeyFrameBaseSpec<V>* New()
- {
- return new KeyFrameBaseSpec<V>();
- }
-
- static KeyFrameBaseSpec<V>* Clone(const KeyFrameBaseSpec<V>& keyFrames)
- {
- return new KeyFrameBaseSpec<V>(keyFrames);
- }
-
- /**
- * Constructor
- */
- KeyFrameBaseSpec<V>()
- {
- mKeyFrames = new KeyFrameChannel<V>(KeyFrameChannelBase::Translate, mPVs);
- }
-
-protected:
- /**
- * Copy Constructor
- * Allow cloning of this object
- */
- KeyFrameBaseSpec<V>(const KeyFrameBaseSpec<V>& keyFrames)
- : mPVs(keyFrames.mPVs)
- {
- mKeyFrames = new KeyFrameChannel<V>(KeyFrameChannelBase::Translate, mPVs);
- }
-
- KeyFrameBaseSpec<V>& operator=( const KeyFrameBaseSpec<V>& keyFrames )
- {
- if( this != &keyFrames )
- {
- mPVs.clear();
- mPVs = keyFrames.mPVs;
- delete mKeyFrames;
- mKeyFrames = new KeyFrameChannel<V>(KeyFrameChannelBase::Translate, mPVs);
- }
- return *this;
- }
-
- /**
- * Destructor. Ensure progress value pairs are cleared down
- */
- ~KeyFrameBaseSpec<V>() override
- {
- delete mKeyFrames;
- mPVs.clear();
- }
+ KeyFrameChannel<V> mChannel; // The key frame channel
public:
/**
- * Add a key frame to the progress value vector. Key frames should be added
+ * Add a key frame to the channel. Key frames should be added
* in time order (this method does not sort the vector by time)
* @param[in] t - progress
* @param[in] v - value
*/
void AddKeyFrame(float t, V v, AlphaFunction alpha)
{
- mPVs.push_back(PV(t, v));
+ mChannel.mValues.push_back({t, v});
}
/**
* Get the number of key frames
- * @return The size of the progress value vector
+ * @return Channel size
*/
std::size_t GetNumberOfKeyFrames() const override
{
- return mPVs.size();
+ return mChannel.mValues.size();
}
/**
* @param[out] time The progress of the given key frame
* @param[out] value The value of the given key frame
*/
- virtual void GetKeyFrame(unsigned int index, float& time, V& value) const
+ void GetKeyFrame(unsigned int index, float& time, V& value) const
{
- DALI_ASSERT_ALWAYS( index < mPVs.size() && "KeyFrame index is out of bounds" );
- time = mPVs[index].mProgress;
- value = mPVs[index].mValue;
+ DALI_ASSERT_ALWAYS(index < mChannel.mValues.size() && "KeyFrame index is out of bounds");
+ const auto& element = mChannel.mValues[index];
+ time = element.mProgress;
+ value = element.mValue;
}
/**
*/
void GetKeyFrameAsValue( std::size_t index, Property::Value& value ) override
{
- value = mPVs[index].mValue;
+ value = mChannel.mValues[index].mValue;
}
/**
*/
bool IsActive(float progress) const
{
- return mKeyFrames->IsActive(progress);
+ return mChannel.IsActive(progress);
}
/**
*/
V GetValue(float progress, Dali::Animation::Interpolation interpolation) const
{
- return mKeyFrames->GetValue(progress, interpolation);
+ return mChannel.GetValue(progress, interpolation);
}
};
using KeyFrameVector4 = KeyFrameBaseSpec<Vector4>;
using KeyFrameQuaternion = KeyFrameBaseSpec<Quaternion>;
-using KeyFrameBooleanPtr = IntrusivePtr<KeyFrameBoolean>;
-using KeyFrameNumberPtr = IntrusivePtr<KeyFrameNumber>;
-using KeyFrameIntegerPtr = IntrusivePtr<KeyFrameInteger>;
-using KeyFrameVector2Ptr = IntrusivePtr<KeyFrameVector2>;
-using KeyFrameVector3Ptr = IntrusivePtr<KeyFrameVector3>;
-using KeyFrameVector4Ptr = IntrusivePtr<KeyFrameVector4>;
-using KeyFrameQuaternionPtr = IntrusivePtr<KeyFrameQuaternion>;
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameBoolean*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameBoolean*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameBoolean*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameBoolean*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameNumber*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameNumber*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameNumber*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameNumber*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameInteger*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameInteger*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameInteger*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameInteger*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameVector2*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameVector2*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameVector2*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameVector2*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameVector3*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameVector3*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameVector3*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameVector3*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameVector4*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameVector4*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameVector4*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<const Internal::KeyFrameVector4*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(Internal::KeyFrames& keyFrames, Internal::KeyFrameQuaternion*& keyFrameSpec)
-{
- keyFrameSpec = static_cast<Internal::KeyFrameQuaternion*>(keyFrames.GetKeyFramesBase());
-}
-
-inline void GetSpecialization(const Internal::KeyFrames& keyFrames, const Internal::KeyFrameQuaternion*& keyFrameSpec)
+template<typename DeriveClass>
+auto GetSpecialization(const Internal::KeyFrames& keyFrames)
{
- keyFrameSpec = static_cast<const Internal::KeyFrameQuaternion*>(keyFrames.GetKeyFramesBase());
+ return static_cast<DeriveClass>(keyFrames.GetKeyFramesBase());
}
} // Internal
{
}
-LinearConstrainer::~LinearConstrainer()
-{
-}
+LinearConstrainer::~LinearConstrainer() = default;
Property::Value LinearConstrainer::GetDefaultProperty( Property::Index index ) const
{
{
}
-PathConstrainer::~PathConstrainer()
-{
-}
+PathConstrainer::~PathConstrainer() = default;
Property::Value PathConstrainer::GetDefaultProperty( Property::Index index ) const
{
{
}
-Path::~Path()
-{
-}
+Path::~Path() = default;
Path* Path::Clone(const Path& path)
{
{
}
- ~ProgressValue ()
- {
- }
+ ~ProgressValue() = default;
float GetProgress () const
{
/**
* Copy from a PropertyInputAccessor
*/
- PropertyInputAccessor( const PropertyInputAccessor& accessor )
- : mInput( accessor.mInput ),
- mComponentIndex( accessor.mComponentIndex )
- {
- }
+ PropertyInputAccessor(const PropertyInputAccessor& accessor) = default;
/**
* Copy from a PropertyInputAccessor
/**
* Virtual Destructor
*/
- ~PropertyInputIndexer() override
- {
- }
+ ~PropertyInputIndexer() override = default;
/**
* @copydoc Dali::Internal::PropertyInput::GetType()
/**
* Virtual destructor
*/
- virtual ~Observer() {}
+ virtual ~Observer() = default;
};
/**
/**
* Constructor, not to be directly instantiated.
*/
- CompleteNotificationInterface()
- {}
+ CompleteNotificationInterface() = default;
/**
* Virtual destructor as this is an interface, no deletion through this interface though.
*/
- virtual ~CompleteNotificationInterface()
- {}
+ virtual ~CompleteNotificationInterface() = default;
public:
/**
* @brief Destructor
*/
- virtual ~Connectable() {}
+ virtual ~Connectable() = default;
/**
* @brief Check if the object is on the scene
/**
* Virtual destructor
*/
- virtual ~EventThreadServices()
- { }
+ virtual ~EventThreadServices() = default;
/**
* Get the EventThreadServices
eventInterfaceQueue.Reserve( 4 );
}
- ~Impl()
- {
- }
+ ~Impl() = default;
// queueMutex must be locked whilst accessing queue
MessageQueueMutex queueMutex;
/**
* @brief Default constructor.
*/
- ObjectConnector() {}
+ ObjectConnector() = default;
/**
* @brief Destructor.
*/
- ~ObjectConnector() {}
+ ~ObjectConnector() = default;
/**
* @brief Copy constructor
/**
* Virtual destructor
*/
- virtual ~Observer(){}
+ virtual ~Observer() = default;
};
/**
return ObjectRegistryPtr( new ObjectRegistry() );
}
-ObjectRegistry::ObjectRegistry()
-{
-}
+ObjectRegistry::ObjectRegistry() = default;
-ObjectRegistry::~ObjectRegistry()
-{
-}
+ObjectRegistry::~ObjectRegistry() = default;
void ObjectRegistry::RegisterObject( Dali::BaseObject* object )
{
}
-PropertyCondition::~PropertyCondition()
-{
-
-}
+PropertyCondition::~PropertyCondition() = default;
} // namespace Internal
/**
* Virtual destructor.
*/
- virtual ~PropertyInputImpl()
- {
- }
+ virtual ~PropertyInputImpl() = default;
/**
* Query the type of property input.
/**
* @brief Virtual Destructor.
*/
- virtual ~PropertyMetadata()
- {
- }
+ virtual ~PropertyMetadata() = default;
/**
* @brief Returns whether the property is animatable (i.e. if its a scene graph property).
/**
* @brief Destructor.
*/
- ~AnimatablePropertyMetadata() override
- {
- }
+ ~AnimatablePropertyMetadata() override = default;
private:
/**
* @brief Destructor.
*/
- ~CustomPropertyMetadata() override
- {
- }
+ ~CustomPropertyMetadata() override = default;
private:
return new PropertyNotificationManager;
}
-PropertyNotificationManager::~PropertyNotificationManager()
-{
-}
+PropertyNotificationManager::~PropertyNotificationManager() = default;
void PropertyNotificationManager::PropertyNotificationCreated( PropertyNotification& propertyNotification )
{
}
}
-PropertyNotificationManager::PropertyNotificationManager()
-{
-}
+PropertyNotificationManager::PropertyNotificationManager() = default;
} // namespace Internal
/**
* Virtual destructor.
*/
- virtual ~PropertyNotifier()
- {
- }
+ virtual ~PropertyNotifier() = default;
/**
* Provide notification signals for a changed property.
// Signals
-const char* const SIGNAL_KEY_EVENT = "keyEvent";
-const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
-const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
-const char* const SIGNAL_CONTEXT_LOST = "contextLost";
-const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
-const char* const SIGNAL_SCENE_CREATED = "sceneCreated";
+static constexpr std::string_view SIGNAL_KEY_EVENT = "keyEvent";
+static constexpr std::string_view SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
+static constexpr std::string_view SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_CONTEXT_LOST = "contextLost";
+static constexpr std::string_view SIGNAL_CONTEXT_REGAINED = "contextRegained";
+static constexpr std::string_view SIGNAL_SCENE_CREATED = "sceneCreated";
TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), nullptr );
-SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector1(mType, std::string(SIGNAL_KEY_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_EVENT_PROCESSING_FINISHED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_WHEEL_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_CONTEXT_LOST), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_CONTEXT_REGAINED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_SCENE_CREATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_KEY_EVENT_GENERATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_TOUCHED), &Stage::DoConnectSignal);
} // unnamed namespace
{
bool connected( true );
Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
+ std::string_view name(signalName);
- if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
+ if(name == SIGNAL_KEY_EVENT)
{
stage->KeyEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT_GENERATED ) )
+ else if(name == SIGNAL_KEY_EVENT_GENERATED)
{
stage->KeyEventGeneratedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
+ else if(name == SIGNAL_EVENT_PROCESSING_FINISHED)
{
stage->EventProcessingFinishedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
stage->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
+ else if(name == SIGNAL_WHEEL_EVENT)
{
stage->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
+ else if(name == SIGNAL_CONTEXT_LOST)
{
stage->ContextLostSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
+ else if(name == SIGNAL_CONTEXT_REGAINED)
{
stage->ContextRegainedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
+ else if(name == SIGNAL_SCENE_CREATED)
{
stage->SceneCreatedSignal().Connect( tracker, functor );
}
{
}
-Stage::~Stage()
-{
-}
+Stage::~Stage() = default;
} // namespace Internal
threadLocal = this;
}
-ThreadLocalStorage::~ThreadLocalStorage()
-{
-}
+ThreadLocalStorage::~ThreadLocalStorage() = default;
void ThreadLocalStorage::Remove()
{
return mCore->GetAnimationPlaylist();
}
+bool ThreadLocalStorage::IsBlendEquationSupported( DevelBlendEquation::Type blendEquation )
+{
+ return mCore->GetGlAbstraction().IsBlendEquationSupported( blendEquation );
+}
+
+std::string ThreadLocalStorage::GetShaderVersionPrefix()
+{
+ return mCore->GetGlAbstraction().GetShaderVersionPrefix();
+}
+
+std::string ThreadLocalStorage::GetVertexShaderPrefix()
+{
+ return mCore->GetGlAbstraction().GetVertexShaderPrefix();
+}
+
+std::string ThreadLocalStorage::GetFragmentShaderPrefix()
+{
+ return mCore->GetGlAbstraction().GetFragmentShaderPrefix();
+}
+
void ThreadLocalStorage::AddScene( Scene* scene )
{
mCore->AddScene( scene );
AnimationPlaylist& GetAnimationPlaylist();
/**
+ * @brief Returns whether the blend equation is supported in the system or not.
+ * @param[in] blendEquation blend equation to be checked.
+ * @return True if the blend equation supported.
+ */
+ bool IsBlendEquationSupported( DevelBlendEquation::Type blendEquation );
+
+ /**
+ * @brief Returns shader prefix of shading language version.
+ */
+ std::string GetShaderVersionPrefix();
+
+ /**
+ * @brief Returns vertex shader prefix including shading language version.
+ */
+ std::string GetVertexShaderPrefix();
+
+ /**
+ * @brief Returns fragment shader prefix including shading language version and extension information.
+ */
+ std::string GetFragmentShaderPrefix();
+
+ /**
* Add a Scene to the Core.
* This is only used by the Scene to add itself to the core when the Scene is created.
* @param[in] scene The Scene.
DALI_ASSERT_ALWAYS(!baseTypeName.empty() && "Type info construction must have a base type name");
}
-TypeInfo::~TypeInfo()
-{
-}
+TypeInfo::~TypeInfo() = default;
BaseHandle TypeInfo::CreateInstance() const
{
return _reg;
}
-TypeRegistry::TypeRegistry()
-{
-
-}
+TypeRegistry::TypeRegistry() = default;
TypeRegistry::~TypeRegistry()
{
}
-ShaderFactory::ShaderFactory()
-{
-}
+ShaderFactory::ShaderFactory() = default;
ShaderFactory::~ShaderFactory()
{
{
}
-GestureEventProcessor::~GestureEventProcessor()
-{
-}
+GestureEventProcessor::~GestureEventProcessor() = default;
void GestureEventProcessor::ProcessTouchEvent( Scene& scene, const Integration::TouchEvent& event)
{
namespace Internal
{
-
-GestureEvent::~GestureEvent()
-{
-}
+GestureEvent::~GestureEvent() = default;
GestureEvent::GestureEvent( GestureType::Value gesture, GestureState gestureState )
: gestureType( gesture ),
public:
virtual void Process( Scene& scene, const T& event ) = 0;
- virtual ~RecognizerObserver(){};
+ virtual ~RecognizerObserver() = default;
+ ;
};
/**
* Virtual destructor.
*/
- ~GestureRecognizer() override {}
+ ~GestureRecognizer() override = default;
protected:
Vector2 mScreenSize;
/**
* Virtual destructor
*/
- ~PanGestureRequest() override
- {
- }
+ ~PanGestureRequest() override = default;
// Data Members
/**
* Virtual destructor
*/
- ~TapGestureRequest() override
- {
- }
+ ~TapGestureRequest() override = default;
// Data Members
/**
* Virtual destructor
*/
- ~LongPressGestureRequest() override
- {
- }
+ ~LongPressGestureRequest() override = default;
// Data Members
} // unnamed namespace
-HitTestInterface::~HitTestInterface()
-{
-}
+HitTestInterface::~HitTestInterface() = default;
bool HitTest( const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
{
{
}
-KeyEventProcessor::~KeyEventProcessor()
-{
-}
+KeyEventProcessor::~KeyEventProcessor() = default;
void KeyEventProcessor::ProcessKeyEvent( const Integration::KeyEvent& event )
{
{
}
-LongPressGestureDetector::~LongPressGestureDetector()
-{
-}
+LongPressGestureDetector::~LongPressGestureDetector() = default;
void LongPressGestureDetector::SetTouchesRequired(unsigned int touches)
{
{
}
-LongPressGestureEvent::~LongPressGestureEvent()
-{
-}
+LongPressGestureEvent::~LongPressGestureEvent() = default;
} // namespace Internal
{
}
-LongPressGestureProcessor::~LongPressGestureProcessor()
-{
-}
+LongPressGestureProcessor::~LongPressGestureProcessor() = default;
void LongPressGestureProcessor::Process( Scene& scene, const LongPressGestureEvent& longPressEvent )
{
{
}
-PanGestureDetector::~PanGestureDetector()
-{
-}
+PanGestureDetector::~PanGestureDetector() = default;
const SceneGraph::PanGesture& PanGestureDetector::GetPanGestureSceneObject() const
{
{
}
-PanGestureEvent::~PanGestureEvent()
-{
-}
+PanGestureEvent::~PanGestureEvent() = default;
} // namespace Internal
}
}
-PanGestureRecognizer::~PanGestureRecognizer()
-{
-}
+PanGestureRecognizer::~PanGestureRecognizer() = default;
void PanGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
{
{
}
-PinchGestureDetector::~PinchGestureDetector()
-{
-}
+PinchGestureDetector::~PinchGestureDetector() = default;
void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch)
{
{
}
-PinchGestureEvent::~PinchGestureEvent()
-{
-}
+PinchGestureEvent::~PinchGestureEvent() = default;
} // namespace Internal
{
}
-PinchGestureProcessor::~PinchGestureProcessor()
-{
-}
+PinchGestureProcessor::~PinchGestureProcessor() = default;
void PinchGestureProcessor::SetMinimumPinchDistance( float value )
{
SetMinimumPinchDistance( minimumPinchDistance );
}
-PinchGestureRecognizer::~PinchGestureRecognizer()
-{
-}
+PinchGestureRecognizer::~PinchGestureRecognizer() = default;
void PinchGestureRecognizer::SetMinimumPinchDistance(float value)
{
// Ray travels distance * rayDirLocal to intersect with plane.
distance = a / b;
- const Vector3& size = node.GetSize(EventThreadServices::Get().GetEventBufferIndex());
+ const Vector2& size = actor.GetTouchArea() == Vector2::ZERO ? Vector2(node.GetSize(EventThreadServices::Get().GetEventBufferIndex())) : actor.GetTouchArea();
hitPointLocal.x = rayOriginLocal.x + rayDirLocal.x * distance + size.x * 0.5f;
hitPointLocal.y = rayOriginLocal.y + rayDirLocal.y * distance + size.y * 0.5f;
{
}
-TapGestureDetector::~TapGestureDetector()
-{
-}
+TapGestureDetector::~TapGestureDetector() = default;
void TapGestureDetector::SetMinimumTapsRequired(unsigned int taps)
{
{
}
-TapGestureEvent::~TapGestureEvent()
-{
-}
+TapGestureEvent::~TapGestureEvent() = default;
} // namespace Internal
{
}
-TapGestureProcessor::~TapGestureProcessor()
-{
-}
+TapGestureProcessor::~TapGestureProcessor() = default;
void TapGestureProcessor::Process( Scene& scene, const TapGestureEvent& tapEvent )
{
{
}
-TapGestureRecognizer::~TapGestureRecognizer()
-{
-}
+TapGestureRecognizer::~TapGestureRecognizer() = default;
void TapGestureRecognizer::SendEvent(const Integration::TouchEvent& event)
{
{
}
-WheelEventProcessor::~WheelEventProcessor()
-{
-}
+WheelEventProcessor::~WheelEventProcessor() = default;
void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event )
{
/**
* Virtual destructor
*/
- virtual ~RenderTaskDefaults(){}
+ virtual ~RenderTaskDefaults() = default;
};
} // namespace Internal
/*
- * 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.
DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelRenderer::Property::OPACITY )
DALI_PROPERTY( "renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR )
+DALI_PROPERTY( "blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION )
DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX, RendererDefaultProperties )
// Property string to enumeration tables:
DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, ADD )
DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, SUBTRACT )
DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, REVERSE_SUBTRACT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, MIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, MAX )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, MULTIPLY )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, SCREEN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, OVERLAY )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, DARKEN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, LIGHTEN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, COLOR_DODGE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, COLOR_BURN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, HARD_LIGHT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, SOFT_LIGHT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, DIFFERENCE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, EXCLUSION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, HUE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, SATURATION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelBlendEquation, LUMINOSITY )
DALI_ENUM_TO_STRING_TABLE_END( BLEND_EQUATION )
DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_FACTOR )
destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
}
-void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
+void Renderer::SetBlendEquation( DevelBlendEquation::Type equationRgba )
{
mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
}
-void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
- BlendEquation::Type equationAlpha )
+void Renderer::SetBlendEquation( DevelBlendEquation::Type equationRgb,
+ DevelBlendEquation::Type equationAlpha )
{
+ if( mBlendingOptions.IsAdvancedBlendEquation( equationRgb ) || mBlendingOptions.IsAdvancedBlendEquation( equationAlpha ) )
+ {
+ DALI_LOG_ERROR("Advanced blend equation requires to be set by using SetBlendEquation( DevelBlendEquation::Type equationRgba ).");
+ return;
+ }
mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
}
-void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
- BlendEquation::Type& equationAlpha ) const
+void Renderer::GetBlendEquation( DevelBlendEquation::Type& equationRgb,
+ DevelBlendEquation::Type& equationAlpha ) const
{
// These are not animatable, the cached values are up-to-date.
equationRgb = mBlendingOptions.GetBlendEquationRgb();
return mPremultipledAlphaEnabled;
}
+bool Renderer::IsAdvancedBlendEquationApplied() const
+{
+ DevelBlendEquation::Type equationRgb, equationAlpha;
+ GetBlendEquation( equationRgb, equationAlpha );
+
+ if( equationRgb != equationAlpha )
+ {
+ return false;
+ }
+
+ return mBlendingOptions.IsAdvancedBlendEquation( equationRgb );
+}
+
const SceneGraph::Renderer& Renderer::GetRendererSceneObject() const
{
return static_cast<const SceneGraph::Renderer&>( GetSceneObject() );
}
break;
}
+ case Dali::DevelRenderer::Property::BLEND_EQUATION:
+ {
+ DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
+
+ if( Scripting::GetEnumerationProperty< DevelBlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
+ {
+ mBlendingOptions.SetBlendEquation( convertedValue, convertedValue );
+ SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
+ }
+ break;
+ }
case Dali::Renderer::Property::BLEND_EQUATION_RGB:
{
- BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
+ DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
- if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
+ if( Scripting::GetEnumerationProperty< DevelBlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
{
- BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
+ if( mBlendingOptions.IsAdvancedBlendEquation( convertedValue ) )
+ {
+ DALI_LOG_ERROR("Advanced blend equation requires to be set by using DevelBlendEquation::BLEND_EQUATION.");
+ break;
+ }
+ DevelBlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation );
SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
}
}
case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
{
- BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
+ DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
- if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
+ if( Scripting::GetEnumerationProperty< DevelBlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
{
- BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
+ if( mBlendingOptions.IsAdvancedBlendEquation( convertedValue ) )
+ {
+ DALI_LOG_ERROR("Advanced blend equation requires to be set by using DevelBlendEquation::BLEND_EQUATION.");
+ break;
+ }
+ DevelBlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue );
SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
}
value = mBlendMode;
break;
}
+ case Dali::DevelRenderer::Property::BLEND_EQUATION:
+ {
+ value = static_cast<int32_t>( mBlendingOptions.GetBlendEquationRgb() );
+ break;
+ }
case Dali::Renderer::Property::BLEND_EQUATION_RGB:
{
value = static_cast<int32_t>( mBlendingOptions.GetBlendEquationRgb() );
value = sceneObject.GetBlendMode();
break;
}
+ case Dali::DevelRenderer::Property::BLEND_EQUATION:
+ {
+ uint32_t bitMask = sceneObject.GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int32_t>( blendingOptions.GetBlendEquationRgb() );
+ break;
+ }
case Dali::Renderer::Property::BLEND_EQUATION_RGB:
{
uint32_t bitMask = sceneObject.GetBlendingOptions();
#define DALI_INTERNAL_RENDERER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const;
/**
- * @copydoc Dali::Renderer::SetBlendEquation()
+ * @brief Set same Blend Equation for the RGB and alpha
*/
- void SetBlendEquation( BlendEquation::Type equationRgba );
+ void SetBlendEquation( DevelBlendEquation::Type equationRgba );
/**
- * @copydoc Dali::Renderer::SetBlendEquation()
+ * @brief Set Blend Equation separately for the RGB and alpha
*/
- void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha );
+ void SetBlendEquation( DevelBlendEquation::Type equationRgb, DevelBlendEquation::Type equationAlpha );
/**
- * @copydoc Dali::Renderer::GetBlendEquation()
+ * @brief Get Blend Equation of rgb and alpha
*/
- void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const;
+ void GetBlendEquation( DevelBlendEquation::Type& equationRgb, DevelBlendEquation::Type& equationAlpha ) const;
/**
* @copydoc Dali::Renderer::SetIndexedDrawFirstElement
bool IsPreMultipliedAlphaEnabled() const;
/**
+ * @brief Query whether Blend Equation Advanced is used in this renderer
+ *
+ * @return True is Blend Equation Advanced is used, false otherwise.
+ */
+ bool IsAdvancedBlendEquationApplied() const;
+
+ /**
* @brief Get the scene graph object
*
* @return the scene object
}
}
+std::string Shader::GetShaderVersionPrefix()
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetShaderVersionPrefix();
+}
+
+std::string Shader::GetVertexShaderPrefix()
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetVertexShaderPrefix();
+}
+
+std::string Shader::GetFragmentShaderPrefix()
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetFragmentShaderPrefix();
+}
} // namespace Internal
} // namespace Dali
Internal::ShaderDataPtr mShaderData;
+public:
+
+ /**
+ * @copydoc Dali::Shader::GetShaderVersionPrefix()
+ */
+ static std::string GetShaderVersionPrefix();
+
+ /**
+ * @copydoc Dali::Shader::GetVertexShaderPrefix()
+ */
+ static std::string GetVertexShaderPrefix();
+
+ /**
+ * @copydoc Dali::Shader::GetFragmentShaderPrefix()
+ */
+ static std::string GetFragmentShaderPrefix();
+
};
} // namespace Internal
const char* fragmentPrefix = mNativeImage->GetCustomFragmentPrefix();
const char* customSamplerTypename = mNativeImage->GetCustomSamplerTypename();
+ size_t prefixIndex = shader.find(Dali::Shader::GetShaderVersionPrefix());
if(fragmentPrefix != nullptr)
{
modified = true;
- fragmentShader = fragmentPrefix;
- fragmentShader += "\n";
+ if(prefixIndex == std::string::npos)
+ {
+ fragmentShader = fragmentPrefix;
+ fragmentShader += "\n";
+ }
+ else
+ {
+ fragmentShader.clear();
+ shader.insert(prefixIndex + Dali::Shader::GetShaderVersionPrefix().length(), std::string(fragmentPrefix) + "\n");
+ }
}
fragmentShader += shader;
{
}
-MemoryPoolRelayoutContainer::~MemoryPoolRelayoutContainer()
-{
-}
+MemoryPoolRelayoutContainer::~MemoryPoolRelayoutContainer() = default;
bool MemoryPoolRelayoutContainer::Contains( const Dali::Actor& actor )
{
}
// Remove any redundant sub-tree heads
- for( std::vector< Dali::Actor >::iterator it = potentialRedundantSubRoots.begin(), itEnd = potentialRedundantSubRoots.end(); it != itEnd; ++it )
+ for( auto& subRoot : potentialRedundantSubRoots )
{
- Dali::Actor subRoot = *it;
-
RemoveRequest( subRoot );
}
Internal::Actor* actorPtr = &GetImplementation( actor );
// Only add the rootActor if it is not already recorded
- bool found = false;
- for( auto&& item : mDirtyLayoutSubTrees )
- {
- if( item == actorPtr )
- {
- found = true;
- break;
- }
- }
+ auto itr = std::find( mDirtyLayoutSubTrees.begin(), mDirtyLayoutSubTrees.end(), actorPtr );
- if( !found )
+ if( itr == mDirtyLayoutSubTrees.end() )
{
mDirtyLayoutSubTrees.PushBack( actorPtr );
}
{
Internal::Actor* actorPtr = &GetImplementation( actor );
- // Remove actor from dirty sub trees
- for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it )
- {
- if( *it == actorPtr )
- {
- mDirtyLayoutSubTrees.Erase( it );
- break;
- }
- }
+ mDirtyLayoutSubTrees.Erase( std::remove( mDirtyLayoutSubTrees.begin(),
+ mDirtyLayoutSubTrees.end(),
+ actorPtr ),
+ mDirtyLayoutSubTrees.end() );
}
void RelayoutController::Request()
// 1. Finds all top-level controls from the dirty list and allocate them the size of the scene
// These controls are paired with the parent/scene size and added to the stack.
- for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it )
+ for( auto& dirtyActor : mDirtyLayoutSubTrees )
{
- Internal::Actor* dirtyActor = *it;
-
// Need to test if actor is valid (could have been deleted and had the pointer cleared)
if( dirtyActor )
{
void RelayoutController::FindAndZero( const RawActorList& list, const Dali::RefObject* object )
{
// Object has been destroyed so clear it from this list
- for( RawActorList::Iterator it = list.Begin(), itEnd = list.End(); it != itEnd; ++it )
+ for( auto& actor : list )
{
- BaseObject* actor = *it;
-
if( actor && ( actor == object ) )
{
- *it = NULL; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list.
+ actor = nullptr; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list.
}
}
}
{
}
-RenderInstructionContainer::~RenderInstructionContainer()
-{
-}
+RenderInstructionContainer::~RenderInstructionContainer() = default;
void RenderInstructionContainer::ResetAndReserve( BufferIndex bufferIndex, uint32_t capacityRequired )
{
{
}
-RenderItem::~RenderItem()
-{
-}
-
+RenderItem::~RenderItem() = default;
ClippingBox RenderItem::CalculateViewportSpaceAABB( const Vector3& size, const int viewportWidth, const int viewportHeight ) const
{
/**
* Constructor. Nothing to do as a pure interface.
*/
- NodeDataProvider() { }
+ NodeDataProvider() = default;
/**
* @param bufferIndex to use
/**
* Virtual destructor, this is an interface, no deletion through this interface
*/
- ~NodeDataProvider() override { }
+ ~NodeDataProvider() override = default;
};
} // SceneGraph
{
}
-RenderDataProvider::~RenderDataProvider()
-{
-}
+RenderDataProvider::~RenderDataProvider() = default;
void RenderDataProvider::SetUniformMap(const UniformMapDataProvider& uniformMapDataProvider)
{
/**
* Constructor
*/
- UniformMapDataProvider()
- {
- }
+ UniformMapDataProvider() = default;
/**
* Return true if the uniform map has been changed this frame
/**
* No deletion through this interface
*/
- virtual ~UniformMapDataProvider()
- {
- }
+ virtual ~UniformMapDataProvider() = default;
};
} // namespace SceneGraph
{
}
-Context::~Context()
-{
-}
+Context::~Context() = default;
void Context::GlContextCreated()
{
*/
void BlendEquation(GLenum mode)
{
- // use BlendEquationSeparate to set the rgb and alpha modes the same
- BlendEquationSeparate( mode, mode );
+ // DO NOT USE BlendEquationSeparate to set the same rgb and alpha modes
+ // KHR blending extensions require use of glBlendEquation
+
+ if( mBlendEquationSeparateModeRGB != mode || mBlendEquationSeparateModeAlpha != mode )
+ {
+ mBlendEquationSeparateModeRGB = mode;
+ mBlendEquationSeparateModeAlpha = mode;
+ LOG_GL("BlendEquation %d\n", mode);
+ CHECK_GL( mGlAbstraction, mGlAbstraction.BlendEquation( mode ) );
+ }
}
/**
}
/**
- * Wrapper for OpenGL ES 3.0 glUnmapBubffer()
+ * Wrapper for OpenGL ES 3.0 glUnmapBuffer()
*/
GLboolean UnmapBuffer(GLenum target)
{
GLboolean val = CHECK_GL( mGlAbstraction, mGlAbstraction.UnmapBuffer(target) );
return val;
}
+
/**
* Wrapper for OpenGL ES 2.0 glViewport()
*/
}
/**
+ * Wrapper for OpenGL ES 3.2 and GL_KHR_blend_equation_advanced extention glBlendBarrier()
+ */
+ void BlendBarrier()
+ {
+ LOG_GL( "BlendBarrier\n" );
+ CHECK_GL( mGlAbstraction, mGlAbstraction.BlendBarrier() );
+ }
+
+ /**
* Get the implementation defined MAX_TEXTURE_SIZE. This values is cached when the context is created
* @return The implementation defined MAX_TEXTURE_SIZE
*/
{
}
-FrameBufferStateCache::~FrameBufferStateCache()
-{
-}
+FrameBufferStateCache::~FrameBufferStateCache() = default;
GLbitfield FrameBufferStateCache::GetClearMask( GLbitfield mask, bool forceClear, bool scissorTestEnabled )
{
/**
* Virtual destructor.
*/
- virtual ~GlResourceOwner()
- { }
+ virtual ~GlResourceOwner() = default;
/**
* Reset all GL resources.
{
}
-FrameBuffer::~FrameBuffer()
-{
-}
+FrameBuffer::~FrameBuffer() = default;
void FrameBuffer::Destroy( Context& context )
{
{
}
-Geometry::~Geometry()
-{
-}
+Geometry::~Geometry() = default;
void Geometry::GlContextCreated( Context& context )
{
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mContext = &context;
}
-Renderer::~Renderer()
-{
-}
+Renderer::~Renderer() = default;
void Renderer::SetGeometry( Render::Geometry* geometry )
{
mBlendingOptions.GetBlendDestFactorAlpha() );
// Set blend equations
- context.BlendEquationSeparate( mBlendingOptions.GetBlendEquationRgb(),
- mBlendingOptions.GetBlendEquationAlpha() );
+ Dali::DevelBlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
+ Dali::DevelBlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
+
+ if( mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled )
+ {
+ if( rgbEquation != alphaEquation )
+ {
+ DALI_LOG_ERROR( "Advanced Blend Equation have to be appried by using BlendEquation.\n" );
+ }
+ context.BlendEquation( rgbEquation );
+ }
+ else
+ {
+ context.BlendEquationSeparate( rgbEquation, alphaEquation );
+ }
}
mUpdated = true;
mUpdateAttributesLocation = false;
}
+ if( mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled )
+ {
+ context.BlendBarrier();
+ }
+
if(mDrawCommands.empty())
{
SetBlending( context, blend );
/**
* Destructor
*/
- ~Sampler()
- {}
+ ~Sampler() = default;
bool operator==(const Sampler& rhs) const
{
{
}
-Texture::~Texture()
-{}
+Texture::~Texture() = default;
void Texture::Destroy( Context& context )
{
{
}
-VertexBuffer::~VertexBuffer()
-{
-}
+VertexBuffer::~VertexBuffer() = default;
void VertexBuffer::SetFormat( VertexBuffer::Format* format )
{
/**
* Constructor
*/
- ProgramCache()
- { }
+ ProgramCache() = default;
/**
* Destructor, virtual as this is an interface
*/
- virtual ~ProgramCache()
- { }
+ virtual ~ProgramCache() = default;
public: // API
mProgramCache.Reserve( 32 );
}
-ProgramController::~ProgramController()
-{
-}
+ProgramController::~ProgramController() = default;
void ProgramController::ResetProgramMatrices()
{
/**
* Non-virtual destructor; PropertyAccessor is not suitable as a base class.
*/
- ~PropertyAccessor()
- {
- }
+ ~PropertyAccessor() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyAccessor is not suitable as a base class.
*/
- ~TransformManagerPropertyAccessor()
- {
- }
+ ~TransformManagerPropertyAccessor() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyAccessor is not suitable as a base class.
*/
- ~TransformManagerPropertyComponentAccessor()
- {
- }
+ ~TransformManagerPropertyComponentAccessor() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyComponentAccessorX is not suitable as a base class.
*/
- ~PropertyComponentAccessorX()
- {
- }
+ ~PropertyComponentAccessorX() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyComponentAccessorY is not suitable as a base class.
*/
- ~PropertyComponentAccessorY()
- {
- }
+ ~PropertyComponentAccessorY() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyComponentAccessorZ is not suitable as a base class.
*/
- ~PropertyComponentAccessorZ()
- {
- }
+ ~PropertyComponentAccessorZ() = default;
/**
* Query whether the accessor is set.
/**
* Non-virtual destructor; PropertyComponentAccessorW is not suitable as a base class.
*/
- ~PropertyComponentAccessorW()
- {
- }
+ ~PropertyComponentAccessorW() = default;
/**
* Query whether the accessor is set.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mDisconnectAction(disconnectAction),
mState(Stopped),
mProgressReachedSignalRequired( false ),
- mAutoReverseEnabled( false )
+ mAutoReverseEnabled( false ),
+ mIsActive{ false }
{
}
-Animation::~Animation()
-{
-}
+Animation::~Animation() = default;
void Animation::operator delete( void* ptr )
{
void Animation::UpdateAnimators( BufferIndex bufferIndex, bool bake, bool animationFinished )
{
+ mIsActive[bufferIndex] = false;
+
const Vector2 playRange( mPlayRange * mDurationSeconds );
float elapsedSecondsClamped = Clamp( mElapsedSeconds, playRange.x, playRange.y );
+ //Remove animators whose PropertyOwner has been destroyed
+ mAnimators.Erase(std::remove_if(mAnimators.begin(),
+ mAnimators.end(),
+ [](auto animator) { return animator->Orphan(); }),
+ mAnimators.end());
+
//Loop through all animators
- bool applied(true);
- for ( auto&& iter = mAnimators.Begin(); iter != mAnimators.End(); )
+ for(auto& animator : mAnimators)
{
- AnimatorBase *animator = *iter;
-
- if( animator->Orphan() )
- {
- //Remove animators whose PropertyOwner has been destroyed
- iter = mAnimators.Erase(iter);
- }
- else
+ bool applied(true);
+ if(animator->IsEnabled())
{
- if( animator->IsEnabled() )
- {
- const float intervalDelay( animator->GetIntervalDelay() );
+ const float intervalDelay(animator->GetIntervalDelay());
- if( elapsedSecondsClamped >= intervalDelay )
+ if(elapsedSecondsClamped >= intervalDelay)
+ {
+ // Calculate a progress specific to each individual animator
+ float progress(1.0f);
+ const float animatorDuration = animator->GetDuration();
+ if(animatorDuration > 0.0f) // animators can be "immediate"
{
- // Calculate a progress specific to each individual animator
- float progress(1.0f);
- const float animatorDuration = animator->GetDuration();
- if (animatorDuration > 0.0f) // animators can be "immediate"
- {
- progress = Clamp((elapsedSecondsClamped - intervalDelay) / animatorDuration, 0.0f , 1.0f );
- }
- animator->Update(bufferIndex, progress, bake);
+ progress = Clamp((elapsedSecondsClamped - intervalDelay) / animatorDuration, 0.0f, 1.0f);
}
- applied = true;
- }
- else
- {
- applied = false;
- }
+ animator->Update(bufferIndex, progress, bake);
- if ( animationFinished )
- {
- animator->SetActive( false );
+ if (animatorDuration > 0.0f && (elapsedSecondsClamped - intervalDelay) <= animatorDuration)
+ {
+ mIsActive[bufferIndex] = true;
+ }
}
+ applied = true;
+ }
+ else
+ {
+ applied = false;
+ }
- if (applied)
- {
- INCREASE_COUNTER(PerformanceMonitor::ANIMATORS_APPLIED);
- }
+ if(animationFinished)
+ {
+ animator->SetActive(false);
+ }
- ++iter;
+ if(applied)
+ {
+ INCREASE_COUNTER(PerformanceMonitor::ANIMATORS_APPLIED);
}
}
-
}
} // namespace SceneGraph
#define DALI_INTERNAL_SCENE_GRAPH_ANIMATION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
/**
+ * Query whether the animation is currently active (i.e. at least one of the animators has been updated in either frame)
+ * @return True if the animation is currently active
+ */
+ bool IsActive() const
+ {
+ // As we have double buffering, if animator is updated in either frame, it needs to be rendered.
+ return mIsActive[0] || mIsActive[1];
+ }
+
+ /**
* @brief Sets the looping mode.
*
* Animation plays forwards and then restarts from the beginning or runs backwards again.
bool mProgressReachedSignalRequired; // Flag to indicate the progress marker was hit
bool mAutoReverseEnabled; // Flag to identify that the looping mode is auto reverse.
+ bool mIsActive[2]; // Flag to indicate whether the animation is active in the current frame (which is double buffered)
};
}; //namespace SceneGraph
// EXTERNAL INCLUDES
#include <cmath>
+#include <functional>
// INTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
using Interpolation = Dali::Animation::Interpolation;
-/**
- * AnimatorFunction base class.
- * Needs to be declared first so AnimatorBase knows about it's destructor
- * All update functions must inherit from AnimatorFunctionBase and overload the appropiate "()" operator
- */
-struct AnimatorFunctionBase
-{
- /**
- * Constructor
- */
- AnimatorFunctionBase() {}
-
- /*
- * Virtual destructor (Intended as base class)
- */
- virtual ~AnimatorFunctionBase() {}
-
- ///Stub "()" operators.
- virtual bool operator()(float progress, const bool& property)
- {
- return property;
- }
-
- virtual float operator()(float progress, const int32_t& property)
- {
- return static_cast<float>( property );
- }
-
- virtual float operator()(float progress, const float& property)
- {
- return property;
- }
-
- virtual Vector2 operator()(float progress, const Vector2& property)
- {
- return property;
- }
-
- virtual Vector3 operator()(float progress, const Vector3& property)
- {
- return property;
- }
-
- virtual Vector4 operator()(float progress, const Vector4& property)
- {
- return property;
- }
-
- virtual Quaternion operator()(float progress, const Quaternion& property)
- {
- return property;
- }
-};
namespace SceneGraph
{
* Constructor.
*/
AnimatorBase( PropertyOwner* propertyOwner,
- AnimatorFunctionBase* animatorFunction,
AlphaFunction alphaFunction,
const TimePeriod& timePeriod )
: mLifecycleObserver( nullptr ),
mPropertyOwner( propertyOwner ),
- mAnimatorFunction( animatorFunction ),
mDurationSeconds( timePeriod.durationSeconds ),
mIntervalDelaySeconds( timePeriod.delaySeconds ),
mSpeedFactor( 1.0f ),
mCurrentProgress( 0.f ),
- mLoopCount( 1 ),
mAlphaFunction( alphaFunction ),
mDisconnectAction( Dali::Animation::BAKE_FINAL ),
mAnimationPlaying( false ),
*/
~AnimatorBase() override
{
- delete mAnimatorFunction;
if (mPropertyOwner && mConnectedToSceneGraph)
{
mPropertyOwner->RemoveObserver(*this);
LifecycleObserver* mLifecycleObserver;
PropertyOwner* mPropertyOwner;
- AnimatorFunctionBase* mAnimatorFunction;
+
float mDurationSeconds;
float mIntervalDelaySeconds;
float mSpeedFactor;
float mCurrentProgress;
- int32_t mLoopCount;
-
AlphaFunction mAlphaFunction;
+ int32_t mLoopCount{1};
Dali::Animation::EndAction mDisconnectAction; ///< EndAction to apply when target object gets disconnected from the stage.
bool mAnimationPlaying:1; ///< whether disconnect has been applied while it's running.
bool mEnabled:1; ///< Animator is "enabled" while its target object is valid and on the stage.
/**
* An animator for a specific property type PropertyType.
*/
-template < typename PropertyType, typename PropertyAccessorType >
-class Animator : public AnimatorBase
+template<typename PropertyType, typename PropertyAccessorType>
+class Animator final : public AnimatorBase
{
+ using AnimatorFunction = std::function<PropertyType(float, const PropertyType&)>;
+
+ AnimatorFunction mAnimatorFunction;
+
public:
/**
* @param[in] timePeriod The time period of this animation.
* @return A newly allocated animator.
*/
- static AnimatorBase* New( const PropertyOwner& propertyOwner,
- const PropertyBase& property,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alphaFunction,
- const TimePeriod& timePeriod )
+ static AnimatorBase* New(const PropertyOwner& propertyOwner,
+ const PropertyBase& property,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alphaFunction,
+ const TimePeriod& timePeriod)
{
// The property was const in the actor-thread, but animators are used in the scene-graph thread.
- return new Animator( const_cast<PropertyOwner*>( &propertyOwner ),
- const_cast<PropertyBase*>( &property ),
- animatorFunction,
- alphaFunction,
- timePeriod );
- }
-
- /**
- * Virtual destructor.
- */
- ~Animator() override
- {
+ return new Animator(const_cast<PropertyOwner*>(&propertyOwner),
+ const_cast<PropertyBase*>(&property),
+ std::move(animatorFunction),
+ alphaFunction,
+ timePeriod);
}
/**
const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
// need to cast the return value in case property is integer
- const PropertyType result = static_cast<PropertyType>( (*mAnimatorFunction)( alpha, current ) );
+ const PropertyType result = static_cast<PropertyType>(mAnimatorFunction(alpha, current));
if ( bake )
{
/**
* Private constructor; see also Animator::New().
*/
- Animator( PropertyOwner* propertyOwner,
- PropertyBase* property,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alphaFunction,
- const TimePeriod& timePeriod )
- : AnimatorBase( propertyOwner, animatorFunction, alphaFunction, timePeriod ),
- mPropertyAccessor( property )
+ Animator(PropertyOwner* propertyOwner,
+ PropertyBase* property,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alphaFunction,
+ const TimePeriod& timePeriod)
+ : AnimatorBase(propertyOwner, alphaFunction, timePeriod),
+ mAnimatorFunction(std::move(animatorFunction)),
+ mPropertyAccessor(property)
{
// WARNING - this object is created in the event-thread
// The scene-graph mPropertyOwner object cannot be observed here
/**
* An animator for a specific property type PropertyType.
*/
-template <typename PropertyType, typename PropertyAccessorType>
-class AnimatorTransformProperty : public AnimatorBase
+template<typename PropertyType, typename PropertyAccessorType>
+class AnimatorTransformProperty final : public AnimatorBase
{
+ using AnimatorFunction = std::function<PropertyType(float, const PropertyType&)>;
+
+ AnimatorFunction mAnimatorFunction;
+
public:
/**
* @param[in] timePeriod The time period of this animation.
* @return A newly allocated animator.
*/
- static AnimatorBase* New( const PropertyOwner& propertyOwner,
- const PropertyBase& property,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alphaFunction,
- const TimePeriod& timePeriod )
+ static AnimatorBase* New(const PropertyOwner& propertyOwner,
+ const PropertyBase& property,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alphaFunction,
+ const TimePeriod& timePeriod)
{
// The property was const in the actor-thread, but animators are used in the scene-graph thread.
- return new AnimatorTransformProperty( const_cast<PropertyOwner*>( &propertyOwner ),
- const_cast<PropertyBase*>( &property ),
- animatorFunction,
- alphaFunction,
- timePeriod );
- }
-
- /**
- * Virtual destructor.
- */
- ~AnimatorTransformProperty() override
- {
+ return new AnimatorTransformProperty(const_cast<PropertyOwner*>(&propertyOwner),
+ const_cast<PropertyBase*>(&property),
+ std::move(animatorFunction),
+ alphaFunction,
+ timePeriod);
}
/**
const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
// need to cast the return value in case property is integer
- const PropertyType result = static_cast<PropertyType>( (*mAnimatorFunction)( alpha, current ) );
+ const PropertyType result = static_cast<PropertyType>(mAnimatorFunction(alpha, current));
if ( bake )
{
/**
* Private constructor; see also Animator::New().
*/
- AnimatorTransformProperty( PropertyOwner* propertyOwner,
- PropertyBase* property,
- AnimatorFunctionBase* animatorFunction,
- AlphaFunction alphaFunction,
- const TimePeriod& timePeriod )
- : AnimatorBase( propertyOwner, animatorFunction, alphaFunction, timePeriod ),
- mPropertyAccessor( property )
+ AnimatorTransformProperty(PropertyOwner* propertyOwner,
+ PropertyBase* property,
+ AnimatorFunction animatorFunction,
+ AlphaFunction alphaFunction,
+ const TimePeriod& timePeriod)
+ : AnimatorBase(propertyOwner, alphaFunction, timePeriod),
+ mAnimatorFunction(std::move(animatorFunction)),
+ mPropertyAccessor(property)
{
// WARNING - this object is created in the event-thread
// The scene-graph mPropertyOwner object cannot be observed here
// Update functions
-struct AnimateByInteger : public AnimatorFunctionBase
+struct AnimateByInteger
{
AnimateByInteger(const int& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float alpha, const int32_t& property) override
+ float operator()(float alpha, const int32_t& property)
{
// integers need to be correctly rounded
return roundf(static_cast<float>( property ) + static_cast<float>( mRelative ) * alpha );
int32_t mRelative;
};
-struct AnimateToInteger : public AnimatorFunctionBase
+struct AnimateToInteger
{
AnimateToInteger(const int& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float alpha, const int32_t& property) override
+ float operator()(float alpha, const int32_t& property)
{
// integers need to be correctly rounded
return roundf(static_cast<float>( property ) + (static_cast<float>(mTarget - property) * alpha) );
int32_t mTarget;
};
-struct AnimateByFloat : public AnimatorFunctionBase
+struct AnimateByFloat
{
AnimateByFloat(const float& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float alpha, const float& property) override
+ float operator()(float alpha, const float& property)
{
return float(property + mRelative * alpha);
}
float mRelative;
};
-struct AnimateToFloat : public AnimatorFunctionBase
+struct AnimateToFloat
{
AnimateToFloat(const float& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float alpha, const float& property) override
+ float operator()(float alpha, const float& property)
{
return float(property + ((mTarget - property) * alpha));
}
float mTarget;
};
-struct AnimateByVector2 : public AnimatorFunctionBase
+struct AnimateByVector2
{
AnimateByVector2(const Vector2& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector2 operator()(float alpha, const Vector2& property) override
+ Vector2 operator()(float alpha, const Vector2& property)
{
return Vector2(property + mRelative * alpha);
}
Vector2 mRelative;
};
-struct AnimateToVector2 : public AnimatorFunctionBase
+struct AnimateToVector2
{
AnimateToVector2(const Vector2& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector2 operator()(float alpha, const Vector2& property) override
+ Vector2 operator()(float alpha, const Vector2& property)
{
return Vector2(property + ((mTarget - property) * alpha));
}
Vector2 mTarget;
};
-struct AnimateByVector3 : public AnimatorFunctionBase
+struct AnimateByVector3
{
AnimateByVector3(const Vector3& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector3 operator()(float alpha, const Vector3& property) override
+ Vector3 operator()(float alpha, const Vector3& property)
{
return Vector3(property + mRelative * alpha);
}
Vector3 mRelative;
};
-struct AnimateToVector3 : public AnimatorFunctionBase
+struct AnimateToVector3
{
AnimateToVector3(const Vector3& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector3 operator()(float alpha, const Vector3& property) override
+ Vector3 operator()(float alpha, const Vector3& property)
{
return Vector3(property + ((mTarget - property) * alpha));
}
Vector3 mTarget;
};
-struct AnimateByVector4 : public AnimatorFunctionBase
+struct AnimateByVector4
{
AnimateByVector4(const Vector4& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector4 operator()(float alpha, const Vector4& property) override
+ Vector4 operator()(float alpha, const Vector4& property)
{
return Vector4(property + mRelative * alpha);
}
Vector4 mRelative;
};
-struct AnimateToVector4 : public AnimatorFunctionBase
+struct AnimateToVector4
{
AnimateToVector4(const Vector4& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector4 operator()(float alpha, const Vector4& property) override
+ Vector4 operator()(float alpha, const Vector4& property)
{
return Vector4(property + ((mTarget - property) * alpha));
}
Vector4 mTarget;
};
-struct AnimateByOpacity : public AnimatorFunctionBase
+struct AnimateByOpacity
{
AnimateByOpacity(const float& relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector4 operator()(float alpha, const Vector4& property) override
+ Vector4 operator()(float alpha, const Vector4& property)
{
Vector4 result(property);
result.a += mRelative * alpha;
float mRelative;
};
-struct AnimateToOpacity : public AnimatorFunctionBase
+struct AnimateToOpacity
{
AnimateToOpacity(const float& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- Vector4 operator()(float alpha, const Vector4& property) override
+ Vector4 operator()(float alpha, const Vector4& property)
{
Vector4 result(property);
result.a = property.a + ((mTarget - property.a) * alpha);
float mTarget;
};
-struct AnimateByBoolean : public AnimatorFunctionBase
+struct AnimateByBoolean
{
AnimateByBoolean(bool relativeValue)
: mRelative(relativeValue)
{
}
- using AnimatorFunctionBase::operator();
- bool operator()(float alpha, const bool& property) override
+ bool operator()(float alpha, const bool& property)
{
// Alpha is not useful here, just keeping to the same template as other update functors
return bool(alpha >= 1.0f ? (property || mRelative) : property);
bool mRelative;
};
-struct AnimateToBoolean : public AnimatorFunctionBase
+struct AnimateToBoolean
{
AnimateToBoolean(bool targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- bool operator()(float alpha, const bool& property) override
+ bool operator()(float alpha, const bool& property)
{
// Alpha is not useful here, just keeping to the same template as other update functors
return bool(alpha >= 1.0f ? mTarget : property);
bool mTarget;
};
-struct RotateByAngleAxis : public AnimatorFunctionBase
+struct RotateByAngleAxis
{
RotateByAngleAxis(const Radian& angleRadians, const Vector3& axis)
: mAngleRadians( angleRadians ),
{
}
- using AnimatorFunctionBase::operator();
- Quaternion operator()(float alpha, const Quaternion& rotation) override
+ Quaternion operator()(float alpha, const Quaternion& rotation)
{
if (alpha > 0.0f)
{
Vector3 mAxis;
};
-struct RotateToQuaternion : public AnimatorFunctionBase
+struct RotateToQuaternion
{
RotateToQuaternion(const Quaternion& targetValue)
: mTarget(targetValue)
{
}
- using AnimatorFunctionBase::operator();
- Quaternion operator()(float alpha, const Quaternion& rotation) override
+ Quaternion operator()(float alpha, const Quaternion& rotation)
{
return Quaternion::Slerp(rotation, mTarget, alpha);
}
Quaternion mTarget;
};
-
-struct KeyFrameBooleanFunctor : public AnimatorFunctionBase
+struct KeyFrameBooleanFunctor
{
- KeyFrameBooleanFunctor(KeyFrameBooleanPtr keyFrames)
- : mKeyFrames(keyFrames)
+ KeyFrameBooleanFunctor(KeyFrameBoolean keyFrames)
+ : mKeyFrames(std::move(keyFrames))
{
}
- using AnimatorFunctionBase::operator();
- bool operator()(float progress, const bool& property) override
+ bool operator()(float progress, const bool& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, Dali::Animation::LINEAR);
+ return mKeyFrames.GetValue(progress, Dali::Animation::LINEAR);
}
return property;
}
- KeyFrameBooleanPtr mKeyFrames;
+ KeyFrameBoolean mKeyFrames;
};
-struct KeyFrameIntegerFunctor : public AnimatorFunctionBase
+struct KeyFrameIntegerFunctor
{
- KeyFrameIntegerFunctor(KeyFrameIntegerPtr keyFrames, Interpolation interpolation)
- : mKeyFrames(keyFrames),mInterpolation(interpolation)
+ KeyFrameIntegerFunctor(KeyFrameInteger keyFrames, Interpolation interpolation)
+ : mKeyFrames(std::move(keyFrames)),
+ mInterpolation(interpolation)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float progress, const int32_t& property) override
+ float operator()(float progress, const int32_t& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return static_cast<float>( mKeyFrames->GetValue(progress, mInterpolation) );
+ return static_cast<float>(mKeyFrames.GetValue(progress, mInterpolation));
}
return static_cast<float>( property );
}
- KeyFrameIntegerPtr mKeyFrames;
+ KeyFrameInteger mKeyFrames;
Interpolation mInterpolation;
};
-struct KeyFrameNumberFunctor : public AnimatorFunctionBase
+struct KeyFrameNumberFunctor
{
- KeyFrameNumberFunctor(KeyFrameNumberPtr keyFrames, Interpolation interpolation)
- : mKeyFrames(keyFrames),mInterpolation(interpolation)
+ KeyFrameNumberFunctor(KeyFrameNumber keyFrames, Interpolation interpolation)
+ : mKeyFrames(std::move(keyFrames)),
+ mInterpolation(interpolation)
{
}
- using AnimatorFunctionBase::operator();
- float operator()(float progress, const float& property) override
+ float operator()(float progress, const float& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, mInterpolation);
+ return mKeyFrames.GetValue(progress, mInterpolation);
}
return property;
}
- KeyFrameNumberPtr mKeyFrames;
+ KeyFrameNumber mKeyFrames;
Interpolation mInterpolation;
};
-struct KeyFrameVector2Functor : public AnimatorFunctionBase
+struct KeyFrameVector2Functor
{
- KeyFrameVector2Functor(KeyFrameVector2Ptr keyFrames, Interpolation interpolation)
- : mKeyFrames(keyFrames),mInterpolation(interpolation)
+ KeyFrameVector2Functor(KeyFrameVector2 keyFrames, Interpolation interpolation)
+ : mKeyFrames(std::move(keyFrames)),
+ mInterpolation(interpolation)
{
}
- using AnimatorFunctionBase::operator();
- Vector2 operator()(float progress, const Vector2& property) override
+ Vector2 operator()(float progress, const Vector2& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, mInterpolation);
+ return mKeyFrames.GetValue(progress, mInterpolation);
}
return property;
}
- KeyFrameVector2Ptr mKeyFrames;
+ KeyFrameVector2 mKeyFrames;
Interpolation mInterpolation;
};
-
-struct KeyFrameVector3Functor : public AnimatorFunctionBase
+struct KeyFrameVector3Functor
{
- KeyFrameVector3Functor(KeyFrameVector3Ptr keyFrames, Interpolation interpolation)
- : mKeyFrames(keyFrames),mInterpolation(interpolation)
+ KeyFrameVector3Functor(KeyFrameVector3 keyFrames, Interpolation interpolation)
+ : mKeyFrames(std::move(keyFrames)),
+ mInterpolation(interpolation)
{
}
- using AnimatorFunctionBase::operator();
- Vector3 operator()(float progress, const Vector3& property) override
+ Vector3 operator()(float progress, const Vector3& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, mInterpolation);
+ return mKeyFrames.GetValue(progress, mInterpolation);
}
return property;
}
- KeyFrameVector3Ptr mKeyFrames;
+ KeyFrameVector3 mKeyFrames;
Interpolation mInterpolation;
};
-struct KeyFrameVector4Functor : public AnimatorFunctionBase
+struct KeyFrameVector4Functor
{
- KeyFrameVector4Functor(KeyFrameVector4Ptr keyFrames, Interpolation interpolation)
- : mKeyFrames(keyFrames),mInterpolation(interpolation)
+ KeyFrameVector4Functor(KeyFrameVector4 keyFrames, Interpolation interpolation)
+ : mKeyFrames(std::move(keyFrames)),
+ mInterpolation(interpolation)
{
}
- using AnimatorFunctionBase::operator();
- Vector4 operator()(float progress, const Vector4& property) override
+ Vector4 operator()(float progress, const Vector4& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, mInterpolation);
+ return mKeyFrames.GetValue(progress, mInterpolation);
}
return property;
}
- KeyFrameVector4Ptr mKeyFrames;
+ KeyFrameVector4 mKeyFrames;
Interpolation mInterpolation;
};
-struct KeyFrameQuaternionFunctor : public AnimatorFunctionBase
+struct KeyFrameQuaternionFunctor
{
- KeyFrameQuaternionFunctor(KeyFrameQuaternionPtr keyFrames)
- : mKeyFrames(keyFrames)
+ KeyFrameQuaternionFunctor(KeyFrameQuaternion keyFrames)
+ : mKeyFrames(std::move(keyFrames))
{
}
- using AnimatorFunctionBase::operator();
- Quaternion operator()(float progress, const Quaternion& property) override
+ Quaternion operator()(float progress, const Quaternion& property)
{
- if(mKeyFrames->IsActive(progress))
+ if(mKeyFrames.IsActive(progress))
{
- return mKeyFrames->GetValue(progress, Dali::Animation::LINEAR);
+ return mKeyFrames.GetValue(progress, Dali::Animation::LINEAR);
}
return property;
}
- KeyFrameQuaternionPtr mKeyFrames;
+ KeyFrameQuaternion mKeyFrames;
};
-struct PathPositionFunctor : public AnimatorFunctionBase
+struct PathPositionFunctor
{
PathPositionFunctor( PathPtr path )
: mPath(path)
{
}
- using AnimatorFunctionBase::operator();
- Vector3 operator()(float progress, const Vector3& property) override
+ Vector3 operator()(float progress, const Vector3& property)
{
Vector3 position(property);
static_cast<void>( mPath->SamplePosition(progress, position) );
PathPtr mPath;
};
-struct PathRotationFunctor : public AnimatorFunctionBase
+struct PathRotationFunctor
{
PathRotationFunctor( PathPtr path, const Vector3& forward )
: mPath(path),
mForward.Normalize();
}
- using AnimatorFunctionBase::operator();
- Quaternion operator()(float progress, const Quaternion& property) override
+ Quaternion operator()(float progress, const Quaternion& property)
{
Vector3 tangent;
if( mPath->SampleTangent(progress, tangent) )
/**
* Virtual destructor.
*/
- ~Constraint() override
- {
- }
+ ~Constraint() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::ConstraintBase::Apply()
/**
* Virtual destructor.
*/
- ~AnimatablePropertyBase() override
- {}
+ ~AnimatablePropertyBase() override = default;
protected: // for derived classes
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~AnimatableProperty() override
- {
- }
+ ~AnimatableProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
{
}
-DiscardQueue::~DiscardQueue()
-{
-}
+DiscardQueue::~DiscardQueue() = default;
void DiscardQueue::Add( BufferIndex updateBufferIndex, Node* node )
{
/**
* Virtual destructor.
*/
- ~InheritedVector3() override
- {
- }
+ ~InheritedVector3() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~InheritedColor() override
- {
- }
+ ~InheritedColor() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~InheritedQuaternion() override
- {
- }
+ ~InheritedQuaternion() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~InheritedMatrix() override
- {
- }
+ ~InheritedMatrix() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
namespace SceneGraph
{
+PropertyBase::PropertyBase() = default;
-PropertyBase::PropertyBase()
-{
-}
-
-PropertyBase::~PropertyBase()
-{
-}
+PropertyBase::~PropertyBase() = default;
} // namespace SceneGraph
// Messages for a property owner
-PropertyOwnerMessageBase::PropertyOwnerMessageBase()
-{
-}
+PropertyOwnerMessageBase::PropertyOwnerMessageBase() = default;
-PropertyOwnerMessageBase::~PropertyOwnerMessageBase()
-{
-}
+PropertyOwnerMessageBase::~PropertyOwnerMessageBase() = default;
} // namespace SceneGraph
/**
* Virtual destructor
*/
- ~AnimatablePropertyMessage() override
- {
- }
+ ~AnimatablePropertyMessage() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~AnimatablePropertyComponentMessage() override
- {
- }
+ ~AnimatablePropertyComponentMessage() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~Observer() {}
-
+ virtual ~Observer() = default;
};
/**
{
}
-SceneGraphBuffers::~SceneGraphBuffers()
-{
-}
+SceneGraphBuffers::~SceneGraphBuffers() = default;
void SceneGraphBuffers::Swap()
{
{
namespace SceneGraph
{
+ConnectionChangePropagator::ConnectionChangePropagator() = default;
-ConnectionChangePropagator::ConnectionChangePropagator()
-{
-}
-
-ConnectionChangePropagator::~ConnectionChangePropagator()
-{
-}
+ConnectionChangePropagator::~ConnectionChangePropagator() = default;
void ConnectionChangePropagator::Add(Observer& observer)
{
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~Observer() {}
-
+ virtual ~Observer() = default;
};
/**
}
}
-PropertyNotification::~PropertyNotification()
-{
-}
+PropertyNotification::~PropertyNotification() = default;
bool PropertyNotification::EvalFalse( const Dali::PropertyInput& value, RawArgumentContainer& arg )
{
{
namespace SceneGraph
{
-
-UniformMap::UniformMap()
-{
-}
+UniformMap::UniformMap() = default;
UniformMap::~UniformMap()
{
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~Observer() {}
+ virtual ~Observer() = default;
};
/**
{
}
-RenderMessageDispatcher::~RenderMessageDispatcher()
-{
-}
+RenderMessageDispatcher::~RenderMessageDispatcher() = default;
void RenderMessageDispatcher::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
{
{
}
-SceneControllerImpl::~SceneControllerImpl()
-{
-}
+SceneControllerImpl::~SceneControllerImpl() = default;
} // namespace SceneGraph
/**
* Constructor
*/
- SceneController()
- {
- }
+ SceneController() = default;
/**
* Destructor
*/
- virtual ~SceneController()
- {
- }
+ virtual ~SceneController() = default;
/**
* Return the render message dispatcher
/**
* Virtual destructor.
*/
- ~GestureProperty() override
- {
- }
+ ~GestureProperty() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~GesturePropertyVector2() override
- {
- }
+ ~GesturePropertyVector2() override = default;
/**
* @copydoc Dali::PropertyInput::GetVector2()
/**
* Virtual destructor.
*/
- ~GesturePropertyBool() override
- {
- }
+ ~GesturePropertyBool() override = default;
/**
* @copydoc Dali::PropertyInput::GetBoolean()
*/
struct Info
{
- Info()
- {
- }
+ Info() = default;
/**
* Copy constructor
*/
- Info( const Info& rhs )
- : velocity( rhs.velocity ),
- displacement( rhs.displacement ),
- position( rhs.position )
- {
- }
+ Info(const Info& rhs) = default;
/**
* Assignment operator
{
}
-FrameCallbackProcessor::~FrameCallbackProcessor()
-{
-}
+FrameCallbackProcessor::~FrameCallbackProcessor() = default;
void FrameCallbackProcessor::AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode )
{
/**
* Destructor
*/
- ~FreeList()
- {}
+ ~FreeList() = default;
/**
* Adds a new item to the list. If there is no more space in the vector it will
mSortComparitors.PushBack( CompareItems3DWithClipping );
}
-RenderInstructionProcessor::~RenderInstructionProcessor()
-{
-}
+RenderInstructionProcessor::~RenderInstructionProcessor() = default;
inline void RenderInstructionProcessor::SortRenderItems( BufferIndex bufferIndex, RenderList& renderList, Layer& layer, bool respectClippingOrder )
{
// Set the information in the node.
node.SetClippingInformation( currentClippingId, clippingDepth, scissorDepth );
+ RenderableContainer& target = DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) ?
+ layer->colorRenderables : layer->overlayRenderables;
for( uint32_t i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
+ target.PushBack( Renderable( &node, renderer ) );
- // Normal is the more-likely draw mode to occur.
- if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) )
- {
- layer->colorRenderables.PushBack( Renderable( &node, renderer ) );
- }
- else
- {
- layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
- }
-
- if( renderer->GetRenderingBehavior() == DevelRenderer::Rendering::CONTINUOUSLY )
- {
- keepRendering = true;
- }
+ keepRendering = keepRendering || ( renderer->GetRenderingBehavior() == DevelRenderer::Rendering::CONTINUOUSLY );
}
// Recurse children.
} // Anonymous namespace.
-RenderTaskProcessor::RenderTaskProcessor()
-{
-}
+RenderTaskProcessor::RenderTaskProcessor() = default;
-RenderTaskProcessor::~RenderTaskProcessor()
-{
-}
+RenderTaskProcessor::~RenderTaskProcessor() = default;
bool RenderTaskProcessor::Process( BufferIndex updateBufferIndex,
RenderTaskList& renderTasks,
/**
* Virtual destructor.
*/
- ~TransformManagerVector3Input() override
- {
- }
+ ~TransformManagerVector3Input() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~TransformManagerQuaternionInput() override
- {
- }
+ ~TransformManagerQuaternionInput() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/**
* Virtual destructor.
*/
- ~TransformManagerMatrixInput() override
- {
- }
+ ~TransformManagerMatrixInput() override = default;
/**
* @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
/*
- * 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.
mReorder(false)
{}
-TransformManager::~TransformManager()
-{}
+TransformManager::~TransformManager() = default;
TransformId TransformManager::CreateTransform()
{
}
}
-void TransformManager::Update()
+bool TransformManager::Update()
{
+ bool componentsChanged = false;
+
if( mReorder )
{
//If some transform component has change its parent or has been removed since last update
mBoundingSpheres[i] = mWorld[i].GetTranslation();
mBoundingSpheres[i].w = Length( centerToEdgeWorldSpace );
+ componentsChanged = componentsChanged || mComponentDirty[i];
mComponentDirty[i] = false;
}
+
+ return componentsChanged;
}
void TransformManager::SwapComponents( unsigned int i, unsigned int j )
case TRANSFORM_PROPERTY_POSITION:
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mPosition;
}
case TRANSFORM_PROPERTY_SCALE:
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mScale;
}
case TRANSFORM_PROPERTY_PARENT_ORIGIN:
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mTxComponentStatic[ index ].mParentOrigin;
}
case TRANSFORM_PROPERTY_ANCHOR_POINT:
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mTxComponentStatic[ index ].mAnchorPoint;
}
case TRANSFORM_PROPERTY_SIZE:
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mSize[ index ];
}
default:
Quaternion& TransformManager::GetQuaternionPropertyValue( TransformId id )
{
TransformId index( mIds[id] );
- mComponentDirty[ index ] = true;
return mTxComponentAnimatable[ index ].mOrientation;
}
#define DALI_INTERNAL_TRANSFORM_MANAGER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Recomputes all world transform matrices
+ * @return true if any component has been changed in this frame, false otherwise
*/
- void Update();
+ bool Update();
/**
* Resets all the animatable properties to its base value
previousUpdateScene( false ),
renderTaskWaiting( false ),
renderersAdded( false ),
- surfaceRectChanged( false )
+ surfaceRectChanged( false ),
+ renderingRequired( false )
{
sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue );
bool renderTaskWaiting; ///< A REFRESH_ONCE render task is waiting to be rendered
bool renderersAdded; ///< Flag to keep track when renderers have been added to avoid unnecessary processing
bool surfaceRectChanged; ///< True if the default surface rect is changed
+ bool renderingRequired; ///< True if required to render the current frame
private:
return gestureUpdated;
}
-void UpdateManager::Animate( BufferIndex bufferIndex, float elapsedSeconds )
+bool UpdateManager::Animate( BufferIndex bufferIndex, float elapsedSeconds )
{
+ bool animationActive = false;
+
auto&& iter = mImpl->animations.Begin();
bool animationLooped = false;
bool progressMarkerReached = false;
animation->Update( bufferIndex, elapsedSeconds, looped, finished, progressMarkerReached );
+ animationActive = animationActive || animation->IsActive();
+
if ( progressMarkerReached )
{
mImpl->notificationManager.QueueMessage( Internal::NotifyProgressReachedMessage( mImpl->animationPlaylist, animation ) );
// The application should be notified by NotificationManager, in another thread
mImpl->notificationManager.QueueCompleteNotification( &mImpl->animationPlaylist );
}
+
+ return animationActive;
}
void UpdateManager::ConstrainCustomObjects( BufferIndex bufferIndex )
//Apply constraints
ConstrainPropertyOwner( *renderer, bufferIndex );
- renderer->PrepareRender( bufferIndex );
+ mImpl->renderingRequired = renderer->PrepareRender( bufferIndex ) || mImpl->renderingRequired;
}
}
//Clear nodes/resources which were previously discarded
mImpl->discardQueue.Clear( bufferIndex );
+ bool isAnimationRunning = IsAnimationRunning();
+
//Process Touches & Gestures
const bool gestureUpdated = ProcessGestures( bufferIndex, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds );
bool updateScene = // The scene-graph requires an update if..
(mImpl->nodeDirtyFlags & RenderableUpdateFlags) || // ..nodes were dirty in previous frame OR
- IsAnimationRunning() || // ..at least one animation is running OR
+ isAnimationRunning || // ..at least one animation is running OR
mImpl->messageQueue.IsSceneUpdateRequired() || // ..a message that modifies the scene graph node tree is queued OR
mImpl->frameCallbackProcessor || // ..a frame callback processor is existed OR
gestureUpdated; // ..a gesture property was updated
bool keepRendererRendering = false;
+ mImpl->renderingRequired = false;
// Although the scene-graph may not require an update, we still need to synchronize double-buffered
// values if the scene was updated in the previous frame.
if( updateScene || mImpl->previousUpdateScene )
{
//Animate
- Animate( bufferIndex, elapsedSeconds );
+ bool animationActive = Animate( bufferIndex, elapsedSeconds );
//Constraint custom objects
ConstrainCustomObjects( bufferIndex );
UpdateRenderers( bufferIndex );
//Update the transformations of all the nodes
- mImpl->transformManager.Update();
+ if ( mImpl->transformManager.Update() )
+ {
+ mImpl->nodeDirtyFlags |= NodePropertyFlags::TRANSFORM;
+ }
//Process Property Notifications
ProcessPropertyNotifications( bufferIndex );
}
}
-
std::size_t numberOfRenderInstructions = 0;
for ( auto&& scene : mImpl->scenes )
{
scene->scene->GetRenderInstructions().ResetAndReserve( bufferIndex,
static_cast<uint32_t>( scene->taskList->GetTasks().Count() ) );
- keepRendererRendering |= mImpl->renderTaskProcessor.Process( bufferIndex,
- *scene->taskList,
- *scene->root,
- scene->sortedLayerList,
- scene->scene->GetRenderInstructions(),
- renderToFboEnabled,
- isRenderingToFbo );
+ // If there are animations running, only add render instruction if at least one animation is currently active (i.e. not delayed)
+ // or the nodes are dirty
+ if ( !isAnimationRunning || animationActive || mImpl->renderingRequired || (mImpl->nodeDirtyFlags & RenderableUpdateFlags) )
+ {
+ keepRendererRendering |= mImpl->renderTaskProcessor.Process( bufferIndex,
+ *scene->taskList,
+ *scene->root,
+ scene->sortedLayerList,
+ scene->scene->GetRenderInstructions(),
+ renderToFboEnabled,
+ isRenderingToFbo );
+
+ }
numberOfRenderInstructions += scene->scene->GetRenderInstructions().Count( bufferIndex );
}
mImpl->renderingBehavior = renderingBehavior;
}
+void UpdateManager::RequestRendering()
+{
+ mImpl->renderingRequired = true;
+}
+
void UpdateManager::SetLayerDepths( const SortedLayerPointers& layers, const Layer* rootLayer )
{
for ( auto&& scene : mImpl->scenes )
struct NodeDepths
{
- NodeDepths()
- {
- }
+ NodeDepths() = default;
void Add( SceneGraph::Node* node, uint32_t sortedDepth )
{
void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
/**
+ * Request to render the current frame
+ * @note This is a temporary workaround (to be removed in the future) to request the rendering of
+ * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
+ * for any other purposes.
+ */
+ void RequestRendering();
+
+ /**
* Sets the depths of all layers.
* @param layers The layers in depth order.
* @param[in] rootLayer The root layer of the sorted layers.
* Perform animation updates
* @param[in] bufferIndex to use
* @param[in] elapsedSeconds time since last frame
+ * @return true if at least one animations is currently active or false otherwise
*/
- void Animate( BufferIndex bufferIndex, float elapsedSeconds );
+ bool Animate( BufferIndex bufferIndex, float elapsedSeconds );
/**
* Applies constraints to CustomObjects
new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
}
+inline void RequestRenderingMessage( UpdateManager& manager )
+{
+ using LocalType = Message<UpdateManager>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::RequestRendering );
+}
+
/**
* Create a message for setting the depth of a layer
* @param[in] manager The update manager
/**
* Virtual destructor
*/
- ~IndexBufferMessage() override
- {
- }
+ ~IndexBufferMessage() override = default;
/**
* @copydoc MessageBase::Process
{
}
-UpdateProxy::~UpdateProxy()
-{
-}
+UpdateProxy::~UpdateProxy() = default;
bool UpdateProxy::GetPosition( uint32_t id, Vector3& position ) const
{
{
}
-NodePropertyMessageBase::~NodePropertyMessageBase()
-{
-}
+NodePropertyMessageBase::~NodePropertyMessageBase() = default;
} // namespace SceneGraph
/**
* Virtual destructor
*/
- ~NodePropertyMessage() override
- {
- }
+ ~NodePropertyMessage() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~NodePropertyComponentMessage() override
- {
- }
+ ~NodePropertyComponentMessage() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~NodeTransformPropertyMessage() override
- {
- }
+ ~NodeTransformPropertyMessage() override = default;
/**
* @copydoc MessageBase::Process
/**
* Virtual destructor
*/
- ~NodeTransformComponentMessage() override
- {
- }
+ ~NodeTransformComponentMessage() override = default;
/**
* @copydoc MessageBase::Process
mAllChildTransformsClean[ 1 ] = false;
}
-Layer::~Layer()
-{
-}
+Layer::~Layer() = default;
void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
{
return new Camera();
}
-Camera::~Camera()
-{
-}
+Camera::~Camera() = default;
void Camera::SetNode( const Node* node )
{
{
}
-RenderTaskList::~RenderTaskList()
-{
-}
+RenderTaskList::~RenderTaskList() = default;
void RenderTaskList::operator delete( void* ptr )
{
/*
- * 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.
}
-void Renderer::PrepareRender( BufferIndex updateBufferIndex )
+bool Renderer::PrepareRender( BufferIndex updateBufferIndex )
{
if( mRegenerateUniformMap == UNIFORM_MAP_READY )
{
mRegenerateUniformMap--;
}
+ bool rendererUpdated = mUniformMapChanged[updateBufferIndex] || mResendFlag;
+
if( mResendFlag != 0 )
{
if( mResendFlag & RESEND_GEOMETRY )
mResendFlag = 0;
}
+
+ return rendererUpdated;
}
void Renderer::SetTextures( TextureSet* textureSet )
#define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Prepare the object for rendering.
* This is called by the UpdateManager when an object is due to be rendered in the current frame.
* @param[in] updateBufferIndex The current update buffer index.
+ * @return Whether this renderer has been updated in the current frame
*/
- void PrepareRender( BufferIndex updateBufferIndex );
+ bool PrepareRender( BufferIndex updateBufferIndex );
/**
* Retrieve the Render thread renderer
namespace Dali
{
-Actor::Actor()
-{
-}
+Actor::Actor() = default;
Actor Actor::New()
{
return Actor(dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()));
}
-Actor::~Actor()
-{
-}
+Actor::~Actor() = default;
Actor::Actor(const Actor& copy) = default;
return CameraActor(dynamic_cast<Dali::Internal::CameraActor*>(handle.GetObjectPtr()));
}
-CameraActor::CameraActor()
-{
-}
+CameraActor::CameraActor() = default;
-CameraActor::~CameraActor()
-{
-}
+CameraActor::~CameraActor() = default;
-CameraActor::CameraActor(const CameraActor& copy)
-: Actor(copy)
-{
-}
+CameraActor::CameraActor(const CameraActor& copy) = default;
CameraActor& CameraActor::operator=(const CameraActor& rhs)
{
{
}
-CustomActorImpl::~CustomActorImpl()
-{
-}
+CustomActorImpl::~CustomActorImpl() = default;
void CustomActorImpl::Initialize(Internal::CustomActor& owner)
{
} // namespace
-CustomActor::CustomActor()
-{
-}
+CustomActor::CustomActor() = default;
CustomActor CustomActor::DownCast(BaseHandle handle)
{
return CustomActor(dynamic_cast<Dali::Internal::CustomActor*>(handle.GetObjectPtr()));
}
-CustomActor::~CustomActor()
-{
-}
+CustomActor::~CustomActor() = default;
CustomActor::CustomActor(const CustomActor& copy) = default;
{
using Dali::Layer;
-Layer::Layer()
-{
-}
+Layer::Layer() = default;
Layer Layer::New()
{
return Layer(dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()));
}
-Layer::~Layer()
-{
-}
+Layer::~Layer() = default;
Layer::Layer(const Layer& copy) = default;
namespace Dali
{
-Animation::Animation()
-{
-}
+Animation::Animation() = default;
Animation::Animation(Internal::Animation* animation)
: BaseHandle(animation)
return Animation(dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()));
}
-Animation::~Animation()
-{
-}
+Animation::~Animation() = default;
Animation::Animation(const Animation& handle) = default;
*/
// EXTERNAL INCLUDES
-#include <cstdint> // uint32_t
+#include <cstdint> // uint32_t, uint8_t
// INTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
* @brief Enumeration for what to do when the animation ends, is stopped, or is destroyed.
* @SINCE_1_0.0
*/
- enum EndAction
+ enum EndAction : uint8_t
{
BAKE, ///< When the animation ends, the animated property values are saved. @SINCE_1_0.0
DISCARD, ///< When the animation ends, the animated property values are forgotten. @SINCE_1_0.0
* @brief Enumeration for what interpolation method to use on key-frame animations.
* @SINCE_1_0.0
*/
- enum Interpolation
+ enum Interpolation : uint8_t
{
LINEAR, ///< Values in between key frames are interpolated using a linear polynomial. (Default) @SINCE_1_0.0
CUBIC ///< Values in between key frames are interpolated using a cubic polynomial. @SINCE_1_0.0
*
* @SINCE_1_1.21
*/
- enum State
+ enum State : uint8_t
{
STOPPED, ///< Animation has stopped @SINCE_1_1.21
PLAYING, ///< The animation is playing @SINCE_1_1.21
*
* @SINCE_1_2.60
*/
- enum LoopingMode
+ enum LoopingMode : uint8_t
{
RESTART, ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. @SINCE_1_2.60
AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. @SINCE_1_2.60
const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::BAKE;
-Constraint::Constraint()
-{
-}
+Constraint::Constraint() = default;
Constraint Constraint::Clone(Handle object)
{
return Constraint(GetImplementation(*this).Clone(GetImplementation(object)));
}
-Constraint::~Constraint()
-{
-}
+Constraint::~Constraint() = default;
Constraint::Constraint(const Constraint& constraint) = default;
* @brief Constructor.
* @SINCE_1_0.0
*/
- EqualToConstraint()
- {
- }
+ EqualToConstraint() = default;
/**
* @brief Overrides functor for float properties.
return KeyFrames(dynamic_cast<Dali::Internal::KeyFrames*>(handle.GetObjectPtr()));
}
-KeyFrames::KeyFrames()
-{
-}
+KeyFrames::KeyFrames() = default;
-KeyFrames::~KeyFrames()
-{
-}
+KeyFrames::~KeyFrames() = default;
KeyFrames::KeyFrames(const KeyFrames& handle) = default;
void KeyFrames::Add(float time, Property::Value value)
{
- Add(time, value, AlphaFunction::DEFAULT);
+ Add(time, std::move(value), AlphaFunction::DEFAULT);
}
void KeyFrames::Add(float time, Property::Value value, AlphaFunction alpha)
return LinearConstrainer(dynamic_cast<Dali::Internal::LinearConstrainer*>(handle.GetObjectPtr()));
}
-LinearConstrainer::LinearConstrainer()
-{
-}
+LinearConstrainer::LinearConstrainer() = default;
-LinearConstrainer::~LinearConstrainer()
-{
-}
+LinearConstrainer::~LinearConstrainer() = default;
LinearConstrainer::LinearConstrainer(const LinearConstrainer& handle) = default;
return Path(dynamic_cast<Dali::Internal::Path*>(handle.GetObjectPtr()));
}
-Path::Path()
-{
-}
+Path::Path() = default;
-Path::~Path()
-{
-}
+Path::~Path() = default;
Path::Path(const Path& handle) = default;
{
}
-TimePeriod::~TimePeriod()
-{
-}
+TimePeriod::~TimePeriod() = default;
} // namespace Dali
{
}
-VectorBase::~VectorBase()
-{
-}
+VectorBase::~VectorBase() = default;
VectorBase::SizeType VectorBase::Capacity() const
{
* @brief Empty constructor.
* @SINCE_1_0.0
*/
- VectorAlgorithms()
- {
- }
+ VectorAlgorithms() = default;
/**
* @brief Empty destructor.
* @SINCE_1_0.0
*/
- ~VectorAlgorithms()
- {
- }
+ ~VectorAlgorithms() = default;
/**
* @brief Copy vector contents.
class VectorAlgorithms<false> : public VectorBase
{
private:
- VectorAlgorithms()
- {
- }
- ~VectorAlgorithms()
- {
- }
+ VectorAlgorithms() = default;
+ ~VectorAlgorithms() = default;
};
/// @endcond
* @brief Default constructor. Does not allocate any space.
* @SINCE_1_0.0
*/
- Vector()
- {
- }
+ Vector() = default;
/**
* @brief Destructor. Releases the allocated space.
namespace Dali
{
-const uint32_t CORE_MAJOR_VERSION = 1;
-const uint32_t CORE_MINOR_VERSION = 9;
-const uint32_t CORE_MICRO_VERSION = 34;
+const uint32_t CORE_MAJOR_VERSION = 2;
+const uint32_t CORE_MINOR_VERSION = 0;
+const uint32_t CORE_MICRO_VERSION = 1;
const char* const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
{
}
-GestureDetector::GestureDetector()
-{
-}
+GestureDetector::GestureDetector() = default;
GestureDetector GestureDetector::DownCast(BaseHandle handle)
{
return GestureDetector(dynamic_cast<Dali::Internal::GestureDetector*>(handle.GetObjectPtr()));
}
-GestureDetector::~GestureDetector()
-{
-}
+GestureDetector::~GestureDetector() = default;
-GestureDetector::GestureDetector(const GestureDetector& handle)
-: Handle(handle)
-{
-}
+GestureDetector::GestureDetector(const GestureDetector& handle) = default;
GestureDetector& GestureDetector::operator=(const GestureDetector& rhs)
{
namespace Dali
{
-Gesture::Gesture()
-{
-}
+Gesture::Gesture() = default;
Gesture::Gesture(Internal::Gesture* internal)
: BaseHandle(internal)
Gesture& Gesture::operator=(Gesture&& rhs) = default;
-Gesture::~Gesture()
-{
-}
+Gesture::~Gesture() = default;
GestureType::Value Gesture::GetType() const
{
HoverEvent::HoverEvent(HoverEvent&& rhs) = default;
-HoverEvent::~HoverEvent()
-{
-}
+HoverEvent::~HoverEvent() = default;
HoverEvent& HoverEvent::operator=(const HoverEvent& rhs) = default;
KeyEvent::KeyEvent(KeyEvent&& rhs) = default;
-KeyEvent::~KeyEvent()
-{
-}
+KeyEvent::~KeyEvent() = default;
KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) = default;
{
}
-LongPressGestureDetector::LongPressGestureDetector()
-{
-}
+LongPressGestureDetector::LongPressGestureDetector() = default;
LongPressGestureDetector LongPressGestureDetector::New()
{
return LongPressGestureDetector(dynamic_cast<Dali::Internal::LongPressGestureDetector*>(handle.GetObjectPtr()));
}
-LongPressGestureDetector::~LongPressGestureDetector()
-{
-}
+LongPressGestureDetector::~LongPressGestureDetector() = default;
-LongPressGestureDetector::LongPressGestureDetector(const LongPressGestureDetector& handle)
-: GestureDetector(handle)
-{
-}
+LongPressGestureDetector::LongPressGestureDetector(const LongPressGestureDetector& handle) = default;
LongPressGestureDetector& LongPressGestureDetector::operator=(const LongPressGestureDetector& rhs)
{
{
}
-PanGestureDetector::PanGestureDetector()
-{
-}
+PanGestureDetector::PanGestureDetector() = default;
PanGestureDetector PanGestureDetector::New()
{
return PanGestureDetector(dynamic_cast<Dali::Internal::PanGestureDetector*>(handle.GetObjectPtr()));
}
-PanGestureDetector::~PanGestureDetector()
-{
-}
+PanGestureDetector::~PanGestureDetector() = default;
-PanGestureDetector::PanGestureDetector(const PanGestureDetector& handle)
-: GestureDetector(handle)
-{
-}
+PanGestureDetector::PanGestureDetector(const PanGestureDetector& handle) = default;
PanGestureDetector& PanGestureDetector::operator=(const PanGestureDetector& rhs)
{
{
}
-PinchGestureDetector::PinchGestureDetector()
-{
-}
+PinchGestureDetector::PinchGestureDetector() = default;
PinchGestureDetector PinchGestureDetector::New()
{
return PinchGestureDetector(dynamic_cast<Dali::Internal::PinchGestureDetector*>(handle.GetObjectPtr()));
}
-PinchGestureDetector::~PinchGestureDetector()
-{
-}
+PinchGestureDetector::~PinchGestureDetector() = default;
-PinchGestureDetector::PinchGestureDetector(const PinchGestureDetector& handle)
-: GestureDetector(handle)
-{
-}
+PinchGestureDetector::PinchGestureDetector(const PinchGestureDetector& handle) = default;
PinchGestureDetector& PinchGestureDetector::operator=(const PinchGestureDetector& rhs)
{
{
}
-RotationGestureDetector::RotationGestureDetector()
-{
-}
+RotationGestureDetector::RotationGestureDetector() = default;
RotationGestureDetector RotationGestureDetector::New()
{
return RotationGestureDetector(dynamic_cast<Dali::Internal::RotationGestureDetector*>(handle.GetObjectPtr()));
}
-RotationGestureDetector::~RotationGestureDetector()
-{
-}
+RotationGestureDetector::~RotationGestureDetector() = default;
-RotationGestureDetector::RotationGestureDetector(const RotationGestureDetector& handle)
-: GestureDetector(handle)
-{
-}
+RotationGestureDetector::RotationGestureDetector(const RotationGestureDetector& handle) = default;
RotationGestureDetector& RotationGestureDetector::operator=(const RotationGestureDetector& rhs)
{
{
}
-TapGestureDetector::TapGestureDetector()
-{
-}
+TapGestureDetector::TapGestureDetector() = default;
TapGestureDetector TapGestureDetector::New()
{
return TapGestureDetector(dynamic_cast<Dali::Internal::TapGestureDetector*>(handle.GetObjectPtr()));
}
-TapGestureDetector::~TapGestureDetector()
-{
-}
+TapGestureDetector::~TapGestureDetector() = default;
-TapGestureDetector::TapGestureDetector(const TapGestureDetector& handle)
-: GestureDetector(handle)
-{
-}
+TapGestureDetector::TapGestureDetector(const TapGestureDetector& handle) = default;
TapGestureDetector& TapGestureDetector::operator=(const TapGestureDetector& rhs)
{
WheelEvent::WheelEvent(WheelEvent&& rhs) = default;
-WheelEvent::~WheelEvent()
-{
-}
+WheelEvent::~WheelEvent() = default;
WheelEvent& WheelEvent::operator=(const WheelEvent& rhs) = default;
* The implementation should destroy the NativeImage resources.
* @SINCE_1_0.0
*/
- ~NativeImageInterface() override
- {
- }
+ ~NativeImageInterface() override = default;
};
/**
return PixelData(internal.Get());
}
-PixelData::PixelData()
-{
-}
+PixelData::PixelData() = default;
-PixelData::~PixelData()
-{
-}
+PixelData::~PixelData() = default;
PixelData::PixelData(Internal::PixelData* internal)
: BaseHandle(internal)
* @brief Destructor.
* @SINCE_1_0.0
*/
- ~Matrix3()
- {
- }
+ ~Matrix3() = default;
/**
* @brief Sets the matrix to the identity matrix.
}
}
-Quaternion::~Quaternion()
-{
-}
+Quaternion::~Quaternion() = default;
bool Quaternion::IsIdentity() const
{
{
}
-BaseHandle::BaseHandle()
-{
-}
+BaseHandle::BaseHandle() = default;
-BaseHandle::~BaseHandle()
-{
-}
+BaseHandle::~BaseHandle() = default;
BaseHandle::BaseHandle(const BaseHandle& handle) = default;
{
}
-BaseObject::~BaseObject()
-{
-}
+BaseObject::~BaseObject() = default;
void BaseObject::RegisterObject()
{
{
}
-Handle::Handle()
-{
-}
+Handle::Handle() = default;
Handle Handle::New()
{
return Handle(Internal::Object::New().Get());
}
-Handle::~Handle()
-{
-}
+Handle::~Handle() = default;
Handle::Handle(const Handle& handle) = default;
namespace Dali
{
-ObjectRegistry::ObjectRegistry()
-{
-}
+ObjectRegistry::ObjectRegistry() = default;
-ObjectRegistry::~ObjectRegistry()
-{
-}
+ObjectRegistry::~ObjectRegistry() = default;
ObjectRegistry::ObjectRegistry(const ObjectRegistry& copy) = default;
{
}
-PropertyCondition::~PropertyCondition()
-{
-}
+PropertyCondition::~PropertyCondition() = default;
PropertyCondition::PropertyCondition(const PropertyCondition& handle) = default;
namespace Dali
{
-PropertyInput::~PropertyInput()
-{
-}
+PropertyInput::~PropertyInput() = default;
} // namespace Dali
return mImpl->mStringValueContainer.empty() && mImpl->mIndexValueContainer.empty();
}
-void Property::Map::Insert(const char* key, const Value& value)
+void Property::Map::Insert(std::string key, Value value)
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- mImpl->mStringValueContainer.push_back(std::make_pair(key, value));
+ mImpl->mStringValueContainer.push_back(std::make_pair(std::move(key), std::move(value)));
}
-void Property::Map::Insert(const std::string& key, const Value& value)
+void Property::Map::Insert(Property::Index key, Value value)
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- mImpl->mStringValueContainer.push_back(std::make_pair(key, value));
-}
-
-void Property::Map::Insert(Property::Index key, const Value& value)
-{
- DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- mImpl->mIndexValueContainer.push_back(std::make_pair(key, value));
+ mImpl->mIndexValueContainer.push_back(std::make_pair(key, std::move(value)));
}
Property::Value& Property::Map::GetValue(SizeType position) const
}
else
{
- Key key(mImpl->mIndexValueContainer[position - numStringKeys].first);
- KeyValuePair keyValue(key, mImpl->mIndexValueContainer[position - numStringKeys].second);
- return keyValue;
+ return mImpl->mIndexValueContainer[position - numStringKeys];
}
}
-Property::Value* Property::Map::Find(const char* key) const
+Property::Value* Property::Map::Find(std::string_view key) const
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
for(auto&& iter : mImpl->mStringValueContainer)
{
- if(iter.first == key)
+ if(key == iter.first)
{
return &iter.second;
}
return nullptr; // Not found
}
-Property::Value* Property::Map::Find(const std::string& key) const
-{
- return Find(key.c_str());
-}
-
Property::Value* Property::Map::Find(Property::Index key) const
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
return nullptr; // Not found
}
-Property::Value* Property::Map::Find(Property::Index indexKey, const std::string& stringKey) const
+Property::Value* Property::Map::Find(Property::Index indexKey, std::string_view stringKey) const
{
Property::Value* valuePtr = Find(indexKey);
if(!valuePtr)
return valuePtr;
}
-Property::Value* Property::Map::Find(const std::string& key, Property::Type type) const
+Property::Value* Property::Map::Find(std::string_view key, Property::Type type) const
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
for(auto&& iter : mImpl->mStringValueContainer)
{
- if((iter.second.GetType() == type) && (iter.first == key))
+ if((iter.second.GetType() == type) && (key == iter.first))
{
return &iter.second;
}
}
}
-const Property::Value& Property::Map::operator[](const std::string& key) const
+const Property::Value& Property::Map::operator[](std::string_view key) const
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
DALI_ASSERT_ALWAYS(!"Invalid Key");
}
-Property::Value& Property::Map::operator[](const std::string& key)
+Property::Value& Property::Map::operator[](std::string_view key)
{
DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
}
// Create and return reference to new value
- mImpl->mStringValueContainer.push_back(std::make_pair(key, Property::Value()));
- return (mImpl->mStringValueContainer.end() - 1)->second;
+ mImpl->mStringValueContainer.push_back(std::make_pair(std::string(key), Property::Value()));
+ return mImpl->mStringValueContainer.back().second;
}
const Property::Value& Property::Map::operator[](Property::Index key) const
// Create and return reference to new value
mImpl->mIndexValueContainer.push_back(std::make_pair(key, Property::Value()));
- return (mImpl->mIndexValueContainer.end() - 1)->second;
+ return mImpl->mIndexValueContainer.back().second;
}
Property::Map& Property::Map::operator=(const Property::Map& other)
#include <initializer_list>
#include <sstream>
#include <string>
+#include <string_view>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @param[in] key The key to insert
* @param[in] value The value to insert
*/
- void Insert(const char* key, const Value& value);
-
- /**
- * @brief Inserts the key-value pair in the Map, with the key type as string.
- *
- * Does not check for duplicates.
- * @SINCE_1_0.0
- * @param[in] key The key to insert
- * @param[in] value The value to insert
- */
- void Insert(const std::string& key, const Value& value);
+ void Insert(std::string key, Value value);
/**
* @brief Inserts the key-value pair in the Map, with the key type as index.
* @param[in] key The key to insert
* @param[in] value The value to insert
*/
- void Insert(Property::Index key, const Value& value);
+ void Insert(Property::Index key, Value value);
/**
* @brief Inserts the key-value pair in the Map, with the key type as string.
* @param value to insert
* @return a reference to this object
*/
- inline Property::Map& Add(const char* key, const Value& value)
+ Property::Map& Add(std::string key, Value value)
{
- Insert(key, value);
- return *this;
- }
-
- /**
- * @brief Inserts the key-value pair in the Map, with the key type as string.
- *
- * Does not check for duplicates
- * @SINCE_1_2.5
- * @param key to insert
- * @param value to insert
- * @return a reference to this object
- */
- inline Property::Map& Add(const std::string& key, const Value& value)
- {
- Insert(key, value);
+ Insert(std::move(key), std::move(value));
return *this;
}
* @param value to insert
* @return a reference to this object
*/
- inline Property::Map& Add(Property::Index key, const Value& value)
+ Property::Map& Add(Property::Index key, Value value)
{
- Insert(key, value);
+ Insert(key, std::move(value));
return *this;
}
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find(const char* key) const;
-
- /**
- * @brief Finds the value for the specified key if it exists.
- *
- * @SINCE_1_0.0
- * @param[in] key The key to find
- *
- * @return A const pointer to the value if it exists, NULL otherwise
- */
- Value* Find(const std::string& key) const;
+ Value* Find(std::string_view key) const;
/**
* @brief Finds the value for the specified key if it exists.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find(Property::Index indexKey, const std::string& stringKey) const;
+ Value* Find(Property::Index indexKey, std::string_view stringKey) const;
/**
* @brief Finds the value for the specified key if it exists and its type is type.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find(const std::string& key, Property::Type type) const;
+ Value* Find(std::string_view key, Property::Type type) const;
/**
* @brief Finds the value for the specified key if it exists and its type is type.
*
* @note Will assert if invalid-key is given.
*/
- const Value& operator[](const std::string& key) const;
+ const Value& operator[](std::string_view key) const;
/**
* @brief Operator to access the element with the specified string key.
*
* @note If an element with the key does not exist, then it is created.
*/
- Value& operator[](const std::string& key);
+ Value& operator[](std::string_view key);
/**
* @brief Const operator to access element with the specified index key.
namespace Dali
{
-PropertyNotification::PropertyNotification()
-{
-}
+PropertyNotification::PropertyNotification() = default;
PropertyNotification::PropertyNotification(Internal::PropertyNotification* propertyNotification)
: BaseHandle(propertyNotification)
return PropertyNotification(dynamic_cast<Dali::Internal::PropertyNotification*>(handle.GetObjectPtr()));
}
-PropertyNotification::~PropertyNotification()
-{
-}
+PropertyNotification::~PropertyNotification() = default;
PropertyNotification::PropertyNotification(const PropertyNotification& copy) = default;
propertyIndex = object.GetPropertyIndex(propertyName);
}
-Property::~Property()
-{
-}
+Property::~Property() = default;
} // namespace Dali
namespace Dali
{
-TypeInfo::TypeInfo()
-{
-}
+TypeInfo::TypeInfo() = default;
-TypeInfo::~TypeInfo()
-{
-}
+TypeInfo::~TypeInfo() = default;
TypeInfo::TypeInfo(const TypeInfo& copy) = default;
namespace Dali
{
-TypeRegistry::TypeRegistry()
-{
-}
+TypeRegistry::TypeRegistry() = default;
-TypeRegistry::~TypeRegistry()
-{
-}
+TypeRegistry::~TypeRegistry() = default;
TypeRegistry::TypeRegistry(const TypeRegistry& copy) = default;
/**
* @copydoc Dali::WeakHandleBase::~WeakHandleBase()
*/
- ~WeakHandle()
- {
- }
+ ~WeakHandle() = default;
/**
* @copydoc Dali::WeakHandleBase::WeakHandleBase(const WeakHandleBase&)
namespace Dali
{
-RenderTaskList::RenderTaskList()
-{
-}
+RenderTaskList::RenderTaskList() = default;
RenderTaskList RenderTaskList::DownCast(BaseHandle handle)
{
return RenderTaskList(dynamic_cast<Dali::Internal::RenderTaskList*>(handle.GetObjectPtr()));
}
-RenderTaskList::~RenderTaskList()
-{
-}
+RenderTaskList::~RenderTaskList() = default;
RenderTaskList::RenderTaskList(const RenderTaskList& handle) = default;
const bool RenderTask::DEFAULT_CULL_MODE = true;
const uint32_t RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
-RenderTask::RenderTask()
-{
-}
+RenderTask::RenderTask() = default;
RenderTask RenderTask::DownCast(BaseHandle handle)
{
return RenderTask(dynamic_cast<Dali::Internal::RenderTask*>(handle.GetObjectPtr()));
}
-RenderTask::~RenderTask()
-{
-}
+RenderTask::~RenderTask() = default;
RenderTask::RenderTask(const RenderTask& handle) = default;
return FrameBuffer(frameBuffer.Get());
}
-FrameBuffer::FrameBuffer()
-{
-}
+FrameBuffer::FrameBuffer() = default;
-FrameBuffer::~FrameBuffer()
-{
-}
+FrameBuffer::~FrameBuffer() = default;
FrameBuffer::FrameBuffer(const FrameBuffer& handle) = default;
return Geometry(geometry.Get());
}
-Geometry::Geometry()
-{
-}
+Geometry::Geometry() = default;
-Geometry::~Geometry()
-{
-}
+Geometry::~Geometry() = default;
Geometry::Geometry(const Geometry& handle) = default;
return Renderer(renderer.Get());
}
-Renderer::Renderer()
-{
-}
+Renderer::Renderer() = default;
-Renderer::~Renderer()
-{
-}
+Renderer::~Renderer() = default;
Renderer::Renderer(const Renderer& handle) = default;
return Sampler(sampler.Get());
}
-Sampler::Sampler()
-{
-}
+Sampler::Sampler() = default;
-Sampler::~Sampler()
-{
-}
+Sampler::~Sampler() = default;
Sampler::Sampler(const Sampler& handle) = default;
return Shader(renderer.Get());
}
-Shader::Shader()
-{
-}
+Shader::Shader() = default;
-Shader::~Shader()
-{
-}
+Shader::~Shader() = default;
Shader::Shader(const Shader& handle) = default;
{
}
+std::string Shader::GetShaderVersionPrefix()
+{
+ return Dali::Internal::Shader::GetShaderVersionPrefix();
+}
+
+std::string Shader::GetVertexShaderPrefix()
+{
+ return Dali::Internal::Shader::GetVertexShaderPrefix();
+}
+
+std::string Shader::GetFragmentShaderPrefix()
+{
+ return Dali::Internal::Shader::GetFragmentShaderPrefix();
+}
+
} // namespace Dali
*/
Shader& operator=(Shader&& rhs);
+ /**
+ * @brief Get shader preprocessor of shading language version.
+ * @note This can potentially block until GL has been initialized
+ * when the first time any DALi application is launched in the system.
+ * @SINCE_1_9.36
+ * @return shader preprocessor string.
+ */
+ static std::string GetShaderVersionPrefix();
+
+ /**
+ * @brief Get vertex shader preprocessor that includes shading language version.
+ * @note This can potentially block until GL has been initialized
+ * when the first time any DALi application is launched in the system.
+ * @SINCE_1_9.36
+ * @return Vertex shader preprocessor string.
+ */
+ static std::string GetVertexShaderPrefix();
+
+ /**
+ * @brief Get fragment shader preprocessor that includes shading language version.
+ * @note This can potentially block until GL has been initialized
+ * when the first time any DALi application is launched in the system.
+ * @SINCE_1_9.36
+ * @return Fragment shader preprocessor string.
+ */
+ static std::string GetFragmentShaderPrefix();
+
public:
/**
* @brief This constructor is used by Dali New() methods.
return TextureSet(textureSet.Get());
}
-TextureSet::TextureSet()
-{
-}
+TextureSet::TextureSet() = default;
-TextureSet::~TextureSet()
-{
-}
+TextureSet::~TextureSet() = default;
TextureSet::TextureSet(const TextureSet& handle) = default;
return Texture(texture.Get());
}
-Texture::Texture()
-{
-}
+Texture::Texture() = default;
-Texture::~Texture()
-{
-}
+Texture::~Texture() = default;
Texture::Texture(const Texture& handle) = default;
return VertexBuffer(vertexBuffer.Get());
}
-VertexBuffer::VertexBuffer()
-{
-}
+VertexBuffer::VertexBuffer() = default;
-VertexBuffer::~VertexBuffer()
-{
-}
+VertexBuffer::~VertexBuffer() = default;
VertexBuffer::VertexBuffer(const VertexBuffer& handle) = default;
namespace Dali
{
-ConnectionTrackerInterface::ConnectionTrackerInterface()
-{
-}
+ConnectionTrackerInterface::ConnectionTrackerInterface() = default;
-ConnectionTrackerInterface::~ConnectionTrackerInterface()
-{
-}
+ConnectionTrackerInterface::~ConnectionTrackerInterface() = default;
} // namespace Dali
namespace Dali
{
-ConnectionTracker::ConnectionTracker()
-{
-}
+ConnectionTracker::ConnectionTracker() = default;
ConnectionTracker::~ConnectionTracker()
{
namespace Dali
{
-SignalObserver::SignalObserver()
-{
-}
+SignalObserver::SignalObserver() = default;
-SignalObserver::~SignalObserver()
-{
-}
+SignalObserver::~SignalObserver() = default;
-SlotObserver::SlotObserver()
-{
-}
+SlotObserver::SlotObserver() = default;
-SlotObserver::~SlotObserver()
-{
-}
+SlotObserver::~SlotObserver() = default;
} // namespace Dali
*
* @SINCE_1_0.0
*/
- ~SlotDelegate()
- {
- }
+ ~SlotDelegate() = default;
/**
* @brief Disconnects all signals from this object.
*
* @SINCE_1_0.0
*/
- RelayoutContainer()
- {
- }
+ RelayoutContainer() = default;
/**
* @brief Virtual destructor.
* @SINCE_1_0.0
*/
- virtual ~RelayoutContainer()
- {
- }
+ virtual ~RelayoutContainer() = default;
/**
* @brief Adds relayout information to the container if it doesn't already exist.
Name: dali2
Summary: DALi 3D Engine
-Version: 1.9.34
+Version: 2.0.1
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT