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/;
{
my $filesref = shift;
- open( my $filehandle, ">", $opt_output ) || die "Can't open $opt_output for writing:$!\n";
+ 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");
- 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
+ my $body = HTML::Element->new('body');
+ $body->attr('bgcolor', "white");
- foreach my $file (keys(%$filesref))
+ foreach my $file (sort(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"};
- print "<h2>$file</h2>\n";
+ my $header = HTML::Element->new('h2');
+ $header->push_content($file);
+ $body->push_content($header);
+ $body->push_content("\n");
if($coverage_ref)
{
if( $coverage_ref->{"covered_lines"} > 0
||
$coverage_ref->{"uncovered_lines"} > 0 )
{
- print "<p style=\"color:green;\">Covered: " .
- $coverage_ref->{"covered_lines"} . "<p>" .
- "<p style=\"color:red;\">Uncovered: " .
- $coverage_ref->{"uncovered_lines"} . "</span></p>";
+ 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";
}
}
else
{
- print "<p>";
- my $span=0;
+ my $para = HTML::Element->new('p');
+ my $span = HTML::Element->new('span');
if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h")
{
- print "<span style=\"color:red;\">";
- $span=1;
+ $span->attr('style', "color:red;");
}
- print "No coverage found";
- print "</span>" if $span;
+ $span->push_content("No coverage found");
+ $para->push_content($span);
+ $body->push_content($para);
}
- print "</p>";
for my $patch (@$patchref)
{
{
$hunkstr .= " - " . ($patch->[0]+$patch->[1]-1);
}
- print "<p style=\"font-weight:bold;\">" . $hunkstr . "</p>";
- print "<pre>";
+ 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');
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))
{
- print " ";
+ $codeHunk->push_content(" ");
}
- print "$line ";
+ $codeHunk->push_content("$line ");
+
+ my $srcLine = HTML::Element->new('span');
if($coverage_ref)
{
my $color;
+
if($coverage_ref->{"covered"}->{$line})
{
- print("<span style=\"color:green;\">");
+ $srcLine->attr('style', "color:green;");
}
elsif($coverage_ref->{"uncovered"}->{$line})
{
- print("<span style=\"color:red;font-weight:bold;\">");
+ $srcLine->attr('style', "color:red;font-weight:bold;");
}
else
{
- #print("<span style=\"color:black;font-weight:normal;\">");
+ $srcLine->attr('style', "color:black;font-weight:normal;");
}
my $src=$coverage_ref->{"src"}->{$line};
chomp($src);
- #print $color, "$src\n", RESET;
- print "$src</span>\n";
+ $srcLine->push_content($src);
}
else
{
# We don't have coverage data, so print it from the patch instead.
my $src = $b_lines_ref->{$line};
- print "$src\n";
+ $srcLine->attr('style', "color:black;font-weight:normal;");
+ $srcLine->push_content($src);
}
+ $codeHunk->push_content($srcLine, "\n");
}
- print "<\pre>\n";
+ $body->push_content($codeHunk, "\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 "<hr>\n</body>\n</html>\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();
close $filehandle;
- select $OUTPUT_FH;
}
END_TEST;
}
+int UtcDaliActorInheritOpacity(void)
+{
+ tet_infoline("Testing Actor::Inherit Opacity");
+ TestApplication application;
+
+ Actor parent = Actor::New();
+ Actor child = Actor::New();
+ parent.Add( child );
+ Stage::GetCurrent().Add( parent );
+
+ DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ parent.SetOpacity( 0.1f );
+
+ DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( child.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.f, 0.0001f, TEST_LOCATION );
+
+ END_TEST;
+}
+
// SetOrientation(float angleRadians, Vector3 axis)
int UtcDaliActorSetOrientation01(void)
{
{
public:
- FrameCallbackBasic()
- : mCalled( false )
- {
- }
+ FrameCallbackBasic() = default;
virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds )
{
mCalled = true;
}
- bool mCalled;
+ virtual void Reset()
+ {
+ mCalled = false;
+ }
+
+ bool mCalled{ false };
};
} // anon namespace
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds )
+ virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
{
FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- updateProxy.GetWorldMatrixAndSize( mActorId, mWorldMatrix, mSize );
- mWorldMatrixGetWorldMatrixCall = updateProxy.GetWorldMatrix( mActorId );
- mSizeGetSizeCall = updateProxy.GetSize( mActorId );
- mPositionGetPositionCall = updateProxy.GetPosition( mActorId );
+ updateProxy.GetSize( mActorId, mSizeGetSizeCall );
+ updateProxy.GetPosition( mActorId, mPositionGetPositionCall );
updateProxy.GetPositionAndSize( mActorId, mPositionGetPositionAndSizeCall, mSizeGetPositionAndSizeCall );
- mWorldColor = updateProxy.GetWorldColor( mActorId );
+ updateProxy.GetColor( mActorId, mColor );
+ updateProxy.GetScale( mActorId, mScale );
}
const unsigned int mActorId;
- Matrix mWorldMatrix;
- Matrix mWorldMatrixGetWorldMatrixCall;
- Vector3 mSize;
Vector3 mSizeGetSizeCall;
Vector3 mPositionGetPositionCall;
Vector3 mPositionGetPositionAndSizeCall;
Vector3 mSizeGetPositionAndSizeCall;
- Vector4 mWorldColor;
+ Vector4 mColor;
+ Vector3 mScale;
};
class FrameCallbackSetter : public FrameCallbackBasic
FrameCallbackSetter(
unsigned int actorId,
- const Matrix& matrixToSet,
const Vector3& sizeToSet,
const Vector3& positionToSet,
- const Vector4& colorToSet )
+ const Vector4& colorToSet,
+ const Vector3& scaleToSet )
: mActorId( actorId ),
- mMatrixToSet( matrixToSet ),
mSizeToSet( sizeToSet ),
mPositionToSet( positionToSet ),
- mColorToSet( colorToSet )
+ mColorToSet( colorToSet ),
+ mScaleToSet( scaleToSet )
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds )
+ virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
{
FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- updateProxy.SetWorldMatrix( mActorId, mMatrixToSet );
updateProxy.SetSize( mActorId, mSizeToSet );
- updateProxy.GetWorldMatrixAndSize( mActorId, mWorldMatrixAfterSetting, mSizeAfterSetting );
updateProxy.SetPosition( mActorId, mPositionToSet );
- mPositionAfterSetting = updateProxy.GetPosition( mActorId );
- updateProxy.SetWorldColor( mActorId, mColorToSet );
- mColorAfterSetting = updateProxy.GetWorldColor( mActorId );
+ updateProxy.SetColor( mActorId, mColorToSet );
+ updateProxy.SetScale( mActorId, mScaleToSet );
+ updateProxy.GetSize( mActorId, mSizeAfterSetting );
+ updateProxy.GetPosition( mActorId, mPositionAfterSetting );
+ updateProxy.GetColor( mActorId, mColorAfterSetting );
+ updateProxy.GetScale( mActorId, mScaleAfterSetting );
+ }
+
+ const unsigned int mActorId;
+ const Vector3& mSizeToSet;
+ const Vector3& mPositionToSet;
+ const Vector4& mColorToSet;
+ const Vector3& mScaleToSet;
+
+ Vector3 mSizeAfterSetting;
+ Vector3 mPositionAfterSetting;
+ Vector4 mColorAfterSetting;
+ Vector3 mScaleAfterSetting;
+};
+
+class FrameCallbackBaker : public FrameCallbackBasic
+{
+public:
+
+ FrameCallbackBaker(
+ unsigned int actorId,
+ const Vector3& sizeToSet,
+ const Vector3& positionToSet,
+ const Vector4& colorToSet,
+ const Vector3& scaleToSet )
+ : mActorId( actorId ),
+ mSizeToSet( sizeToSet ),
+ mPositionToSet( positionToSet ),
+ mColorToSet( colorToSet ),
+ mScaleToSet( scaleToSet )
+ {
+ }
+
+ virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ {
+ FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
+ updateProxy.BakeSize( mActorId, mSizeToSet );
+ updateProxy.BakePosition( mActorId, mPositionToSet );
+ updateProxy.BakeColor( mActorId, mColorToSet );
+ updateProxy.BakeScale( mActorId, mScaleToSet );
+ updateProxy.GetSize( mActorId, mSizeAfterSetting );
+ updateProxy.GetPosition( mActorId, mPositionAfterSetting );
+ updateProxy.GetColor( mActorId, mColorAfterSetting );
+ updateProxy.GetScale( mActorId, mScaleAfterSetting );
}
const unsigned int mActorId;
- const Matrix& mMatrixToSet;
const Vector3& mSizeToSet;
const Vector3& mPositionToSet;
const Vector4& mColorToSet;
+ const Vector3& mScaleToSet;
- Matrix mWorldMatrixAfterSetting;
Vector3 mSizeAfterSetting;
Vector3 mPositionAfterSetting;
Vector4 mColorAfterSetting;
+ Vector3 mScaleAfterSetting;
};
class FrameCallbackMultipleActors : public FrameCallbackBasic
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds )
+ virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
{
FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
for( auto&& i : mActorIds )
{
- Matrix matrix( false );
+ Vector3 position;
Vector3 size;
- updateProxy.GetWorldMatrixAndSize( i, matrix, size );
- mWorldMatrices[ i ] = matrix;
+ updateProxy.GetPositionAndSize( i, position, size );
+ mPositions[ i ] = position;
mSizes[ i ] = size;
}
}
Vector< unsigned int > mActorIds;
- std::map< unsigned int, Matrix > mWorldMatrices;
+ std::map< unsigned int, Vector3 > mPositions;
std::map< unsigned int, Vector3 > mSizes;
};
+class FrameCallbackActorIdCheck : public FrameCallbackBasic
+{
+public:
+
+ FrameCallbackActorIdCheck( unsigned int actorId )
+ : mActorId( actorId )
+ {
+ }
+
+ virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ {
+ FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
+ Vector3 vec3;
+ Vector4 vec4;
+
+ mGetSizeCallSuccess = updateProxy.GetSize( mActorId, vec3 );
+ mGetPositionCallSuccess = updateProxy.GetPosition( mActorId, vec3 );
+ mGetColorCallSuccess = updateProxy.GetColor( mActorId, vec4 );
+ mGetScaleCallSuccess = updateProxy.GetScale( mActorId, vec3 );
+ mGetPositionAndSizeCallSuccess = updateProxy.GetPositionAndSize( mActorId, vec3, vec3 );
+ mSetSizeCallSuccess = updateProxy.SetSize( mActorId, vec3 );
+ mSetPositionCallSuccess = updateProxy.SetPosition( mActorId, vec3 );
+ mSetColorCallSuccess = updateProxy.SetColor( mActorId, vec4 );
+ mSetScaleCallSuccess = updateProxy.SetScale( mActorId, vec3 );
+ mBakeSizeCallSuccess = updateProxy.BakeSize( mActorId, vec3 );
+ mBakePositionCallSuccess = updateProxy.BakePosition( mActorId, vec3 );
+ mBakeColorCallSuccess = updateProxy.BakeColor( mActorId, vec4 );
+ mBakeScaleCallSuccess = updateProxy.BakeScale( mActorId, vec3 );
+ }
+
+ virtual void Reset() override
+ {
+ // Up-call
+ FrameCallbackBasic::Reset();
+
+ mGetSizeCallSuccess = false;
+ mGetPositionCallSuccess = false;
+ mGetColorCallSuccess = false;
+ mGetScaleCallSuccess = false;
+ mGetPositionAndSizeCallSuccess = false;
+ mSetSizeCallSuccess = false;
+ mSetPositionCallSuccess = false;
+ mSetColorCallSuccess = false;
+ mSetScaleCallSuccess = false;
+ mBakeSizeCallSuccess = false;
+ mBakePositionCallSuccess = false;
+ mBakeColorCallSuccess = false;
+ mBakeScaleCallSuccess = false;
+ }
+
+ const uint32_t mActorId;
+ bool mGetSizeCallSuccess{ false };
+ bool mGetPositionCallSuccess{ false };
+ bool mGetColorCallSuccess{ false };
+ bool mGetScaleCallSuccess{ false };
+ bool mGetPositionAndSizeCallSuccess{ false };
+ bool mSetSizeCallSuccess{ false };
+ bool mSetPositionCallSuccess{ false };
+ bool mSetColorCallSuccess{ false };
+ bool mSetScaleCallSuccess{ false };
+ bool mBakeSizeCallSuccess{ false };
+ bool mBakePositionCallSuccess{ false };
+ bool mBakeColorCallSuccess{ false };
+ bool mBakeScaleCallSuccess{ false };
+};
+
///////////////////////////////////////////////////////////////////////////////
int UtcDaliFrameCallbackCheckInstallationAndRemoval(void)
{
+ // Basic test to check that the frame-callback can be installed and removed correctly
+
TestApplication application;
FrameCallbackBasic frameCallback;
int UtcDaliFrameCallbackGetters(void)
{
+ // Test to see that the Getters all return the expected values
+
TestApplication application;
Vector2 actorSize( 200, 300 );
Vector4 color( 0.5f, 0.6f, 0.7f, 0.8f );
Vector3 position( 10.0f, 20.0f, 30.0f );
+ Vector3 scale( 2.0f, 4.0f, 6.0f );
Actor actor = Actor::New();
actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
actor.SetSize( actorSize );
actor.SetColor( color );
actor.SetPosition( position );
+ actor.SetScale( scale );
Stage stage = Stage::GetCurrent();
stage.Add( actor );
- Vector2 stageSize = stage.GetSize();
FrameCallbackOneActor frameCallback( actor.GetId() );
DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
application.SendNotification();
application.Render();
- Vector3 expectedPosition( -stageSize.width * 0.5f + actorSize.width * 0.5f + position.x,
- -stageSize.height * 0.5f + actorSize.height * 0.5f + position.y,
- 0.0f + position.z );
-
- Matrix expectedWorldMatrix( false );
- expectedWorldMatrix.SetIdentity();
- expectedWorldMatrix.SetTranslation( expectedPosition );
-
DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mWorldMatrix, expectedWorldMatrix, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mWorldMatrixGetWorldMatrixCall, expectedWorldMatrix, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSize, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, expectedPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionGetPositionAndSizeCall, expectedPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, position, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositionGetPositionAndSizeCall, position, TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizeGetPositionAndSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mWorldColor, color, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mColor, color, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mScale, scale, TEST_LOCATION );
END_TEST;
}
int UtcDaliFrameCallbackSetters(void)
{
+ // Test to see that the setters set the values appropriately
+
TestApplication application;
Vector2 actorSize( 200, 300 );
Stage stage = Stage::GetCurrent();
stage.Add( actor );
- Vector2 stageSize = stage.GetSize();
- Matrix matrixToSet( Matrix::IDENTITY );
- matrixToSet.SetTranslation( Vector3( 100.0f, 500.0f, 50.0f ) );
Vector3 sizeToSet( 1.0f, 2.0f, 3.0f );
Vector3 positionToSet( 10.0f, 20.0f, 30.0f );
Vector4 colorToSet( Color::MAGENTA );
+ Vector3 scaleToSet( 1.0f, 3.0f, 5.0f );
- FrameCallbackSetter frameCallback( actor.GetId(), matrixToSet, sizeToSet, positionToSet, colorToSet );
+ FrameCallbackSetter frameCallback( actor.GetId(), sizeToSet, positionToSet, colorToSet, scaleToSet );
DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
application.SendNotification();
application.Render();
- Matrix expectedWorldMatrix( false );
- expectedWorldMatrix.SetIdentity();
- expectedWorldMatrix.SetTranslation( Vector3( -stageSize.width * 0.5f + actorSize.width * 0.5f,
- -stageSize.height * 0.5f + actorSize.height * 0.5f,
- 0.0f ) );
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION );
+
+ // Ensure the actual actor values haven't changed as we didn't bake the values after removing the callback
+ DevelStage::RemoveFrameCallback( stage, frameCallback );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackBake(void)
+{
+ // Test to see that the bake methods bake the values
+
+ TestApplication application;
+ Vector2 actorSize( 200, 300 );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetSize( actorSize );
+
+ Stage stage = Stage::GetCurrent();
+ stage.Add( actor );
+
+ Vector3 sizeToSet( 1.0f, 2.0f, 3.0f );
+ Vector3 positionToSet( 10.0f, 20.0f, 30.0f );
+ Vector4 colorToSet( Color::MAGENTA );
+ Vector3 scaleToSet( 1.0f, 3.0f, 5.0f );
+
+ FrameCallbackBaker frameCallback( actor.GetId(), sizeToSet, positionToSet, colorToSet, scaleToSet );
+ DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_CHECK( expectedWorldMatrix != matrixToSet );
- DALI_TEST_EQUALS( frameCallback.mWorldMatrixAfterSetting, matrixToSet, TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION );
+
+ // Ensure the new values are saved after removing the callback
+ DevelStage::RemoveFrameCallback( stage, frameCallback );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), positionToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), sizeToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), colorToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), scaleToSet, TEST_LOCATION );
END_TEST;
}
+
int UtcDaliFrameCallbackMultipleActors(void)
{
/**
+ * Test to check that the frame callback behaves appropriately with multiple actors
+ *
* Tree:
* root-layer
* / \
* / \
* actorC actorH
*
- * Screen positions:
+ * Screen positions (with minor alterations due to local position):
* -----------------------
* |actorA|actorD |
* | actorB |
TestApplication application;
Stage stage = Stage::GetCurrent();
- const Vector2 stageSize = stage.GetSize();
std::map< char, Vector3 > sizes;
sizes['A'] = Vector3( 50.0f, 50.0f, 0.0f );
sizes['G'] = Vector3( 350.0f, 350.0f, 0.0f );
sizes['H'] = Vector3( 400.0f, 350.0f, 0.0f );
- std::map< char, Matrix > matrices;
- for( char i = 'A'; i <= 'H'; ++i )
- {
- matrices[i] = Matrix::IDENTITY;
- }
-
- matrices['A'].SetTranslation( Vector3( -stageSize.width * 0.5f + sizes['A'].width * 0.5f,
- -stageSize.height * 0.5f + sizes['A'].height * 0.5f,
- 0.0f ) );
- matrices['B'].SetTranslation( Vector3( matrices['A'].GetTranslation3() + sizes['A'] * 0.5f + sizes['B'] * 0.5f ) );
- matrices['C'].SetTranslation( Vector3( matrices['B'].GetTranslation3().x,
- matrices['B'].GetTranslation3().y + sizes['B'].height * 0.5f + sizes['C'].height * 0.5f,
- 0.0f ) );
- matrices['D'].SetTranslation( Vector3( matrices['A'].GetTranslation3().x + sizes['A'].width * 0.5f + sizes['D'].width * 0.5f,
- matrices['A'].GetTranslation3().y,
- 0.0f ) );
- matrices['E'].SetTranslation( Vector3( -stageSize.width * 0.5f + sizes['E'].width * 0.5f,
- stageSize.height * 0.5f - sizes['E'].height * 0.5f,
- 0.0f ) );
- matrices['F'].SetTranslation( Vector3( matrices['E'].GetTranslation3().x,
- matrices['E'].GetTranslation3().y - sizes['E'].height * 0.5f - sizes['F'].height * 0.5f,
- 0.0f ) );
- matrices['G'].SetTranslation( Vector3( matrices['E'].GetTranslation3().x + sizes['E'].width * 0.5f + sizes['G'].width * 0.5f,
- matrices['E'].GetTranslation3().y,
- 0.0f ) );
- matrices['H'].SetTranslation( Vector3( matrices['G'].GetTranslation3().x + sizes['G'].width * 0.5f + sizes['H'].width * 0.5f,
- matrices['G'].GetTranslation3().y - sizes['G'].height * 0.5f - sizes['H'].height * 0.5f,
- 0.0f ) );
+ std::map< char, Vector3 > positions;
+ positions['A'] = Vector3( 0.0f, 1.0f, 2.0f );
+ positions['B'] = Vector3( 2.0f, 3.0f, 4.0f );
+ positions['C'] = Vector3( 5.0f, 6.0f, 7.0f );
+ positions['D'] = Vector3( 8.0f, 9.0f, 10.0f );
+ positions['E'] = Vector3( 11.0f, 12.0f, 13.0f );
+ positions['F'] = Vector3( 14.0f, 15.0f, 16.0f );
+ positions['G'] = Vector3( 17.0f, 18.0f, 19.0f );
+ positions['H'] = Vector3( 20.0f, 21.0f, 22.0f );
Actor actorA = Actor::New();
actorA.SetParentOrigin( ParentOrigin::TOP_LEFT );
actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
actorA.SetSize( sizes['A'] );
+ actorA.SetPosition( positions['A'] );
stage.Add( actorA );
Actor actorB = Actor::New();
actorB.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
actorB.SetAnchorPoint( AnchorPoint::TOP_LEFT );
actorB.SetSize( sizes['B'] );
+ actorB.SetPosition( positions['B'] );
actorA.Add( actorB );
Actor actorC = Actor::New();
actorC.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
actorC.SetAnchorPoint( AnchorPoint::TOP_CENTER );
actorC.SetSize( sizes['C'] );
+ actorC.SetPosition( positions['C'] );
actorB.Add( actorC );
Actor actorD = Actor::New();
actorD.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
actorD.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
actorD.SetSize( sizes['D'] );
+ actorD.SetPosition( positions['D'] );
actorA.Add( actorD );
Actor actorE = Actor::New();
actorE.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
actorE.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
actorE.SetSize( sizes['E'] );
+ actorE.SetPosition( positions['E'] );
stage.Add( actorE );
Actor actorF = Actor::New();
actorF.SetParentOrigin( ParentOrigin::TOP_CENTER );
actorF.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
actorF.SetSize( sizes['F'] );
+ actorF.SetPosition( positions['F'] );
actorE.Add( actorF );
Actor actorG = Actor::New();
actorG.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
actorG.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
actorG.SetSize( sizes['G'] );
+ actorG.SetPosition( positions['G'] );
actorE.Add( actorG );
Actor actorH = Actor::New();
actorH.SetParentOrigin( ParentOrigin::TOP_RIGHT );
actorH.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
actorH.SetSize( sizes['H'] );
+ actorH.SetPosition( positions['H'] );
actorG.Add( actorH );
std::map< char, unsigned int > actorIds;
for( char i = 'A'; i <= 'H'; ++i )
{
- DALI_TEST_EQUALS( frameCallback.mWorldMatrices[ actorIds[ i ] ], matrices[ i ], TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION );
}
for( char i = 'A'; i <= 'H'; ++i )
{
- DALI_TEST_EQUALS( frameCallback.mWorldMatrices[ actorIds[ i ] ], matrices[ i ], TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION );
}
application.SendNotification();
application.Render();
+ // All should be default constructed objects
DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mWorldMatrix, Matrix(true) /* Unchanged Matrix */, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mWorldMatrixGetWorldMatrixCall, Matrix::IDENTITY, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSize, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, Vector3::ZERO, TEST_LOCATION );
DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mColor, Vector4::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mScale, Vector3::ZERO, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackInvalidActorId(void)
+{
+ // Test to ensure that there are no issues when trying to use the update-proxy methods with an invalid actor ID.
+
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ FrameCallbackActorIdCheck frameCallback( 10000 );
+ DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ // Invalid Actor ID so all the methods should not return successfully.
+
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackActorRemovedAndAdded(void)
+{
+ // Test to ensure that we do not call methods on actors that have been removed on the stage
+ // and then re-start calling the required methods if that actor is re-added back to the stage
+
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ FrameCallbackActorIdCheck frameCallback( actor.GetId() );
+ DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ // All methods should return successfully.
+
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION );
+ frameCallback.Reset();
+
+ // Remove the actor from stage, the methods should not return successfully.
+
+ stage.Remove( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION );
+ frameCallback.Reset();
+
+ // Re-add the actor back to the stage, all the methods should once again, return successfully.
+
+ stage.Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackMultipleCallbacks(void)
+{
+ // Test to ensure multiple frame-callbacks work as expected
+
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ FrameCallbackBasic frameCallback1;
+ FrameCallbackBasic frameCallback2;
+ DevelStage::AddFrameCallback( stage, frameCallback1, stage.GetRootLayer() );
+ DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Remove the second frame-callback, only the first should be called
+
+ DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Re-add the second frame-callback and remove the first, only the second should be called
+
+ DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() );
+ DevelStage::RemoveFrameCallback( stage, frameCallback1 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Attempt removal of the first frame-callback again, should be a no-op and yield the exact same results as the last run
+ DevelStage::RemoveFrameCallback( stage, frameCallback1 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Remove the second frame-callback as well, neither should be called
+ DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackActorDestroyed(void)
+{
+ // Test to ensure that the frame-callback behaves gracefully if the connected root-actor is destroyed
+
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ FrameCallbackBasic frameCallback1;
+ FrameCallbackBasic frameCallback2;
+ DevelStage::AddFrameCallback( stage, frameCallback1, actor );
+ DevelStage::AddFrameCallback( stage, frameCallback2, actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Remove the second frame-callback, only the first should be called
+
+ DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ frameCallback1.Reset();
+ frameCallback2.Reset();
+
+ // Remove and destroy the actor, the first one should not be called either
+ stage.Remove( actor );
+ actor.Reset();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliFrameCallbackDestroyedBeforeRemoving(void)
+{
+ // Ensure there's no segmentation fault if the callback is deleted without being removed
+
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ {
+ FrameCallbackBasic frameCallback;
+ DevelStage::AddFrameCallback( stage, frameCallback, actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ frameCallback.Reset();
+ }
+
+ // frameCallback has now been destroyed but not removed
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( true ); // If it runs to here then there's no segmentation fault
END_TEST;
}
${CMAKE_CURRENT_SOURCE_DIR}/threading/conditional-wait.cpp
${CMAKE_CURRENT_SOURCE_DIR}/threading/mutex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/threading/thread.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/update/frame-callback-interface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/update/update-proxy.cpp
PARENT_SCOPE )
${CMAKE_CURRENT_SOURCE_DIR}/threading/mutex.h
${CMAKE_CURRENT_SOURCE_DIR}/threading/thread.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/update/frame-callback-interface.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/update/update-proxy.h
+
PARENT_SCOPE )
--- /dev/null
+#ifndef DALI_BITWISE_ENUM_H
+#define DALI_BITWISE_ENUM_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <type_traits> // std::enable_if, std::underlying_type
+
+namespace Dali
+{
+
+/**
+ * Type traits and methods to enable type safe bit field operators for an enum.
+ * usage:
+ * template<> struct EnableBitMaskOperators< MyEnumType > { static const bool ENABLE = true; };
+ * after this one can set bitfields with | and |=, like
+ * MyEnumType value = FLAG1 | FLAG2;
+ * and test them with &, like:
+ * if( myFlag & FLAG2 )
+ * // do something
+ */
+template< typename Enum >
+struct EnableBitMaskOperators
+{
+ static const bool ENABLE = false; // can't be constexpr as it's a data member
+};
+
+/**
+ * Combine two bitfields
+ * @param lhs bitfield to or
+ * @param rhs bitfield to or
+ * @return EnumType with both flags set
+ */
+template < typename EnumType >
+inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, EnumType >::type operator|( EnumType lhs, EnumType rhs )
+{
+ using UnderlyingType = typename std::underlying_type<EnumType>::type;
+ return static_cast<EnumType>( static_cast<UnderlyingType>( lhs ) | static_cast<UnderlyingType>(rhs ) );
+}
+
+/**
+ * Combine two bitfields
+ * @param lhs bitfield to or
+ * @param rhs bitfield to or
+ * @return reference to lhs with both flags set
+ */
+template < typename EnumType >
+inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, EnumType& >::type operator|=( EnumType& lhs, EnumType rhs )
+{
+ using UnderlyingType = typename std::underlying_type<EnumType>::type;
+ lhs = static_cast<EnumType>(static_cast<UnderlyingType>( lhs ) | static_cast<UnderlyingType>( rhs ) );
+ return lhs;
+}
+
+/**
+ * Test two bitfields.
+ * @param lhs bitfield to AND
+ * @param rhs bitfield to AND
+ * @return true if at least one flag is same in both
+ */
+template < typename EnumType >
+inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, bool >::type operator&( EnumType lhs, EnumType rhs )
+{
+ using UnderlyingType = typename std::underlying_type<EnumType>::type;
+ return static_cast<bool>( static_cast<UnderlyingType>( lhs ) & static_cast<UnderlyingType>(rhs ) );
+}
+
+} // namespace Dali
+
+#endif // DALI_BITWISE_ENUM_H
*
* @param[in] stage The stage to clear the FrameCallbackInterface on
* @param[in] frameCallback The FrameCallbackInterface implementation to remove
+ *
+ * @note If the callback implementation has already been removed, then this is a no-op.
*/
DALI_IMPORT_API void RemoveFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback );
$(devel_api_src_dir)/threading/conditional-wait.cpp \
$(devel_api_src_dir)/threading/mutex.cpp \
$(devel_api_src_dir)/threading/thread.cpp \
+ $(devel_api_src_dir)/update/frame-callback-interface.cpp \
$(devel_api_src_dir)/update/update-proxy.cpp
# Add devel header files here DALi internal developer files used by Adaptor & Toolkit
$(devel_api_src_dir)/animation/animation-devel.h
devel_api_core_common_header_files = \
+ $(devel_api_src_dir)/common/bitwise-enum.h \
$(devel_api_src_dir)/common/circular-queue.h \
$(devel_api_src_dir)/common/hash.h \
$(devel_api_src_dir)/common/map-wrapper.h \
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/update/frame-callback-interface.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/update/update-proxy.h>
+#include <dali/internal/event/common/stage-impl.h>
+
+namespace Dali
+{
+
+FrameCallbackInterface::~FrameCallbackInterface()
+{
+ if( Internal::Stage::IsInstalled() )
+ {
+ Internal::StagePtr stage = Internal::Stage::GetCurrent();
+ if( stage )
+ {
+ // This will be a no-op if the callback has already been removed
+ stage->RemoveFrameCallback( *this );
+ }
+ }
+}
+
+} // namespace Dali
/**
* @brief Protected virtual destructor.
*/
- virtual ~FrameCallbackInterface() {}
+ virtual ~FrameCallbackInterface();
};
} // namespace Dali
namespace Dali
{
-Vector3 UpdateProxy::GetPosition( unsigned int id ) const
+bool UpdateProxy::GetPosition( uint32_t id, Vector3& position ) const
{
- return mImpl.GetPosition( id );
+ return mImpl.GetPosition( id, position );
}
-void UpdateProxy::SetPosition( unsigned int id, const Vector3& position )
+bool UpdateProxy::SetPosition( uint32_t id, const Vector3& position )
{
- mImpl.SetPosition( id, position );
+ return mImpl.SetPosition( id, position );
}
-const Vector3& UpdateProxy::GetSize( unsigned int id ) const
+bool UpdateProxy::BakePosition( uint32_t id, const Vector3& position )
{
- return mImpl.GetSize( id );
+ return mImpl.BakePosition( id, position );
}
-void UpdateProxy::SetSize( unsigned int id, const Vector3& size )
+bool UpdateProxy::GetSize( uint32_t id, Vector3& size ) const
{
- mImpl.SetSize( id, size );
+ return mImpl.GetSize( id, size );
}
-void UpdateProxy::GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const
+bool UpdateProxy::SetSize( uint32_t id, const Vector3& size )
{
- mImpl.GetPositionAndSize( id, position, size );
+ return mImpl.SetSize( id, size );
}
-Vector4 UpdateProxy::GetWorldColor( unsigned int id ) const
+bool UpdateProxy::BakeSize( uint32_t id, const Vector3& size )
{
- return mImpl.GetWorldColor( id );
+ return mImpl.BakeSize( id, size );
}
-void UpdateProxy::SetWorldColor( unsigned int id, const Vector4& color ) const
+bool UpdateProxy::GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const
{
- mImpl.SetWorldColor( id, color );
+ return mImpl.GetPositionAndSize( id, position, size );
}
-void UpdateProxy::GetWorldMatrixAndSize( unsigned int id, Matrix& worldMatrix, Vector3& size ) const
+bool UpdateProxy::GetScale( uint32_t id, Vector3& scale ) const
{
- mImpl.GetWorldMatrixAndSize( id, worldMatrix, size );
+ return mImpl.GetScale( id, scale );
}
-const Matrix& UpdateProxy::GetWorldMatrix( unsigned int id ) const
+bool UpdateProxy::SetScale( uint32_t id, const Vector3& scale )
{
- return mImpl.GetWorldMatrix( id );
+ return mImpl.SetScale( id, scale );
}
-void UpdateProxy::SetWorldMatrix( unsigned int id, const Matrix& worldMatrix )
+bool UpdateProxy::BakeScale( uint32_t id, const Vector3& scale )
{
- mImpl.SetWorldMatrix( id, worldMatrix );
+ return mImpl.BakeScale( id, scale );
+}
+
+bool UpdateProxy::GetColor( uint32_t id, Vector4& color ) const
+{
+ return mImpl.GetColor( id, color );
+}
+
+bool UpdateProxy::SetColor( uint32_t id, const Vector4& color ) const
+{
+ return mImpl.SetColor( id, color );
+}
+
+bool UpdateProxy::BakeColor( uint32_t id, const Vector4& color ) const
+{
+ return mImpl.BakeColor( id, color );
}
UpdateProxy::UpdateProxy( Internal::UpdateProxy& impl )
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/matrix.h>
public:
/**
- * @brief Given the Actor ID, this retrieves that Actor's position.
- * @param[in] id The Actor ID
- * @return If valid Actor ID, then the Actor's position is returned.
+ * @brief Given the Actor ID, this retrieves that Actor's local position.
+ * @param[in] id The Actor ID
+ * @param[out] position Set to the Actor's current position, if Actor ID is valid
+ * @return Whether the method call was successful or not.
+ */
+ bool GetPosition( uint32_t id, Vector3& position ) const;
+
+ /**
+ * @brief Allows setting an Actor's local position from the Frame callback function for the current frame only.
+ * @param[in] id The Actor ID
+ * @param[in] position The position to set
+ * @return Whether the method call was successful or not.
+ * @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- Vector3 GetPosition( unsigned int id ) const;
+ bool SetPosition( uint32_t id, const Vector3& position );
/**
- * @brief Allows setting an Actor's position from the Frame callback function.
+ * @brief Allows baking an Actor's local position from the Frame callback function.
* @param[in] id The Actor ID
- * @param[in] position The position to set.
- * @note This will get reset to the internally calculated value in the next frame, so will have to be set again.
+ * @param[in] position The position to bake
+ * @return Whether the method call was successful or not.
+ * @note The value is saved so will cause undesired effects if this property is being animated.
*/
- void SetPosition( unsigned int id, const Vector3& position );
+ bool BakePosition( uint32_t id, const Vector3& position );
/**
* @brief Given the Actor ID, this retrieves that Actor's size.
- * @param[in] id The Actor ID
- * @return If valid Actor ID, then Actor's size is returned, otherwise Vector3::ZERO.
+ * @param[in] id The Actor ID
+ * @param[out] size Set to the Actor's current size, if Actor ID is valid
+ * @return Whether the method call was successful or not.
*/
- const Vector3& GetSize( unsigned int id ) const;
+ bool GetSize( uint32_t id, Vector3& size ) const;
/**
- * @brief Allows setting an Actor's size from the Frame callback function.
+ * @brief Allows setting an Actor's size from the Frame callback function for the current frame only.
* @param[in] id The Actor ID
- * @param[in] size The size to set.
- * @note This will get reset to the internally calculated value in the next frame, so will have to be set again.
+ * @param[in] size The size to set
+ * @return Whether the method call was successful or not.
+ * @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- void SetSize( unsigned int id, const Vector3& size );
+ bool SetSize( uint32_t id, const Vector3& size );
/**
- * @brief Given the Actor ID, this retrieves that Actor's position and size.
- * @param[in] id The Actor ID
- * @param[out] position If valid Actor ID, then Actor's position is set
- * @param[out] size If valid Actor ID, then Actor's size is set
+ * @brief Allows baking an Actor's size from the Frame callback function.
+ * @param[in] id The Actor ID
+ * @param[in] size The size to bake
+ * @return Whether the method call was successful or not.
+ * @note The value is saved so will cause undesired effects if this property is being animated.
*/
- void GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const;
+ bool BakeSize( uint32_t id, const Vector3& size );
/**
- * @brief Given the Actor ID, this retrieves that Actor's color.
+ * @brief Given the Actor ID, this retrieves that Actor's local position and size.
* @param[in] id The Actor ID
- * @return If valid Actor ID, then Actor's color is returned, otherwise Vector4::ZERO.
+ * @param[out] position Set to the Actor's current position, if Actor ID is valid
+ * @param[out] size Set to the Actor's current size, if Actor ID is valid
+ * @return Whether the method call was successful or not.
*/
- Vector4 GetWorldColor( unsigned int id ) const;
+ bool GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const;
/**
- * @brief Allows setting an Actor's color from the Frame callback function.
+ * @brief Given the Actor ID, this retrieves that Actor's local scale.
+ * @param[in] id The Actor ID
+ * @param[out] scale Set to the Actor's current scale, if Actor ID is valid
+ * @return Whether the method call was successful or not.
+ */
+ bool GetScale( uint32_t id, Vector3& scale ) const;
+
+ /**
+ * @brief Allows setting an Actor's local scale from the Frame callback function for the current frame only.
* @param[in] id The Actor ID
- * @param[in] color The color to set
- * @note This will get reset to the internally calculated value in the next frame, so will have to be set again.
+ * @param[in] scale The scale to set
+ * @return Whether the method call was successful or not.
+ * @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- void SetWorldColor( unsigned int id, const Vector4& color ) const;
+ bool SetScale( uint32_t id, const Vector3& scale );
/**
- * @brief Given the Actor ID, this retrieves that Actor's world-matrix and size.
- * @param[in] id The Actor ID
- * @param[out] worldMatrix If valid Actor ID, then Actor's world matrix is set
- * @param[out] size If valid Actor ID, then Actor's size is set
+ * @brief Allows baking an Actor's local scale from the Frame callback function.
+ * @param[in] id The Actor ID
+ * @param[in] scale The scale to bake
+ * @return Whether the method call was successful or not.
+ * @note The value is saved so will cause undesired effects if this property is being animated.
*/
- void GetWorldMatrixAndSize( unsigned int id, Matrix& worldMatrix, Vector3& size ) const;
+ bool BakeScale( uint32_t id, const Vector3& scale );
/**
- * @brief Given the Actor ID, this retrieves that Actor's world-matrix.
- * @param[in] id The Actor ID
- * @return If valid Actor ID, then Actor's world matrix is returned, otherwise Matrix::IDENTITY.
+ * @brief Given the Actor ID, this retrieves that Actor's local color.
+ * @param[in] id The Actor ID
+ * @param[out] color Set to the Actor's current color, if Actor ID is valid
+ * @return Whether the method call was successful or not.
*/
- const Matrix& GetWorldMatrix( unsigned int id ) const;
+ bool GetColor( uint32_t id, Vector4& color ) const;
/**
- * @brief Allows the setting an Actor's world-matrix from the Frame callback function.
- * @param[in] id The Actor ID
- * @param[in] worldMatrix The world matrix to set.
- * @note This will get reset to the internally calculated value in the next frame, so will have to be set again.
- * @note This will only set the world matrix for that particular actor.
- * The world matrices of the children will not change and will have to be manually changed in the callback
- * as well (if required).
+ * @brief Allows setting an Actor's local color from the Frame callback function for the current frame only.
+ * @param[in] id The Actor ID
+ * @param[in] color The color to set
+ * @return Whether the method call was successful or not.
+ * @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
+ */
+ bool SetColor( uint32_t id, const Vector4& color ) const;
+
+ /**
+ * @brief Allows baking an Actor's local color from the Frame callback function.
+ * @param[in] id The Actor ID
+ * @param[in] color The color to bake
+ * @return Whether the method call was successful or not.
+ * @note The value is saved so will cause undesired effects if this property is being animated.
*/
- void SetWorldMatrix( unsigned int id, const Matrix& worldMatrix );
+ bool BakeColor( uint32_t id, const Vector4& color ) const;
public: // Not intended for application developers
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
seconds = 0.0f;
}
- // Cache for public getters
mDurationSeconds = seconds;
// mAnimation is being used in a separate thread; queue a message to set the value
// CLASS HEADER
#include <dali/internal/update/manager/frame-callback-processor.h>
+// EXTERNAL INCLUDES
+#include <algorithm>
+
// INTERNAL INCLUDES
#include <dali/devel-api/update/frame-callback-interface.h>
#include <dali/devel-api/update/update-proxy.h>
-#include <dali/internal/update/manager/update-proxy-impl.h>
namespace Dali
{
namespace
{
+/**
+ * Given a node, it matches all update-proxies using that node as their root-node.
+ */
template< typename FrameCallbackInfoT >
class MatchRootNode
{
private:
- PropertyOwner& mRootNode;
+ const PropertyOwner& mRootNode;
};
} // unnamed namespace
-FrameCallbackProcessor::FrameCallbackProcessor( TransformManager& transformManager, Node& rootNode )
+FrameCallbackProcessor::FrameCallbackProcessor( TransformManager& transformManager )
: mFrameCallbacks(),
mTransformManager( transformManager ),
- mRootNode( rootNode )
+ mNodeHierarchyChanged( true )
{
}
{
Node& node = const_cast< Node& >( *rootNode ); // Was sent as const from event thread, we need to be able to use non-const version here.
- FrameCallbackInfo info;
- info.frameCallback = frameCallback;
- info.updateProxyImpl = new UpdateProxy( mTransformManager, node );
-
// We want to be notified when the node is destroyed (if we're not observing it already)
auto iter = std::find_if( mFrameCallbacks.begin(), mFrameCallbacks.end(), MatchRootNode< FrameCallbackInfo >( node ) );
if( iter == mFrameCallbacks.end() )
node.AddObserver( *this );
}
- mFrameCallbacks.push_back( info );
+ mFrameCallbacks.emplace_back( FrameCallbackInfo( frameCallback , new UpdateProxy( mTransformManager, node ) ) );
}
void FrameCallbackProcessor::RemoveFrameCallback( FrameCallbackInterface* frameCallback )
{
- auto iter = std::remove_if( mFrameCallbacks.begin(), mFrameCallbacks.end(),
- [ this, frameCallback ]
- ( const FrameCallbackInfo& info )
- {
- info.updateProxyImpl->GetRootNode().RemoveObserver( *this );
- delete info.updateProxyImpl;
- return info.frameCallback == frameCallback;
- } );
+ std::vector< SceneGraph::Node* > nodesToStopObserving;
+
+ // Find and remove all matching frame-callbacks
+ auto iter =
+ std::remove_if( mFrameCallbacks.begin(), mFrameCallbacks.end(),
+ [ frameCallback, &nodesToStopObserving ] ( FrameCallbackInfo& info )
+ {
+ bool match = false;
+ if( info.frameCallback == frameCallback )
+ {
+ nodesToStopObserving.push_back( &info.updateProxyImpl->GetRootNode() );
+ match = true;
+ }
+ return match;
+ } );
mFrameCallbacks.erase( iter, mFrameCallbacks.end() );
+
+ // Only stop observing the removed frame-callback nodes if none of the other frame-callbacks use them as root nodes
+ for( auto&& node : nodesToStopObserving )
+ {
+ auto nodeMatchingIter = std::find_if( mFrameCallbacks.begin(), mFrameCallbacks.end(), MatchRootNode< FrameCallbackInfo >( *node ) );
+ if( nodeMatchingIter == mFrameCallbacks.end() )
+ {
+ node->RemoveObserver( *this );
+ }
+ }
}
void FrameCallbackProcessor::Update( BufferIndex bufferIndex, float elapsedSeconds )
{
UpdateProxy& updateProxyImpl = *iter.updateProxyImpl;
updateProxyImpl.SetCurrentBufferIndex( bufferIndex );
+
+ if( mNodeHierarchyChanged )
+ {
+ updateProxyImpl.NodeHierarchyChanged();
+ }
+
Dali::UpdateProxy updateProxy( updateProxyImpl );
iter.frameCallback->Update( updateProxy, elapsedSeconds );
}
+ mNodeHierarchyChanged = false;
}
void FrameCallbackProcessor::PropertyOwnerDestroyed( PropertyOwner& owner )
*
*/
+// EXTERNAL INCLUDES
+#include <memory>
+
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/internal/common/buffer-index.h>
#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/manager/update-proxy-impl.h>
namespace Dali
{
namespace Internal
{
-class UpdateProxy;
-
namespace SceneGraph
{
/**
* Construct a new FrameCallbackProcessor.
*/
- FrameCallbackProcessor( TransformManager& transformManager, Node& rootNode );
+ FrameCallbackProcessor( TransformManager& transformManager );
/**
* Non-virtual Destructor.
*/
void Update( BufferIndex bufferIndex, float elapsedSeconds );
+ /**
+ * Called by the UpdateManager when the node hierarchy changes.
+ */
+ void NodeHierarchyChanged()
+ {
+ mNodeHierarchyChanged = true;
+ }
+
private:
// From PropertyOwner::Observer
struct FrameCallbackInfo
{
- FrameCallbackInterface* frameCallback;
- UpdateProxy* updateProxyImpl;
+ /**
+ * Default Constructor
+ * @param[in] frameCallbackObject A pointer to the frame-callback object
+ * @param[in] updateProxyPtr A raw pointer to the newly created updateProxy
+ * @note Ownership of @updateProxyPtr is passed to this class.
+ */
+ FrameCallbackInfo( FrameCallbackInterface* frameCallbackObject, UpdateProxy* updateProxyPtr )
+ : frameCallback( frameCallbackObject ),
+ updateProxyImpl( updateProxyPtr )
+ {
+ }
+
+ ~FrameCallbackInfo() = default; ///< Default destructor.
+
+ // Movable but not copyable
+ FrameCallbackInfo( const FrameCallbackInfo& ) = delete; ///< Deleted copy constructor.
+ FrameCallbackInfo( FrameCallbackInfo&& ) = default; ///< Default move constructor.
+ FrameCallbackInfo& operator=( const FrameCallbackInfo& ) = delete; ///< Deleted copy assignment operator.
+ FrameCallbackInfo& operator=( FrameCallbackInfo&& ) = default; ///< Default move assignment operator.
+
+ // Data
+ FrameCallbackInterface* frameCallback{ nullptr }; ///< Pointer to the implementation of the FrameCallbackInterface.
+ std::unique_ptr< UpdateProxy > updateProxyImpl{ nullptr }; ///< A unique pointer to the implementation of the UpdateProxy.
};
- std::vector< FrameCallbackInfo > mFrameCallbacks;
+ std::vector< FrameCallbackInfo > mFrameCallbacks; ///< A container of all the frame-callbacks & accompanying update-proxies.
TransformManager& mTransformManager;
- Node& mRootNode;
+
+ bool mNodeHierarchyChanged; ///< Set to true if the node hierarchy changes
};
} // namespace SceneGraph
************************** Update node hierarchy *****************************
******************************************************************************/
-inline void UpdateRootNodeOpacity( Layer& rootNode, int nodeDirtyFlags, BufferIndex updateBufferIndex )
+inline void UpdateRootNodeOpacity( Layer& rootNode, NodePropertyFlags nodeDirtyFlags, BufferIndex updateBufferIndex )
{
- if ( nodeDirtyFlags & ColorFlag )
+ if ( nodeDirtyFlags & NodePropertyFlags::COLOR )
{
rootNode.SetWorldColor( rootNode.GetColor( updateBufferIndex ), updateBufferIndex );
}
}
}
-inline void UpdateNodeOpacity( Node& node, int nodeDirtyFlags, BufferIndex updateBufferIndex )
+inline void UpdateNodeOpacity( Node& node, NodePropertyFlags nodeDirtyFlags, BufferIndex updateBufferIndex )
{
// If opacity needs to be recalculated
- if ( nodeDirtyFlags & ColorFlag )
+ if ( nodeDirtyFlags & NodePropertyFlags::COLOR )
{
node.InheritWorldColor( updateBufferIndex );
}
/**
* This is called recursively for all children of the root Node
*/
-inline int UpdateNodes( Node& node,
- int parentFlags,
- BufferIndex updateBufferIndex,
- RenderQueue& renderQueue,
- Layer& currentLayer,
- int inheritedDrawMode )
+inline NodePropertyFlags UpdateNodes( Node& node,
+ NodePropertyFlags parentFlags,
+ BufferIndex updateBufferIndex,
+ RenderQueue& renderQueue,
+ Layer& currentLayer,
+ uint32_t inheritedDrawMode )
{
// Apply constraints to the node
ConstrainPropertyOwner( node, updateBufferIndex );
// Short-circuit for invisible nodes
if ( !node.IsVisible( updateBufferIndex ) )
{
- return 0;
+ return NodePropertyFlags::NOTHING;
}
// If the node was not previously visible
}
// Some dirty flags are inherited from parent
- int nodeDirtyFlags( node.GetDirtyFlags() | ( parentFlags & InheritedDirtyFlags ) );
+ NodePropertyFlags nodeDirtyFlags = node.GetInheritedDirtyFlags( parentFlags );
- int cumulativeDirtyFlags = nodeDirtyFlags;
+ NodePropertyFlags cumulativeDirtyFlags = nodeDirtyFlags;
Layer* layer = ¤tLayer;
Layer* nodeIsLayer( node.GetLayer() );
/**
* The root node is treated separately; it cannot inherit values since it has no parent
*/
-int UpdateNodeTree( Layer& rootNode,
- BufferIndex updateBufferIndex,
- RenderQueue& renderQueue )
+NodePropertyFlags UpdateNodeTree( Layer& rootNode,
+ BufferIndex updateBufferIndex,
+ RenderQueue& renderQueue )
{
DALI_ASSERT_DEBUG( rootNode.IsRoot() );
// Short-circuit for invisible nodes
if ( DALI_UNLIKELY( !rootNode.IsVisible( updateBufferIndex ) ) ) // almost never ever true
{
- return 0;
+ return NodePropertyFlags::NOTHING;
}
// If the root node was not previously visible
rootNode.SetAllDirtyFlags();
}
- int nodeDirtyFlags( rootNode.GetDirtyFlags() );
+ NodePropertyFlags nodeDirtyFlags( rootNode.GetDirtyFlags() );
- int cumulativeDirtyFlags = nodeDirtyFlags;
+ NodePropertyFlags cumulativeDirtyFlags = nodeDirtyFlags;
UpdateRootNodeOpacity( rootNode, nodeDirtyFlags, updateBufferIndex );
#define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_ALGORITHMS_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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/internal/common/buffer-index.h>
+#include <dali/internal/update/nodes/node-declarations.h>
namespace Dali
{
{
class Layer;
-class Node;
class PropertyOwner;
class RenderQueue;
* @param[in] renderQueue Used to query messages for the next Render.
* @return The cumulative (ORed) dirty flags for the updated nodes
*/
-int UpdateNodeTree( Layer& rootNode,
- BufferIndex updateBufferIndex,
- RenderQueue& renderQueue );
+NodePropertyFlags UpdateNodeTree( Layer& rootNode,
+ BufferIndex updateBufferIndex,
+ RenderQueue& renderQueue );
} // namespace SceneGraph
messageQueue( renderController, sceneGraphBuffers ),
frameCallbackProcessor( NULL ),
keepRenderingSeconds( 0.0f ),
- nodeDirtyFlags( TransformFlag ), // set to TransformFlag to ensure full update the first time through Update()
+ nodeDirtyFlags( NodePropertyFlags::TRANSFORM ), // set to TransformFlag to ensure full update the first time through Update()
frameCounter( 0 ),
renderingBehavior( DevelStage::Rendering::IF_REQUIRED ),
animationFinishedDuringUpdate( false ),
{
if( ! frameCallbackProcessor )
{
- frameCallbackProcessor = new FrameCallbackProcessor( transformManager, *root );
+ frameCallbackProcessor = new FrameCallbackProcessor( transformManager );
}
return *frameCallbackProcessor;
}
OwnerPointer<FrameCallbackProcessor> frameCallbackProcessor; ///< Owned FrameCallbackProcessor, only created if required.
float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering
- int nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
+ NodePropertyFlags nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
int frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
DevelStage::Rendering renderingBehavior; ///< Set via DevelStage::SetRenderingBehavior
DALI_ASSERT_ALWAYS( NULL == node->GetParent() ); // Should not have a parent yet
parent->ConnectChild( node );
+
+ // Inform the frame-callback-processor, if set, about the node-hierarchy changing
+ if( mImpl->frameCallbackProcessor )
+ {
+ mImpl->frameCallbackProcessor->NodeHierarchyChanged();
+ }
}
void UpdateManager::DisconnectNode( Node* node )
{
Node* parent = node->GetParent();
DALI_ASSERT_ALWAYS( NULL != parent );
- parent->SetDirtyFlag( ChildDeletedFlag ); // make parent dirty so that render items dont get reused
+ parent->SetDirtyFlag( NodePropertyFlags::CHILD_DELETED ); // make parent dirty so that render items dont get reused
parent->DisconnectChild( mSceneGraphBuffers.GetUpdateBufferIndex(), *node );
+
+ // Inform the frame-callback-processor, if set, about the node-hierarchy changing
+ if( mImpl->frameCallbackProcessor )
+ {
+ mImpl->frameCallbackProcessor->NodeHierarchyChanged();
+ }
}
void UpdateManager::DestroyNode( Node* node )
void UpdateManager::UpdateNodes( BufferIndex bufferIndex )
{
- mImpl->nodeDirtyFlags = NothingFlag;
+ mImpl->nodeDirtyFlags = NodePropertyFlags::NOTHING;
if ( !mImpl->root )
{
//Update renderers and apply constraints
UpdateRenderers( bufferIndex );
- //Update the transformations of all the nodes
- mImpl->transformManager.Update();
-
// Call the frame-callback-processor if set
if( mImpl->frameCallbackProcessor )
{
mImpl->frameCallbackProcessor->Update( bufferIndex, elapsedSeconds );
}
+ //Update the transformations of all the nodes
+ mImpl->transformManager.Update();
+
//Process Property Notifications
ProcessPropertyNotifications( bufferIndex );
namespace
{
-SceneGraph::Node* FindNodeInSceneGraph( unsigned int id, SceneGraph::Node& node )
+SceneGraph::Node* FindNodeInSceneGraph( uint32_t id, SceneGraph::Node& node )
{
SceneGraph::Node* matchingNode = NULL;
{
}
-Vector3 UpdateProxy::GetPosition( unsigned int id ) const
+bool UpdateProxy::GetPosition( uint32_t id, Vector3& position ) const
{
- const Dali::Matrix& matrix = GetWorldMatrix( id );
- return matrix.GetTranslation3();
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ position = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION );
+ success = true;
+ }
+ return success;
}
-void UpdateProxy::SetPosition( unsigned int id, const Vector3& position )
+bool UpdateProxy::SetPosition( uint32_t id, const Vector3& position )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Matrix& matrix = mTransformManager.GetWorldMatrix( node->mTransformId );
- matrix.SetTranslation( position );
+ mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION, position );
+ success = true;
}
+ return success;
}
-const Vector3& UpdateProxy::GetSize( unsigned int id ) const
+bool UpdateProxy::BakePosition( uint32_t id, const Vector3& position )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION, position );
+ success = true;
}
+ return success;
+}
- return Vector3::ZERO;
+bool UpdateProxy::GetSize( uint32_t id, Vector3& size ) const
+{
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ size = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ success = true;
+ }
+ return success;
}
-void UpdateProxy::SetSize( unsigned int id, const Vector3& size )
+bool UpdateProxy::SetSize( uint32_t id, const Vector3& size )
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE, size );
+ success = true;
}
+ return success;
}
-void UpdateProxy::GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const
+bool UpdateProxy::BakeSize( uint32_t id, const Vector3& size )
{
- Matrix worldMatrix( false );
- GetWorldMatrixAndSize( id, worldMatrix, size );
- position = worldMatrix.GetTranslation3();
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE, size );
+ success = true;
+ }
+ return success;
}
-Vector4 UpdateProxy::GetWorldColor( unsigned int id ) const
+bool UpdateProxy::GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const
{
- SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return node->mWorldColor.Get( mCurrentBufferIndex );
+ position = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION );
+ size = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ success = true;
}
+ return success;
+}
- return Vector4::ZERO;
+bool UpdateProxy::GetScale( uint32_t id, Vector3& scale ) const
+{
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ scale = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE );
+ success = true;
+ }
+
+ return success;
}
-void UpdateProxy::SetWorldColor( unsigned int id, const Vector4& color ) const
+bool UpdateProxy::SetScale( uint32_t id, const Vector3& scale )
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Vector4& currentColor = node->mWorldColor.Get( mCurrentBufferIndex );
- currentColor = color;
+ mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE, scale );
+ success = true;
}
+ return success;
}
-void UpdateProxy::GetWorldMatrixAndSize( unsigned int id, Matrix& worldMatrix, Vector3& size ) const
+bool UpdateProxy::BakeScale( uint32_t id, const Vector3& scale )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- mTransformManager.GetWorldMatrixAndSize( node->mTransformId, worldMatrix, size );
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE, scale );
+ success = true;
}
+ return success;
}
-const Matrix& UpdateProxy::GetWorldMatrix( unsigned int id ) const
+bool UpdateProxy::GetColor( uint32_t id, Vector4& color ) const
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return mTransformManager.GetWorldMatrix( node->mTransformId );
+ color = node->mColor.Get( mCurrentBufferIndex );
+ success = true;
}
- return Matrix::IDENTITY;
+ return success;
}
-void UpdateProxy::SetWorldMatrix( unsigned int id, const Matrix& worldMatrix )
+bool UpdateProxy::SetColor( uint32_t id, const Vector4& color ) const
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Matrix& currentMatrix = mTransformManager.GetWorldMatrix( node->mTransformId );
- currentMatrix = worldMatrix;
+ node->mColor.Set( mCurrentBufferIndex, color );
+ success = true;
}
+ return success;
+}
+
+bool UpdateProxy::BakeColor( uint32_t id, const Vector4& color ) const
+{
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ node->mColor.Bake( mCurrentBufferIndex, color );
+ success = true;
+ }
+ return success;
+}
+
+void UpdateProxy::NodeHierarchyChanged()
+{
+ mLastCachedIdNodePair = { 0u, NULL };
+ mNodeContainer.clear();
}
-SceneGraph::Node* UpdateProxy::GetNodeWithId( unsigned int id ) const
+SceneGraph::Node* UpdateProxy::GetNodeWithId( uint32_t id ) const
{
SceneGraph::Node* node = NULL;
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
+#include <cstdint>
// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/vector3.h>
#include <dali/internal/common/buffer-index.h>
/**
* @copydoc Dali::UpdateProxy::GetPosition()
*/
- Vector3 GetPosition( unsigned int id ) const;
+ bool GetPosition( uint32_t id, Vector3& position) const;
/**
* @copydoc Dali::UpdateProxy::SetPosition()
*/
- void SetPosition( unsigned int id, const Vector3& position );
+ bool SetPosition( uint32_t id, const Vector3& position );
+
+ /**
+ * @copydoc Dali::UpdateProxy::BakePosition()
+ */
+ bool BakePosition( uint32_t id, const Vector3& position );
/**
* @copydoc Dali::UpdateProxy::GetSize()
*/
- const Vector3& GetSize( unsigned int id ) const;
+ bool GetSize( uint32_t id, Vector3& size ) const;
/**
* @copydoc Dali::UpdateProxy::SetSize()
*/
- void SetSize( unsigned int id, const Vector3& size );
+ bool SetSize( uint32_t id, const Vector3& size );
+
+ /**
+ * @copydoc Dali::UpdateProxy::BakeSize()
+ */
+ bool BakeSize( uint32_t id, const Vector3& size );
/**
* @copydoc Dali::UpdateProxy::GetPositionAndSize()
*/
- void GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const;
+ bool GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const;
/**
- * @copydoc Dali::UpdateProxy::GetColor()
+ * @copydoc Dali::UpdateProxy::GetScale()
*/
- Vector4 GetWorldColor( unsigned int id ) const;
+ bool GetScale( uint32_t id, Vector3& scale ) const;
/**
- * @copydoc Dali::UpdateProxy::SetColor()
+ * @copydoc Dali::UpdateProxy::SetScale()
*/
- void SetWorldColor( unsigned int id, const Vector4& color ) const;
+ bool SetScale( uint32_t id, const Vector3& scale );
/**
- * @copydoc Dali::UpdateProxy::GetWorldMatrixAndSize()
+ * @copydoc Dali::UpdateProxy::BakeScale()
*/
- void GetWorldMatrixAndSize( unsigned int id, Matrix& worldMatrix, Vector3& size ) const;
+ bool BakeScale( uint32_t id, const Vector3& scale );
/**
- * @copydoc Dali::UpdateProxy::GetWorldMatrix()
+ * @copydoc Dali::UpdateProxy::GetColor()
+ */
+ bool GetColor( uint32_t id, Vector4& color ) const;
+
+ /**
+ * @copydoc Dali::UpdateProxy::SetColor()
*/
- const Matrix& GetWorldMatrix( unsigned int id ) const;
+ bool SetColor( uint32_t id, const Vector4& color ) const;
/**
- * @copydoc Dali::UpdateProxy::SetWorldMatrix()
+ * @copydoc Dali::UpdateProxy::BakeColor()
*/
- void SetWorldMatrix( unsigned int id, const Matrix& worldMatrix );
+ bool BakeColor( uint32_t id, const Vector4& color ) const;
/**
* @brief Retrieves the root-node used by this class
return mRootNode;
}
+ /**
+ * @brief Sets the buffer index to use when processing the next callback.
+ * @param[in] bufferIndex The current buffer index
+ */
void SetCurrentBufferIndex( BufferIndex bufferIndex )
{
mCurrentBufferIndex = bufferIndex;
}
+ /**
+ * @brief Informs the update-proxy that the node hierarchy has changed.
+ */
+ void NodeHierarchyChanged();
+
private:
/**
* @return A pointer to the required node if found.
* @note This caches the last accessed node.
*/
- SceneGraph::Node* GetNodeWithId( unsigned int id ) const;
+ SceneGraph::Node* GetNodeWithId( uint32_t id ) const;
private:
*/
struct IdNodePair
{
- unsigned int id; ///< The ID of the node
+ uint32_t id; ///< The ID of the node
SceneGraph::Node* node; ///< The node itself
};
mutable std::vector< IdNodePair > mNodeContainer; ///< Used to store cached pointers to already searched for Nodes.
mutable IdNodePair mLastCachedIdNodePair; ///< Used to cache the last retrieved id-node pair.
- unsigned int mCurrentBufferIndex;
+ BufferIndex mCurrentBufferIndex;
SceneGraph::TransformManager& mTransformManager; ///< Reference to the Transform Manager.
SceneGraph::Node& mRootNode; ///< The root node of this update proxy.
#define __DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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/common/dali-vector.h>
+#include <dali/devel-api/common/bitwise-enum.h>
#include <dali/devel-api/common/owner-container.h>
#include <dali/internal/common/owner-pointer.h>
typedef NodeContainer::Iterator NodeIter;
typedef NodeContainer::ConstIterator NodeConstIter;
+/**
+ * Flag whether property has changed, during the Update phase.
+ */
+enum class NodePropertyFlags : uint8_t
+// 8 bits is enough for 4 flags (compiler will check it)
+{
+ NOTHING = 0x000,
+ TRANSFORM = 0x001,
+ VISIBLE = 0x002,
+ COLOR = 0x004,
+ CHILD_DELETED = 0x008,
+ ALL = ( CHILD_DELETED << 1 ) - 1 // all the flags
+};
+
} // namespace SceneGraph
} // namespace Internal
+// specialization has to be done in the same namespace
+template<> struct EnableBitMaskOperators< Internal::SceneGraph::NodePropertyFlags > { static const bool ENABLE = true; };
+
} // namespace Dali
#endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_DECLARATIONS_H__
Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Node> gNodeMemoryPool;
#ifdef DEBUG_ENABLED
// keep track of nodes created / deleted, to ensure we have 0 when the process exits or DALi library is unloaded
-int gNodeCount =0;
+int32_t gNodeCount =0;
// Called when the process is about to exit, Node count should be zero at this point.
void __attribute__ ((destructor)) ShutDown(void)
const PositionInheritanceMode Node::DEFAULT_POSITION_INHERITANCE_MODE( INHERIT_PARENT_POSITION );
const ColorMode Node::DEFAULT_COLOR_MODE( USE_OWN_MULTIPLY_PARENT_ALPHA );
-
-Node* Node::New( unsigned int id )
+Node* Node::New( uint32_t id )
{
return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node( id );
}
}
}
-Node::Node( unsigned int id )
+Node::Node( uint32_t id )
: mTransformManager( NULL ),
mTransformId( INVALID_TRANSFORM_ID ),
mParentOrigin( TRANSFORM_PROPERTY_PARENT_ORIGIN ),
mClippingDepth( 0u ),
mScissorDepth( 0u ),
mDepthIndex( 0u ),
+ mDirtyFlags( NodePropertyFlags::ALL ),
mRegenerateUniformMap( 0 ),
- mDirtyFlags( AllFlags ),
mDrawMode( DrawMode::NORMAL ),
mColorMode( DEFAULT_COLOR_MODE ),
mClippingMode( ClippingMode::DISABLED ),
void Node::PrepareRender( BufferIndex bufferIndex )
{
- if(mRegenerateUniformMap != 0 )
+ if( mRegenerateUniformMap != 0 )
{
if( mRegenerateUniformMap == 2 )
{
CollectedUniformMap& localMap = mCollectedUniformMap[ bufferIndex ];
localMap.Resize(0);
- for( unsigned int i=0, count=mUniformMaps.Count(); i<count; ++i )
+ for( uint32_t i = 0, count=mUniformMaps.Count(); i<count; ++i )
{
localMap.PushBack( &mUniformMaps[i] );
}
localMap.Resize( oldMap.Count() );
- unsigned int index=0;
+ CollectedUniformMap::SizeType index = 0;
for( CollectedUniformMap::Iterator iter = oldMap.Begin(), end = oldMap.End() ; iter != end ; ++iter, ++index )
{
localMap[index] = *iter;
void Node::AddRenderer( Renderer* renderer )
{
- // Check that it has not been already added.
- unsigned int rendererCount( mRenderer.Size() );
- for( unsigned int i(0); i < rendererCount; ++i )
- {
- if( mRenderer[i] == renderer )
- {
- // Renderer is already in the list.
- return;
- }
- }
-
// If it is the first renderer added, make sure the world transform will be calculated
// in the next update as world transform is not computed if node has no renderers.
- if( rendererCount == 0 )
+ if( mRenderer.Empty() )
{
- mDirtyFlags |= TransformFlag;
+ mDirtyFlags |= NodePropertyFlags::TRANSFORM;
+ }
+ else
+ {
+ // Check that it has not been already added.
+ for( auto&& existingRenderer : mRenderer )
+ {
+ if( existingRenderer == renderer )
+ {
+ // Renderer is already in the list.
+ return;
+ }
+ }
}
mRenderer.PushBack( renderer );
void Node::RemoveRenderer( Renderer* renderer )
{
- unsigned int rendererCount( mRenderer.Size() );
- for( unsigned int i(0); i<rendererCount; ++i )
+ RendererContainer::SizeType rendererCount( mRenderer.Size() );
+ for( RendererContainer::SizeType i = 0; i < rendererCount; ++i )
{
if( mRenderer[i] == renderer )
{
}
}
-int Node::GetDirtyFlags() const
+NodePropertyFlags Node::GetDirtyFlags() const
{
// get initial dirty flags, they are reset ResetDefaultProperties, but setters may have made the node dirty already
- int flags = mDirtyFlags;
+ NodePropertyFlags flags = mDirtyFlags;
// Check whether the visible property has changed
if ( !mVisible.IsClean() )
{
- flags |= VisibleFlag;
+ flags |= NodePropertyFlags::VISIBLE;
}
// Check whether the color property has changed
if ( !mColor.IsClean() )
{
- flags |= ColorFlag;
+ flags |= NodePropertyFlags::COLOR;
}
return flags;
}
+NodePropertyFlags Node::GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const
+{
+ // Size is not inherited. VisibleFlag is inherited
+ static const NodePropertyFlags InheritedDirtyFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::VISIBLE | NodePropertyFlags::COLOR;
+ using UnderlyingType = typename std::underlying_type<NodePropertyFlags>::type;
+
+ return static_cast<NodePropertyFlags>( static_cast<UnderlyingType>( mDirtyFlags ) |
+ ( static_cast<UnderlyingType>( parentFlags ) & static_cast<UnderlyingType>( InheritedDirtyFlags ) ) );
+}
+
void Node::ResetDirtyFlags( BufferIndex updateBufferIndex )
{
- mDirtyFlags = NothingFlag;
+ mDirtyFlags = NodePropertyFlags::NOTHING;
}
void Node::SetParent( Node& parentNode )
class RenderTask;
class UpdateManager;
-/**
- * Flag whether property has changed, during the Update phase.
- */
-enum NodePropertyFlags
-{
- NothingFlag = 0x000,
- TransformFlag = 0x001,
- VisibleFlag = 0x002,
- ColorFlag = 0x004,
- SizeFlag = 0x008,
- OverlayFlag = 0x010,
- SortModifierFlag = 0x020,
- ChildDeletedFlag = 0x040,
-};
-
-static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
-
-/**
- * Size is not inherited. VisibleFlag is inherited
- */
-static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
// Flags which require the scene renderable lists to be updated
-static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
+static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
/**
* Node is the base class for all nodes in the Scene Graph.
* Construct a new Node.
* @param[in] id The unique ID of the node
*/
- static Node* New( unsigned int id );
+ static Node* New( uint32_t id );
/**
* Deletes a Node.
* Get the renderer at the given index
* @param[in] index
*/
- Renderer* GetRendererAt( unsigned int index ) const
+ Renderer* GetRendererAt( uint32_t index ) const
{
return mRenderer[index];
}
/**
* Retrieve the number of renderers for the node
*/
- unsigned int GetRendererCount()
+ uint32_t GetRendererCount() const
{
- return mRenderer.Size();
+ return static_cast<uint32_t>( mRenderer.Size() );
}
// Containment methods
* Flag that one of the node values has changed in the current frame.
* @param[in] flag The flag to set.
*/
- void SetDirtyFlag(NodePropertyFlags flag)
+ void SetDirtyFlag( NodePropertyFlags flag )
{
mDirtyFlags |= flag;
}
*/
void SetAllDirtyFlags()
{
- mDirtyFlags = AllFlags;
+ mDirtyFlags = NodePropertyFlags::ALL;
}
/**
* Query whether a node is dirty.
* @return The dirty flags
*/
- int GetDirtyFlags() const;
+ NodePropertyFlags GetDirtyFlags() const;
+
+ /**
+ * Query inherited dirty flags.
+ *
+ * @param The parentFlags to or with
+ * @return The inherited dirty flags
+ */
+ NodePropertyFlags GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const;
/**
* Retrieve the parent-origin of the node.
* or inherits its parent color.
* @param[in] colorMode The new color mode.
*/
- void SetColorMode(ColorMode colorMode)
+ void SetColorMode( ColorMode colorMode )
{
mColorMode = colorMode;
- SetDirtyFlag(ColorFlag);
+ SetDirtyFlag( NodePropertyFlags::COLOR );
}
/**
* @brief Sets the sibling order of the node
* @param[in] order The new order
*/
- void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
+ void SetDepthIndex( uint32_t depthIndex )
+ {
+ mDepthIndex = depthIndex;
+ }
/**
* @brief Get the depth index of the node
* @return Current depth index
*/
- unsigned int GetDepthIndex(){ return mDepthIndex; }
+ uint32_t GetDepthIndex()
+ {
+ return mDepthIndex;
+ }
/**
* @brief Sets the boolean which states whether the position should use the anchor-point.
* Protected constructor; See also Node::New()
* @param[in] id The Unique ID of the actor creating the node
*/
- Node( unsigned int id );
+ Node( uint32_t id );
/**
* Protected virtual destructor; See also Node::Delete( Node* )
/**
* @copydoc NodeDataProvider::GetModelMatrix
*/
- virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
+ virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const
{
- return GetWorldMatrix( bufferId );
+ return GetWorldMatrix( bufferIndex );
}
/**
* @copydoc NodeDataProvider::GetRenderColor
*/
- virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
+ virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const
{
- return GetWorldColor( bufferId );
+ return GetWorldColor( bufferIndex );
}
public: // From UniformMapDataProvider
TransformManager* mTransformManager;
TransformId mTransformId;
- TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
- TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
+ TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
+ TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
InheritedColor mWorldColor; ///< Full inherited color
uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
- const unsigned int mId; ///< The Unique ID of the node.
+ const uint32_t mId; ///< The Unique ID of the node.
protected:
NodeContainer mChildren; ///< Container of children; not owned
CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
- unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
+ uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
uint32_t mDepthIndex; ///< Depth index of the node
// flags, compressed to bitfield
- unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
- int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
+ NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
+ uint32_t mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
typedef MessageValue1< Node, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
typedef MessageValue1< Node, Vector3 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
typedef MessageValue1< Node, Vector3 > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
typedef MessageValue1< Node, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
typedef MessageValue1< Node, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
typedef MessageValue1< Node, ColorMode > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
typedef MessageValue1< Node, DrawMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
typedef MessageValue1< Node, Renderer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::AddRenderer, renderer );
typedef MessageValue1< Node, Renderer* > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
}
-inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
+inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
{
- typedef MessageValue1< Node, unsigned int > LocalType;
+ typedef MessageValue1< Node, uint32_t > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
typedef MessageValue1< Node, ClippingMode::Type > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
typedef MessageValue1< Node, bool > LocalType;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
{
mUpdateViewFlag = UPDATE_COUNT;
}
- if( mNode->GetDirtyFlags() & VisibleFlag )
+ if( mNode->GetDirtyFlags() & NodePropertyFlags::VISIBLE )
{
// If the visibility changes, the projection matrix needs to be re-calculated.
// It may happen the first time an actor is rendered it's rendered only once and becomes invisible,
GetImplementation(*this).SetName(name);
}
-unsigned int Actor::GetId() const
+uint32_t Actor::GetId() const
{
return GetImplementation(*this).GetId();
}
GetImplementation(*this).Unparent();
}
-unsigned int Actor::GetChildCount() const
+uint32_t Actor::GetChildCount() const
{
return GetImplementation(*this).GetChildCount();
}
-Actor Actor::GetChildAt(unsigned int index) const
+Actor Actor::GetChildAt( uint32_t index ) const
{
Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
return Actor( child.Get() );
return Actor( child.Get() );
}
-Actor Actor::FindChildById(const unsigned int id)
+Actor Actor::FindChildById( const uint32_t id )
{
Internal::ActorPtr child = GetImplementation(*this).FindChildById( id );
return Actor( child.Get() );
return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
}
-int Actor::GetHierarchyDepth()
+int32_t Actor::GetHierarchyDepth()
{
return GetImplementation(*this).GetHierarchyDepth();
}
return GetImplementation(*this).OffStageSignal();
}
-unsigned int Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer( Renderer& renderer )
{
return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
}
-unsigned int Actor::GetRendererCount() const
+uint32_t Actor::GetRendererCount() const
{
return GetImplementation(*this).GetRendererCount();
}
-Renderer Actor::GetRendererAt( unsigned int index )
+Renderer Actor::GetRendererAt( uint32_t index )
{
Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
return Renderer( renderer.Get() );
GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
}
-void Actor::RemoveRenderer( unsigned int index )
+void Actor::RemoveRenderer( uint32_t index )
{
GetImplementation(*this).RemoveRenderer( index );
}
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor-enumerations.h>
* @return The ID
* @pre The Actor has been initialized.
*/
- unsigned int GetId() const;
+ uint32_t GetId() const;
// Containment
* @return The number of children
* @pre The Actor has been initialized.
*/
- unsigned int GetChildCount() const;
+ uint32_t GetChildCount() const;
/**
* @brief Retrieve and child actor by index.
* @return The actor for the given index or empty handle if children not initialized
* @pre The Actor has been initialized.
*/
- Actor GetChildAt(unsigned int index) const;
+ Actor GetChildAt( uint32_t index ) const;
/**
* @brief Search through this actor's hierarchy for an actor with the given name.
* @return A handle to the actor if found, or an empty handle if not
* @pre The Actor has been initialized.
*/
- Actor FindChildById(const unsigned int id);
+ Actor FindChildById( const uint32_t id );
/**
* @brief Retrieves the actor's parent.
* @SINCE_1_0.0
* @return The current depth in the hierarchy of the actor, or @c -1 if actor is not in the hierarchy
*/
- int GetHierarchyDepth();
+ int32_t GetHierarchyDepth();
public: // Renderer
* @pre The renderer must be initialized.
*
*/
- unsigned int AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer( Renderer& renderer );
/**
* @brief Gets the number of renderers on this actor.
* @SINCE_1_0.0
* @return The number of renderers on this actor
*/
- unsigned int GetRendererCount() const;
+ uint32_t GetRendererCount() const;
/**
* @brief Gets a Renderer by index.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- Renderer GetRendererAt( unsigned int index );
+ Renderer GetRendererAt( uint32_t index );
/**
* @brief Removes a renderer from the actor.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- void RemoveRenderer( unsigned int index );
+ void RemoveRenderer( uint32_t index );
public: // Signals
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/object/property.h>
#include <dali/public-api/object/ref-object.h>
* @endcode
* @param[in] depth The depth in the hierarchy for the actor
*/
- virtual void OnStageConnection( int depth ) = 0;
+ virtual void OnStageConnection( int32_t depth ) = 0;
/**
* @brief Called after the actor has been disconnected from Stage.
LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0
};
- static const int ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum
+ static const int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum
/**
* @brief Creates a CustomActorImpl.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return *this;
}
-unsigned int Layer::GetDepth() const
+uint32_t Layer::GetDepth() const
{
return GetImplementation(*this).GetDepth();
}
return GetImplementation(*this).IsClipping();
}
-void Layer::SetClippingBox(int x, int y, int width, int height)
+void Layer::SetClippingBox(int32_t x, int32_t y, int32_t width, int32_t height)
{
GetImplementation(*this).SetClippingBox(x, y, width, height);
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/actor.h>
* @SINCE_1_0.0
* @see Dali::Layer::SetClippingBox()
*/
-typedef Rect<int> ClippingBox;
+typedef Rect<int32_t> ClippingBox;
/**
* @brief Layers provide a mechanism for overlaying groups of actors on top of each other.
enum
{
CLIPPING_ENABLE = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "clippingEnable", type bool @SINCE_1_0.0
- CLIPPING_BOX, ///< name "clippingBox", type Rect<int> @SINCE_1_0.0
+ CLIPPING_BOX, ///< name "clippingBox", type Rect<int32_t> @SINCE_1_0.0
BEHAVIOR, ///< name "behavior", type String @SINCE_1_0.0
};
};
* @pre Layer is on the stage.
* If layer is not added to the stage, returns 0.
*/
- unsigned int GetDepth() const;
+ uint32_t GetDepth() const;
/**
* @brief Increments the depth of the layer.
* @param[in] width The width of the box
* @param[in] height The height of the box
*/
- void SetClippingBox(int x, int y, int width, int height);
+ void SetClippingBox(int32_t x, int32_t y, int32_t width, int32_t height);
/**
* @brief Sets the clipping box of a layer in window coordinates.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-constexpr unsigned int BitMaskOfN( unsigned int bits )
+constexpr uint32_t BitMaskOfN( uint32_t bits )
{
return ( 1 << bits ) - 1;
}
+
} // unnamed namespace
AlphaFunction::AlphaFunction()
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
GetImplementation(*this).SetLooping(looping);
}
-void Animation::SetLoopCount(int count)
+void Animation::SetLoopCount(int32_t count)
{
GetImplementation(*this).SetLoopCount(count);
}
-int Animation::GetLoopCount()
+int32_t Animation::GetLoopCount()
{
return GetImplementation(*this).GetLoopCount();
}
-int Animation::GetCurrentLoop()
+int32_t Animation::GetCurrentLoop()
{
return GetImplementation(*this).GetCurrentLoop();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/key-frames.h>
* @SINCE_1_1.20
* @param[in] count The number of times to loop
*/
- void SetLoopCount(int count);
+ void SetLoopCount(int32_t count);
/**
* @brief Gets the loop count.
* @SINCE_1_1.20
* @return The number of times to loop
*/
- int GetLoopCount();
+ int32_t GetLoopCount();
/**
* @brief Gets the current loop count.
* @SINCE_1_1.20
* @return The current number of loops that have occured
*/
- int GetCurrentLoop();
+ int32_t GetCurrentLoop();
/**
* @brief Queries whether the animation will loop.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return GetImplementation(*this).GetRemoveAction();
}
-void Constraint::SetTag( const unsigned int tag )
+void Constraint::SetTag( uint32_t tag )
{
GetImplementation(*this).SetTag( tag );
}
-unsigned int Constraint::GetTag() const
+uint32_t Constraint::GetTag() const
{
return GetImplementation(*this).GetTag();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/animation/constraint-source.h>
#include <dali/public-api/common/dali-vector.h>
* @SINCE_1_0.0
* @param[in] tag An integer to identify the constraint
*/
- void SetTag( const unsigned int tag );
+ void SetTag( uint32_t tag );
/**
* @brief Gets the tag.
* @SINCE_1_0.0
* @return The tag
*/
- unsigned int GetTag() const;
+ uint32_t GetTag() const;
public: // Not intended for use by Application developers
namespace
{
-const int MAX_NUM_STACK_FRAMES = 25;
+const int32_t MAX_NUM_STACK_FRAMES = 25;
}
std::string Demangle(const char* symbol)
mangledSymbol[tokenLength] = '\0';
size_t size;
- int status;
+ int32_t status;
char* demangled=NULL;
demangled = abi::__cxa_demangle( mangledSymbol, NULL, &size, &status );
if( demangled != NULL )
DALI_LOG_ERROR_NOFN("Backtrace:\n");
void* frameArray[MAX_NUM_STACK_FRAMES];
- int nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES);
+ int32_t nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES);
char** symbols = backtrace_symbols(frameArray, nSize);
- for(int i=1; i< nSize; i++)
+ for(int32_t i=1; i< nSize; i++)
{
std::string demangled_symbol = Demangle(symbols[i]);
DALI_LOG_ERROR_NOFN("[%02d] %s\n", i, demangled_symbol.c_str() );
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
// adjust pointer to real beginning
SizeType* metadata = reinterpret_cast< SizeType* >( mData );
- // TODO would be nice to memset to a bitpattern to catch illegal use of container after release
- // but that would require knowledge of the itemsize
+
delete [] ( metadata - 2u );
mData = 0u;
}
if( capacity > oldCapacity )
{
const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
- void* wholeData = reinterpret_cast< void* >( new unsigned char[ wholeAllocation ] );
+ void* wholeData = reinterpret_cast< void* >( new uint8_t[ wholeAllocation ] );
DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" );
#if defined( DEBUG_ENABLED )
// EXTERNAL INCLUDES
#include <cstddef>
#include <algorithm>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
std::size_t offset = at - reinterpret_cast<char*>( mData );
// need more space
- Reserve( NextPowerOfTwo( newCount ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size.
+ Reserve( NextPowerOfTwo( static_cast<uint32_t>( newCount ) ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size.
// Set the new at pointer.
at = reinterpret_cast<char*>( mData ) + offset;
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return GetImplementation(*this).GetSize();
}
-unsigned int Stage::GetLayerCount() const
+uint32_t Stage::GetLayerCount() const
{
return GetImplementation(*this).GetLayerCount();
}
-Layer Stage::GetLayer(unsigned int depth) const
+Layer Stage::GetLayer(uint32_t depth) const
{
return GetImplementation(*this).GetLayer(depth);
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/dali-signal.h>
* @SINCE_1_0.0
* @return The number of layers
*/
- unsigned int GetLayerCount() const;
+ uint32_t GetLayerCount() const;
/**
* @brief Retrieves the layer at a specified depth.
* @return The layer found at the given depth
* @pre Depth is less than layer count; see GetLayerCount().
*/
- Layer GetLayer(unsigned int depth) const;
+ Layer GetLayer(uint32_t depth) const;
/**
* @brief Returns the Stage's Root Layer.
namespace Dali
{
-const unsigned int CORE_MAJOR_VERSION = 1;
-const unsigned int CORE_MINOR_VERSION = 3;
-const unsigned int CORE_MICRO_VERSION = 45;
+const uint32_t CORE_MAJOR_VERSION = 1;
+const uint32_t CORE_MINOR_VERSION = 3;
+const uint32_t CORE_MICRO_VERSION = 46;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-DALI_CORE_API extern const unsigned int CORE_MAJOR_VERSION; ///< The major version number of the Core library.
-DALI_CORE_API extern const unsigned int CORE_MINOR_VERSION; ///< The minor version number of the Core library.
-DALI_CORE_API extern const unsigned int CORE_MICRO_VERSION; ///< The micro version number of the Core library.
+DALI_CORE_API extern const uint32_t CORE_MAJOR_VERSION; ///< The major version number of the Core library.
+DALI_CORE_API extern const uint32_t CORE_MINOR_VERSION; ///< The minor version number of the Core library.
+DALI_CORE_API extern const uint32_t CORE_MICRO_VERSION; ///< The micro version number of the Core library.
DALI_CORE_API extern const char * const CORE_BUILD_DATE; ///< The date/time the Core library was built.
} // namespace Dali
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/handle.h>
namespace Dali
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
/**
* @brief The time the gesture took place.
*/
- unsigned int time;
+ uint32_t time;
protected: // Creation
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
}
-unsigned int HoverEvent::GetPointCount() const
+uint32_t HoverEvent::GetPointCount() const
{
- return points.size();
+ return static_cast<uint32_t>( points.size() );
}
-const TouchPoint& HoverEvent::GetPoint(unsigned int point) const
+const TouchPoint& HoverEvent::GetPoint( uint32_t point ) const
{
DALI_ASSERT_ALWAYS( point < points.size() && "No point at index" );
return points[point];
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/events/touch-point.h>
* @SINCE_1_0.0
* @return Total number of Points
*/
- unsigned int GetPointCount() const;
+ uint32_t GetPointCount() const;
/**
* @brief Returns a touch point at the index requested.
* @note "point" should be less than the value returned by GetPointCount().
* If out of range, then program asserts.
*/
- const TouchPoint& GetPoint(unsigned int point) const;
+ const TouchPoint& GetPoint( uint32_t point) const;
};
/**
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-const unsigned int MODIFIER_SHIFT = 0x1;
-const unsigned int MODIFIER_CTRL = 0x2;
-const unsigned int MODIFIER_ALT = 0x4;
-const int KEY_INVALID_CODE = -1;
+const uint32_t MODIFIER_SHIFT = 0x1;
+const uint32_t MODIFIER_CTRL = 0x2;
+const uint32_t MODIFIER_ALT = 0x4;
+const int32_t KEY_INVALID_CODE = -1;
}
KeyEvent::KeyEvent()
new Internal::KeyEventImpl( this );
}
-KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier,unsigned long timeStamp, const State& keyState)
+KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, int32_t keyCode, int32_t keyModifier,unsigned long timeStamp, const State& keyState)
: keyPressedName(keyName),
keyPressed(keyString),
keyCode(keyCode),
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // int32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @param[in] timeStamp The time (in ms) that the key event occurred
* @param[in] keyState The state of the key event
*/
- KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, unsigned long timeStamp, const State& keyState);
+ KeyEvent(const std::string& keyName, const std::string& keyString, int32_t keyCode, int32_t keyModifier, unsigned long timeStamp, const State& keyState);
/**
* @brief Copy constructor.
* platform-specific key code. You need to use IsKey() to know what a key event means
* instead of direct comparison of key code value.
*/
- int keyCode;
+ int32_t keyCode;
/**
* @brief special keys like shift, alt and control which modify the next key pressed.
*/
- int keyModifier;
+ int32_t keyModifier;
/**
* @brief The time (in ms) that the key event occurred.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return LongPressGestureDetector(internal.Get());
}
-LongPressGestureDetector LongPressGestureDetector::New(unsigned int touchesRequired)
+LongPressGestureDetector LongPressGestureDetector::New(uint32_t touchesRequired)
{
Internal::LongPressGestureDetectorPtr internal = Internal::LongPressGestureDetector::New(touchesRequired);
return LongPressGestureDetector(internal.Get());
}
-LongPressGestureDetector LongPressGestureDetector::New(unsigned int minTouches, unsigned int maxTouches)
+LongPressGestureDetector LongPressGestureDetector::New(uint32_t minTouches, uint32_t maxTouches)
{
Internal::LongPressGestureDetectorPtr internal = Internal::LongPressGestureDetector::New(minTouches, maxTouches);
return *this;
}
-void LongPressGestureDetector::SetTouchesRequired(unsigned int touches)
+void LongPressGestureDetector::SetTouchesRequired(uint32_t touches)
{
GetImplementation(*this).SetTouchesRequired(touches);
}
-void LongPressGestureDetector::SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches)
+void LongPressGestureDetector::SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches)
{
GetImplementation(*this).SetTouchesRequired(minTouches, maxTouches);
}
-unsigned int LongPressGestureDetector::GetMinimumTouchesRequired() const
+uint32_t LongPressGestureDetector::GetMinimumTouchesRequired() const
{
return GetImplementation(*this).GetMinimumTouchesRequired();
}
-unsigned int LongPressGestureDetector::GetMaximumTouchesRequired() const
+uint32_t LongPressGestureDetector::GetMaximumTouchesRequired() const
{
return GetImplementation(*this).GetMaximumTouchesRequired();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/events/gesture-detector.h>
#include <dali/public-api/signals/dali-signal.h>
* @param[in] touchesRequired The number of touches required
* @return A handle to a newly allocated Dali resource
*/
- static LongPressGestureDetector New(unsigned int touchesRequired);
+ static LongPressGestureDetector New(uint32_t touchesRequired);
/**
* @brief Creates an initialized LongPressGestureDetector with the minimum and maximum number of touches required.
* @param[in] maxTouches The maximum number of touches required
* @return A handle to a newly allocated Dali resource
*/
- static LongPressGestureDetector New(unsigned int minTouches, unsigned int maxTouches);
+ static LongPressGestureDetector New(uint32_t minTouches, uint32_t maxTouches);
/**
* @brief Downcasts a handle to LongPressGestureDetector handle.
* @pre The gesture detector has been initialized.
* @note The default is '1'.
*/
- void SetTouchesRequired(unsigned int touches);
+ void SetTouchesRequired(uint32_t touches);
/**
* @brief Sets the minimum and maximum touches required.
* @pre The gesture detector has been initialized.
* @note The default is '1'.
*/
- void SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches);
+ void SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches);
public: // Getters
* @return The minimum number of touches required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMinimumTouchesRequired() const;
+ uint32_t GetMinimumTouchesRequired() const;
/**
* @brief Retrieves the maximum number of touches required.
* @return The maximum number of touches required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMaximumTouchesRequired() const;
+ uint32_t GetMaximumTouchesRequired() const;
public: // Signals
* @brief The number of touch points in this long press gesture, i.e. the number of fingers the user had
* on the screen to generate the long press gesture.
*/
- unsigned int numberOfTouches;
+ uint32_t numberOfTouches;
/**
* @brief This is the point, in screen coordinates, where the long press occurred.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return *this;
}
-void PanGestureDetector::SetMinimumTouchesRequired(unsigned int minimum)
+void PanGestureDetector::SetMinimumTouchesRequired(uint32_t minimum)
{
GetImplementation(*this).SetMinimumTouchesRequired(minimum);
}
-void PanGestureDetector::SetMaximumTouchesRequired(unsigned int maximum)
+void PanGestureDetector::SetMaximumTouchesRequired(uint32_t maximum)
{
GetImplementation(*this).SetMaximumTouchesRequired(maximum);
}
-unsigned int PanGestureDetector::GetMinimumTouchesRequired() const
+uint32_t PanGestureDetector::GetMinimumTouchesRequired() const
{
return GetImplementation(*this).GetMinimumTouchesRequired();
}
-unsigned int PanGestureDetector::GetMaximumTouchesRequired() const
+uint32_t PanGestureDetector::GetMaximumTouchesRequired() const
{
return GetImplementation(*this).GetMaximumTouchesRequired();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/events/gesture-detector.h>
#include <dali/public-api/object/property-index-ranges.h>
* @pre The gesture detector has been initialized.
* @note The default minimum is '1'.
*/
- void SetMinimumTouchesRequired(unsigned int minimum);
+ void SetMinimumTouchesRequired(uint32_t minimum);
/**
* @brief This is the maximum number of touches required for the pan gesture to be detected.
* @pre The gesture detector has been initialized.
* @note The default maximum is '1'.
*/
- void SetMaximumTouchesRequired(unsigned int maximum);
+ void SetMaximumTouchesRequired(uint32_t maximum);
public: // Getters
* @return The minimum touches required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMinimumTouchesRequired() const;
+ uint32_t GetMinimumTouchesRequired() const;
/**
* @brief Retrieves the maximum number of touches required for the pan gesture to be detected.
* @return The maximum touches required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMaximumTouchesRequired() const;
+ uint32_t GetMaximumTouchesRequired() const;
public: // Directional Panning
/**
* @brief The total number of fingers touching the screen in a pan gesture.
*/
- unsigned int numberOfTouches;
+ uint32_t numberOfTouches;
// Convenience Methods
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return TapGestureDetector(internal.Get());
}
-TapGestureDetector TapGestureDetector::New(unsigned int tapsRequired )
+TapGestureDetector TapGestureDetector::New(uint32_t tapsRequired )
{
Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New( tapsRequired );
return *this;
}
-void TapGestureDetector::SetMinimumTapsRequired(unsigned int taps)
+void TapGestureDetector::SetMinimumTapsRequired(uint32_t taps)
{
GetImplementation(*this).SetMinimumTapsRequired(taps);
}
-void TapGestureDetector::SetMaximumTapsRequired(unsigned int taps)
+void TapGestureDetector::SetMaximumTapsRequired(uint32_t taps)
{
GetImplementation(*this).SetMaximumTapsRequired(taps);
}
-unsigned int TapGestureDetector::GetMinimumTapsRequired() const
+uint32_t TapGestureDetector::GetMinimumTapsRequired() const
{
return GetImplementation(*this).GetMinimumTapsRequired();
}
-unsigned int TapGestureDetector::GetMaximumTapsRequired() const
+uint32_t TapGestureDetector::GetMaximumTapsRequired() const
{
return GetImplementation(*this).GetMaximumTapsRequired();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/events/gesture-detector.h>
#include <dali/public-api/signals/dali-signal.h>
* @param[in] tapsRequired The minimum & maximum number of taps required
* @return A handle to a newly allocated Dali resource
*/
- static TapGestureDetector New( unsigned int tapsRequired );
+ static TapGestureDetector New( uint32_t tapsRequired );
/**
* @brief Downcasts a handle to TapGestureDetector handle.
* @pre The gesture detector has been initialized.
* @note The default is '1'.
*/
- void SetMinimumTapsRequired( unsigned int minimumTaps );
+ void SetMinimumTapsRequired( uint32_t minimumTaps );
/**
* @brief Sets the maximum number of taps required.
* @pre The gesture detector has been initialized.
* @note The default is '1'.
*/
- void SetMaximumTapsRequired( unsigned int maximumTaps );
+ void SetMaximumTapsRequired( uint32_t maximumTaps );
public: // Getters
* @return The minimum taps required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMinimumTapsRequired() const;
+ uint32_t GetMinimumTapsRequired() const;
/**
* @brief Retrieves the maximum number of taps required.
* @return The maximum taps required
* @pre The gesture detector has been initialized.
*/
- unsigned int GetMaximumTapsRequired() const;
+ uint32_t GetMaximumTapsRequired() const;
public: // Signals
/**
* @brief The number of taps in this tap gesture.
*/
- unsigned int numberOfTaps;
+ uint32_t numberOfTaps;
/**
* @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the
* screen to generate the tap gesture.
*/
- unsigned int numberOfTouches;
+ uint32_t numberOfTouches;
/**
* @brief This is the point, in screen coordinates, where the tap occurred.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
{
}
-unsigned int TouchEvent::GetPointCount() const
+uint32_t TouchEvent::GetPointCount() const
{
- return points.size();
+ return static_cast<uint32_t>( points.size() );
}
-const TouchPoint& TouchEvent::GetPoint(unsigned int point) const
+const TouchPoint& TouchEvent::GetPoint( uint32_t point ) const
{
DALI_ASSERT_ALWAYS( point < points.size() && "No point at index" );
return points[point];
* @SINCE_1_0.0
* @return Total number of Points
*/
- unsigned int GetPointCount() const DALI_DEPRECATED_API;
+ uint32_t GetPointCount() const DALI_DEPRECATED_API;
/**
* @DEPRECATED_1_1.37
* @note "point" should be less than the value returned by GetPointCount().
* If out of range, then program asserts.
*/
- const TouchPoint& GetPoint(unsigned int point) const DALI_DEPRECATED_API;
+ const TouchPoint& GetPoint( uint32_t point ) const DALI_DEPRECATED_API;
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Dali
{
-TouchPoint::TouchPoint(int id, State state, float screenX, float screenY)
+TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY)
: deviceId(id),
state(state),
local(screenX, screenY),
{
}
-TouchPoint::TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY)
+TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY)
: deviceId(id),
state(state),
local(localX, localY),
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
* @param[in] screenX The X co-ordinate relative to the screen's origin
* @param[in] screenY The Y co-ordinate relative to the screen's origin
*/
- TouchPoint(int id, State state, float screenX, float screenY);
+ TouchPoint(int32_t id, State state, float screenX, float screenY);
/**
* @brief Constructor.
* @param[in] localX The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
* @param[in] localY The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
*/
- TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY);
+ TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY);
/**
* @brief Destructor.
/**
* @brief Each touch point has a unique device ID which specifies the touch device for that point.
*/
- int deviceId;
+ int32_t deviceId;
/**
* @brief State of the point.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-const unsigned int MODIFIER_SHIFT = 0x1;
-const unsigned int MODIFIER_CTRL = 0x2;
-const unsigned int MODIFIER_ALT = 0x4;
+const uint32_t MODIFIER_SHIFT = 0x1;
+const uint32_t MODIFIER_CTRL = 0x2;
+const uint32_t MODIFIER_ALT = 0x4;
}
{
}
-WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp )
+WheelEvent::WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp )
: type( type ),
direction( direction ),
modifiers( modifiers ),
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/vector2.h>
* @param[in] z The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
* @param[in] timeStamp The time the wheel is being rolled
*/
- WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp );
+ WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp );
/**
* @brief Destructor.
*
* 0 means the default vertical wheel, and 1 means horizontal wheel.
*/
- int direction;
+ int32_t direction;
/**
* @brief Modifier keys pressed during the event (such as shift, alt and control).
*/
- unsigned int modifiers;
+ uint32_t modifiers;
/**
* @brief The co-ordinates of the cursor relative to the top-left of the screen
* @brief The offset of the wheel rolling, where positive value means rolling down or clockwise
* and negative value means rolling up or counter-clockwise.
*/
- int z;
+ int32_t z;
/**
* @brief The time when the wheel is being rolled.
*/
- unsigned int timeStamp;
+ uint32_t timeStamp;
};
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return BufferImage(internal);
}
-BufferImage BufferImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat)
+BufferImage BufferImage::New(uint32_t width, uint32_t height, Pixel::Format pixelformat)
{
DALI_ASSERT_ALWAYS( 0u != width && "Invalid BufferImage width requested" );
DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
return BufferImage(internal.Get());
}
-BufferImage BufferImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride)
+BufferImage BufferImage::New(PixelBuffer* pixBuf, uint32_t width, uint32_t height, Pixel::Format pixelformat, uint32_t stride)
{
DALI_ASSERT_ALWAYS( 0u != width && "Invalid BufferImage width requested" );
DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
return GetImplementation(*this).GetBuffer();
}
-unsigned int BufferImage::GetBufferSize() const
+uint32_t BufferImage::GetBufferSize() const
{
return GetImplementation(*this).GetBufferSize();
}
-unsigned int BufferImage::GetBufferStride() const
+uint32_t BufferImage::GetBufferStride() const
{
return GetImplementation(*this).GetBufferStride();
}
class BufferImage;
}
-typedef unsigned char PixelBuffer; ///< pixel data buffer @SINCE_1_0.0
-typedef Rect<unsigned int> RectArea; ///< rectangular area (x,y,w,h) @SINCE_1_0.0
+typedef uint8_t PixelBuffer; ///< pixel data buffer @SINCE_1_0.0
+typedef Rect<uint32_t> RectArea; ///< rectangular area (x,y,w,h) @SINCE_1_0.0
/**
* @note default resource management policies are Immediate and Never
*
*/
- static BufferImage New(unsigned int width,
- unsigned int height,
+ static BufferImage New(uint32_t width,
+ uint32_t height,
Pixel::Format pixelformat=Pixel::RGBA8888) DALI_DEPRECATED_API;
/**
* @pre width & height are greater than zero
*/
static BufferImage New(PixelBuffer* pixelBuffer,
- unsigned int width,
- unsigned int height,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat=Pixel::RGBA8888,
- unsigned int stride=0) DALI_DEPRECATED_API;
+ uint32_t stride=0) DALI_DEPRECATED_API;
/**
* @DEPRECATED_1_2.41
* @SINCE_1_0.0
* @return The buffer size in bytes
*/
- unsigned int GetBufferSize() const DALI_DEPRECATED_API;
+ uint32_t GetBufferSize() const DALI_DEPRECATED_API;
/**
* @DEPRECATED_1_2.41
* @SINCE_1_0.0
* @return The buffer stride
*/
- unsigned int GetBufferStride() const DALI_DEPRECATED_API;
+ uint32_t GetBufferStride() const DALI_DEPRECATED_API;
/**
* @DEPRECATED_1_2.41
*
*/
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return *this;
}
-FrameBufferImage FrameBufferImage::New( unsigned int width, unsigned int height, Pixel::Format pixelformat, RenderBuffer::Format bufferformat )
+FrameBufferImage FrameBufferImage::New( uint32_t width, uint32_t height, Pixel::Format pixelformat, RenderBuffer::Format bufferformat )
{
Dali::Vector2 stageSize = Stage::GetCurrent().GetSize();
Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New(
- (0 == width) ? stageSize.width : width,
- (0 == height) ? stageSize.height : height,
+ (0 == width) ? static_cast<uint32_t>( stageSize.width ) : width,
+ (0 == height) ? static_cast<uint32_t>( stageSize.height ) : height,
pixelformat,
bufferformat);
* @return A handle to a new instance of a FrameBufferImage
* @post When the FrameBufferImage is first used as a render target, an exception may be thrown if pixelFormat is not supported on the hardware platform.
*/
- static FrameBufferImage New(unsigned int width = 0, unsigned int height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888,
+ static FrameBufferImage New(uint32_t width = 0, uint32_t height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888,
RenderBuffer::Format bufferFormat = RenderBuffer::COLOR) DALI_DEPRECATED_API;
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return Image( dynamic_cast<Dali::Internal::Image*>(handle.GetObjectPtr()) );
}
-unsigned int Image::GetWidth() const
+uint32_t Image::GetWidth() const
{
return GetImplementation(*this).GetWidth();
}
-unsigned int Image::GetHeight() const
+uint32_t Image::GetHeight() const
{
return GetImplementation(*this).GetHeight();
}
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
* @SINCE_1_0.0
* @return Width of the image in pixels
*/
- unsigned int GetWidth() const DALI_DEPRECATED_API;
+ uint32_t GetWidth() const DALI_DEPRECATED_API;
/**
* @DEPRECATED_1_2.41
* @SINCE_1_0.0
* @return Height of the image in pixels
*/
- unsigned int GetHeight() const DALI_DEPRECATED_API;
+ uint32_t GetHeight() const DALI_DEPRECATED_API;
public: // Signals
#define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <cstddef>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/object/ref-object.h>
* @return A GL error code
* @pre There is a GL context for the current thread.
*/
- virtual unsigned int TargetTexture() = 0;
+ virtual uint32_t TargetTexture() = 0;
/**
* @brief Called internally for each Bind call for this texture to allow implementation specific operations.
* @SINCE_1_0.0
* @return Width
*/
- virtual unsigned int GetWidth() const = 0;
+ virtual uint32_t GetWidth() const = 0;
/**
* @brief Returns the height of the NativeImage.
* @SINCE_1_0.0
* @return Height
*/
- virtual unsigned int GetHeight() const = 0;
+ virtual uint32_t GetHeight() const = 0;
/**
* @brief Queries whether blending is required.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*/
// CLASS HEADER
-#include "pixel-data.h"
-
-// EXTERNAL INLCUDES
-#include <stdlib.h>
+#include <dali/public-api/images/pixel-data.h>
// INTERNAL INCLUDES
#include <dali/internal/event/images/pixel-data-impl.h>
namespace Dali
{
-PixelData PixelData::New(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- ReleaseFunction releaseFunction)
+PixelData PixelData::New( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ Pixel::Format pixelFormat,
+ ReleaseFunction releaseFunction )
{
IntrusivePtr<Internal::PixelData> internal = Internal::PixelData::New( buffer, bufferSize, width, height, pixelFormat, releaseFunction );
return PixelData( internal.Get() );
return *this;
}
-unsigned int PixelData::GetWidth() const
+uint32_t PixelData::GetWidth() const
{
return GetImplementation(*this).GetWidth();
}
-unsigned int PixelData::GetHeight() const
+uint32_t PixelData::GetHeight() const
{
return GetImplementation(*this).GetHeight();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint8_t, uint32_t
+
+// INTERNAL INCLUDES
#include <dali/public-api/images/pixel.h>
#include <dali/public-api/object/base-handle.h>
* @param[in] releaseFunction The function used to release the memory
* @return A handle to the PixelData
*/
- static PixelData New( unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
+ static PixelData New( uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat,
ReleaseFunction releaseFunction);
* @SINCE_1_1.43
* @return The width of the buffer in pixels
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* @brief Gets the height of the buffer in pixels.
* @SINCE_1_1.43
* @return The height of the buffer in pixels
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
/**
* @brief Gets the pixel format.
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return false;
}
-unsigned int Pixel::GetBytesPerPixel(Format pixelFormat)
+uint32_t Pixel::GetBytesPerPixel(Format pixelFormat)
{
switch (pixelFormat)
{
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @param[in] pixelFormat The pixel format
* @return The number of bytes per pixel
*/
-DALI_CORE_API unsigned int GetBytesPerPixel(Format pixelFormat);
+DALI_CORE_API uint32_t GetBytesPerPixel(Format pixelFormat);
/**
* @brief Returns the offset of the byte containing the alpha value from the start of the pixel data
#define __DALI_MATH_UTILS_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
* @param[in] i Input number
* @return The next power of two or i itself in case it's a power of two
*/
-inline unsigned int NextPowerOfTwo( unsigned int i )
+inline uint32_t NextPowerOfTwo( uint32_t i )
{
- DALI_ASSERT_ALWAYS(i <= 1u << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
+ DALI_ASSERT_ALWAYS(i <= 1u << (sizeof(uint32_t) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
if(i==0u)
{
return 1u;
* @param[in] i Input number
* @return True if i is power of two.
*/
-inline bool IsPowerOfTwo( unsigned int i )
+inline bool IsPowerOfTwo( uint32_t i )
{
return (i != 0u) && ((i & (i - 1u)) == 0u);
}
const float absA = fabsf( a );
const float absB = fabsf( b );
const float absF = absA > absB ? absA : absB;
- const int absI = absF;
+ const int32_t absI = static_cast<int32_t>( absF ); // truncated
float epsilon = Math::MACHINE_EPSILON_10000;
if (absF < 0.1f)
* @param[in] pos decimal place
* @return a rounded float
*/
-inline float Round(float value, int pos)
+inline float Round( float value, int32_t pos )
{
float temp;
- temp = value * powf( 10, pos );
- temp = floorf( temp + 0.5 );
- temp *= powf( 10, -pos );
+ temp = value * powf( 10.f, static_cast<float>( pos ) );
+ temp = floorf( temp + 0.5f );
+ temp *= powf( 10.f, static_cast<float>( -pos ) );
return temp;
}
* @return -1 for negative values, +1 for positive values and 0 if value is 0
*/
template <typename T>
-int Sign( T value )
+int32_t Sign( T value )
{
return ( T(0) < value ) - ( value < T(0) );
}
return false;
}
- det = 1.0 / det;
+ det = 1.0f / det;
- for (int i = 0; i < 16; i++)
+ for( int32_t i = 0; i < 16; i++)
{
out[i] = inv[i] * det;
}
#ifndef __ARM_NEON__
- for( int i=0; i < 4; i++ )
+ for( int32_t i=0; i < 4; i++ )
{
// i<<2 gives the first vector / column
- int loc = i<<2;
- int loc1 = loc + 1;
- int loc2 = loc + 2;
- int loc3 = loc + 3;
+ int32_t loc = i<<2;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
+ int32_t loc3 = loc + 3;
float value0 = lhsPtr[loc];
float value1 = lhsPtr[loc1];
float value2 = lhsPtr[loc2];
#ifndef __ARM_NEON__
- for( int i=0; i < 4; i++ )
+ for( int32_t i=0; i < 4; i++ )
{
// i<<2 gives the first vector / column
- int loc = i<<2;
- int loc1 = loc + 1;
- int loc2 = loc + 2;
- int loc3 = loc + 3;
+ int32_t loc = i<<2;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
+ int32_t loc3 = loc + 3;
float value0 = lhsPtr[loc];
float value1 = lhsPtr[loc1];
float value2 = lhsPtr[loc2];
// In the case where the determinant is exactly zero, the matrix is non-invertible
if( ! EqualsZero( det ) )
{
- det = 1.0 / det;
- for (int i = 0; i < 9; i++)
+ det = 1.0f / det;
+ for( int32_t i = 0; i < 9; i++ )
{
mElements[i] = cof[i] * det;
}
const float* rhsPtr = rhs.AsFloat();
const float* lhsPtr = lhs.AsFloat();
- for( int i=0; i < 3; i++ )
+ for( int32_t i=0; i < 3; i++ )
{
- int loc = i * 3;
- int loc1 = loc + 1;
- int loc2 = loc + 2;
+ int32_t loc = i * 3;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
float value0 = lhsPtr[loc];
float value1 = lhsPtr[loc1];
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
//Formula for angle θ between two quaternion is:
//θ = cos^−1 (2⟨q1,q2⟩^2 − 1), Where (q1,q2) is inner product of the quaternions.
float X = from.mVector.Dot4(to.mVector);
- float theta = acos( (2 * X * X) - 1);
+ float theta = acosf( (2 * X * X) - 1); // float arc cosine
return theta;
}
#define __DALI_RANDOM_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
static bool initialized( false );
if( !initialized )
{
- auto seed = time( NULL );
+ uint32_t seed = static_cast<uint32_t>( time( NULL ) );
srand( seed );
initialized = true;
}
- auto randValue = rand();
- return (randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min;
+ int32_t randValue = rand();
+ return static_cast<float>(randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min;
}
/**
*/
// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
#include <iosfwd>
// INTERNAL INCLUDES
* @param[in] index Subscript index
* @return The float at the given index
*/
- const float& operator[](const unsigned int index) const
+ const float& operator[](const uint32_t index) const
{
DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" );
* @param[in] index Subscript index
* @return The float at the given index
*/
- float& operator[](const unsigned int index)
+ float& operator[](const uint32_t index)
{
DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" );
*/
// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
#include <iosfwd>
// INTERNAL INCLUDES
* @param[in] index Subscript index
* @return The float at the given index
*/
- const float& operator[](const unsigned int index) const
+ const float& operator[](const uint32_t index) const
{
DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" );
* @param[in] index Subscript index
* @return The float at the given index
*/
- float& operator[](const unsigned int index)
+ float& operator[](const uint32_t index)
{
DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" );
*/
// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
#include <iosfwd>
// INTERNAL INCLUDES
* @param[in] index Subscript index
* @return The float at the given index
*/
- const float& operator[](const unsigned int index) const
+ const float& operator[](const uint32_t index) const
{
DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" );
* @param[in] index Subscript index
* @return The float at the given index
*/
- float& operator[](const unsigned int index)
+ float& operator[](const uint32_t index)
{
DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" );
#define __DALI_VIEWPORT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // int32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/math/rect.h>
* @brief Typedef for a viewport ( a rectangle representing a screen area ).
* @SINCE_1_0.0
*/
-typedef Rect<int> Viewport;
+typedef Rect<int32_t> Viewport;
/**
* @}
* Any floatVariable( 4.5f );
* Any strVariable( std::string( "Hello world" ) );
* uintVariable = 1u;
- * unsigned int variable = AnyCast< unsigned int >( uintVariable );
+ * uint32_t variable = AnyCast< uint32_t >( uintVariable );
* if ( typeid( int ) == uintVariable.GetType() )
* \endcode
* @SINCE_1_0.0
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
return GetImplementation(*this).Supports( capability );
}
-unsigned int Handle::GetPropertyCount() const
+uint32_t Handle::GetPropertyCount() const
{
return GetImplementation(*this).GetPropertyCount();
}
GetImplementation(*this).RemoveConstraints();
}
-void Handle::RemoveConstraints( unsigned int tag )
+void Handle::RemoveConstraints( uint32_t tag )
{
GetImplementation(*this).RemoveConstraints( tag );
}
// EXTERNAL INCLUDES
#include <string>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @SINCE_1_0.0
* @return The number of properties
*/
- unsigned int GetPropertyCount() const;
+ uint32_t GetPropertyCount() const;
/**
* @brief Queries the name of a property.
* @param[in] tag The tag of the constraints which will be removed
* @pre The Object has been initialized.
*/
- void RemoveConstraints( unsigned int tag );
+ void RemoveConstraints( uint32_t tag );
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
std::ostream& operator<<( std::ostream& stream, const Property::Array& array )
{
stream << "Array(" << array.Count() << ") = [";
- for( unsigned int i=0; i<array.Count(); ++i )
+ for( Property::Array::SizeType i=0; i<array.Count(); ++i )
{
if( i>0 )
{
{
stream << "Map(" << map.Count() << ") = {";
- int count = 0;
+ int32_t count = 0;
// Output the String-Value pairs
for ( StringValueContainer::iterator iter = map.mImpl->mStringValueContainer.begin(), endIter = map.mImpl->mStringValueContainer.end(); iter != endIter; ++iter )
{
"MAP",
"EXTENTS",
};
-const unsigned int PROPERTY_TYPE_NAMES_COUNT = sizeof( PROPERTY_TYPE_NAMES ) / sizeof( const char* );
+const uint32_t PROPERTY_TYPE_NAMES_COUNT = static_cast<uint32_t>( sizeof( PROPERTY_TYPE_NAMES ) / sizeof( const char* ) );
}
namespace PropertyTypes
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
floatValue( floatValue )
{ }
- Impl( int integerValue )
+ Impl( int32_t integerValue )
: type( Property::INTEGER ),
integerValue( integerValue )
{ }
{
}
- Impl( const Rect<int>& rectValue )
+ Impl( const Rect<int32_t>& rectValue )
: type( Property::RECTANGLE ),
rectValue( new Rect<int>( rectValue ) )
{
Type type;
union
{
- int integerValue;
+ int32_t integerValue;
float floatValue;
// must use pointers for any class value pre c++ 11
Vector2* vector2Value;
Matrix* matrixValue;
AngleAxis* angleAxisValue;
std::string* stringValue;
- Rect<int>* rectValue;
+ Rect<int32_t>* rectValue;
Property::Array* arrayValue;
Property::Map* mapValue;
Extents* extentsValue;
{
}
-Property::Value::Value( int integerValue )
+Property::Value::Value( int32_t integerValue )
: mImpl( new Impl( integerValue ) )
{
}
}
case Property::RECTANGLE:
{
- mImpl = new Impl( Rect<int>(0,0,0,0) );
+ mImpl = new Impl( Rect<int32_t>(0,0,0,0) );
break;
}
case Property::ROTATION:
}
else if( mImpl->type == FLOAT )
{
- integerValue = static_cast< int >( mImpl->floatValue );
+ integerValue = static_cast< int32_t >( mImpl->floatValue );
converted = true;
}
}
* @SINCE_1_0.0
* @param[in] integerValue An integer value
*/
- Value( int integerValue );
+ Value( int32_t integerValue );
/**
* @brief Creates a float property value.
* @SINCE_1_0.0
* @param[in] vectorValue A vector of 4 integer values
*/
- Value( const Rect<int>& vectorValue );
+ Value( const Rect<int32_t>& vectorValue );
/**
* @brief Creates an orientation property value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to int.
*/
- bool Get( int& integerValue ) const;
+ bool Get( int32_t& integerValue ) const;
/**
* @brief Retrieves an integer rectangle.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Rect<int>.
*/
- bool Get( Rect<int>& rect ) const;
+ bool Get( Rect<int32_t>& rect ) const;
/**
* @brief Retrieves a vector value.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Dali
{
-const int Property::INVALID_INDEX = -1;
-const int Property::INVALID_KEY = -1;
-const int Property::INVALID_COMPONENT_INDEX = -1;
+const int32_t Property::INVALID_INDEX = -1;
+const int32_t Property::INVALID_KEY = -1;
+const int32_t Property::INVALID_COMPONENT_INDEX = -1;
Property::Property(Handle& obj, Property::Index propIndex)
: object(obj),
{
}
-Property::Property(Handle& obj, Property::Index propIndex, int compIndex)
+Property::Property(Handle& obj, Property::Index propIndex, int32_t compIndex)
: object(obj),
propertyIndex(propIndex),
componentIndex(compIndex)
propertyIndex = object.GetPropertyIndex( propertyName );
}
-Property::Property(Handle& obj, const std::string& propertyName, int compIndex)
+Property::Property(Handle& obj, const std::string& propertyName, int32_t compIndex)
: object(obj),
propertyIndex(Property::INVALID_INDEX),
componentIndex(compIndex)
// EXTERNAL INCLUDES
#include <string>
#include <utility>
+#include <cstdint> // int32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @brief A valid property index is zero or greater.
* @SINCE_1_0.0
*/
- typedef int Index;
+ typedef int32_t Index;
- static const int INVALID_INDEX; ///< -1 is not a valid property index
- static const int INVALID_KEY; ///< -1 is not a valid property key
- static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
+ static const int32_t INVALID_INDEX; ///< -1 is not a valid property index
+ static const int32_t INVALID_KEY; ///< -1 is not a valid property key
+ static const int32_t INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0
* @param[in] propertyIndex The index of a property.
* @param[in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
*/
- Property( Handle& object, Property::Index propertyIndex, int componentIndex );
+ Property( Handle& object, Property::Index propertyIndex, int32_t componentIndex );
/**
* @brief Creates a Property instance.
* @note This performs a property index query and is therefore slower than
* constructing a Property directly with the index.
*/
- Property( Handle& object, const std::string& propertyName, int componentIndex );
+ Property( Handle& object, const std::string& propertyName, int32_t componentIndex );
/**
* @brief Non-virtual destructor; Property is not intended as a base class.
Index propertyIndex; ///< The index of a property provided by object.
- int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
+ int32_t componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
}
}
-int RefObject::ReferenceCount()
+uint32_t RefObject::ReferenceCount()
{
return mCount;
}
*/
// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
+// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/intrusive-ptr.h>
* @SINCE_1_0.0
* @return The reference count
*/
- int ReferenceCount();
+ uint32_t ReferenceCount();
protected:
private:
- volatile int mCount; ///< Reference count
+ volatile uint32_t mCount; ///< Reference count
};
/**
Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, value );
}
-AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex)
+AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
{
DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
// EXTERNAL INCLUDES
#include <typeinfo>
+#include <cstdint> // uint32_t
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
* @param[in] componentIndex The index of the component (e.g. 0 for the x component of a Vector2 property and 1 for the y component of a Vector2 property)
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex );
+ AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex );
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
GetImplementation(*this).RemoveTask( task );
}
-unsigned int RenderTaskList::GetTaskCount() const
+uint32_t RenderTaskList::GetTaskCount() const
{
return GetImplementation(*this).GetTaskCount();
}
-RenderTask RenderTaskList::GetTask( unsigned int index ) const
+RenderTask RenderTaskList::GetTask( uint32_t index ) const
{
return GetImplementation(*this).GetTask( index );
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
* @SINCE_1_0.0
* @return The number of render-tasks
*/
- unsigned int GetTaskCount() const;
+ uint32_t GetTaskCount() const;
/**
* @brief Retrieves a render-task.
* @return A handle to the render-task
* @pre index should be in range i.e. less than GetTaskCount().
*/
- RenderTask GetTask( unsigned int index ) const;
+ RenderTask GetTask( uint32_t index ) const;
public: // Not intended for application developers
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
RenderTask::ConstScreenToFrameBufferFunction RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION = DefaultScreenToFrameBufferFunction;
RenderTask::ConstScreenToFrameBufferFunction RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION = FullScreenFrameBufferFunction;
-const bool RenderTask::DEFAULT_EXCLUSIVE = false;
-const bool RenderTask::DEFAULT_INPUT_ENABLED = true;
-const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
-const bool RenderTask::DEFAULT_CLEAR_ENABLED = false;
-const bool RenderTask::DEFAULT_CULL_MODE = true;
-const unsigned int RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
+const bool RenderTask::DEFAULT_EXCLUSIVE = false;
+const bool RenderTask::DEFAULT_INPUT_ENABLED = true;
+const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
+const bool RenderTask::DEFAULT_CLEAR_ENABLED = false;
+const bool RenderTask::DEFAULT_CULL_MODE = true;
+const uint32_t RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
RenderTask::RenderTask()
{
return GetImplementation(*this).GetCullMode();
}
-void RenderTask::SetRefreshRate( unsigned int refreshRate )
+void RenderTask::SetRefreshRate( uint32_t refreshRate )
{
GetImplementation(*this).SetRefreshRate( refreshRate );
}
-unsigned int RenderTask::GetRefreshRate() const
+uint32_t RenderTask::GetRefreshRate() const
{
return GetImplementation(*this).GetRefreshRate();
}
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/math/viewport.h>
#include <dali/public-api/object/handle.h>
REFRESH_ALWAYS = 1 ///< Process every frame. @SINCE_1_0.0
};
- static const bool DEFAULT_EXCLUSIVE; ///< false
- static const bool DEFAULT_INPUT_ENABLED; ///< true
- static const Vector4 DEFAULT_CLEAR_COLOR; ///< Color::BLACK
- static const bool DEFAULT_CLEAR_ENABLED; ///< false
- static const bool DEFAULT_CULL_MODE; ///< true
- static const unsigned int DEFAULT_REFRESH_RATE; ///< REFRESH_ALWAYS
+ static const bool DEFAULT_EXCLUSIVE; ///< false
+ static const bool DEFAULT_INPUT_ENABLED; ///< true
+ static const Vector4 DEFAULT_CLEAR_COLOR; ///< Color::BLACK
+ static const bool DEFAULT_CLEAR_ENABLED; ///< false
+ static const bool DEFAULT_CULL_MODE; ///< true
+ static const uint32_t DEFAULT_REFRESH_RATE; ///< REFRESH_ALWAYS
/**
* @brief Creates an empty RenderTask handle.
* @SINCE_1_0.0
* @param[in] refreshRate The new refresh rate
*/
- void SetRefreshRate( unsigned int refreshRate );
+ void SetRefreshRate( uint32_t refreshRate );
/**
* @brief Queries the refresh-rate of the RenderTask.
* @SINCE_1_0.0
* @return The refresh-rate
*/
- unsigned int GetRefreshRate() const;
+ uint32_t GetRefreshRate() const;
/**
* @brief Gets viewport coordinates for given world position.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Dali
{
-FrameBuffer FrameBuffer::New( unsigned int width, unsigned int height, unsigned int attachments )
+FrameBuffer FrameBuffer::New( uint32_t width, uint32_t height, uint32_t attachments )
{
Internal::FrameBufferPtr frameBuffer = Internal::FrameBuffer::New( width, height, attachments );
return FrameBuffer( frameBuffer.Get() );
AttachColorTexture( texture, 0u, 0u );
}
-void FrameBuffer::AttachColorTexture( Texture& texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer )
{
if( texture )
{
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/rendering/texture.h>
* @param[in] attachments The attachments comprising the format of the FrameBuffer (the type is int to allow multiple bitmasks to be ORd)
* @return A handle to a newly allocated FrameBuffer
*/
- static FrameBuffer New( unsigned int width, unsigned int height, unsigned int attachments );
+ static FrameBuffer New( uint32_t width, uint32_t height, uint32_t attachments );
/**
* @brief Default constructor, creates an empty handle.
* @note The specified texture mipmap has to have the same size than the FrameBuffer
* otherwise it won't be attached.
*/
- void AttachColorTexture( Texture& texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer );
/**
* @brief Gets the color texture used as output in the FrameBuffer.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
GetImplementation(*this).RemoveVertexBuffer( index );
}
-void Geometry::SetIndexBuffer( const unsigned short* indices, size_t count )
+void Geometry::SetIndexBuffer( const uint16_t* indices, size_t count )
{
GetImplementation(*this).SetIndexBuffer( indices, count );
}
// EXTERNAL INCLUDES
#include <cstddef> // std::size_t
+#include <cstdint> // uint16_t
// INTERNAL INCLUDES
#include <dali/public-api/object/handle.h> // Dali::Handle
* @param[in] indices Array of indices
* @param[in] count Number of indices in the array
*/
- void SetIndexBuffer( const unsigned short* indices, size_t count );
+ void SetIndexBuffer( const uint16_t* indices, size_t count );
/**
* @brief Sets the type of primitives this geometry contains.
void PropertyBuffer::SetData( const void* data, std::size_t size )
{
- GetImplementation(*this).SetData( data, size );
+ GetImplementation(*this).SetData( data, static_cast<uint32_t>( size ) ); // only support 4,294,967,295 bytes
}
std::size_t PropertyBuffer::GetSize() const
* texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
*
* // Create indices
- * unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ * uint32_t indexData[6] = { 0, 3, 1, 0, 2, 3 };
*
* // Create the geometry object
* Geometry texturedQuadGeometry = Geometry::New();
if( texture )
{
Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
- GetImplementation(*this).SetTexture( index, texturePtr );
+ GetImplementation(*this).SetTexture( static_cast<uint32_t>( index ), texturePtr ); // only support 4,294,967,295 textures
}
else
{
- GetImplementation(*this).SetTexture( index, NULL );
+ GetImplementation(*this).SetTexture( static_cast<uint32_t>( index ), NULL ); // only support 4,294,967,295 textures
}
}
Texture TextureSet::GetTexture( size_t index ) const
{
- Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( index );
+ Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( static_cast<uint32_t>( index ) ); // only support 4,294,967,295 textures
return Dali::Texture( texturePtr );
}
if( sampler )
{
Internal::SamplerPtr samplerPtr( &GetImplementation( sampler ) );
- GetImplementation(*this).SetSampler( index, samplerPtr );
+ GetImplementation(*this).SetSampler( static_cast<uint32_t>( index ), samplerPtr ); // only support 4,294,967,295 samplers
}
else
{
- GetImplementation(*this).SetSampler( index, NULL );
+ GetImplementation(*this).SetSampler( static_cast<uint32_t>( index ), NULL ); // only support 4,294,967,295 samplers
}
}
Sampler TextureSet::GetSampler( size_t index ) const
{
- Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler( index );
+ Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler( static_cast<uint32_t>( index ) ); // only support 4,294,967,295 samplers
return Dali::Sampler( samplerPtr );
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace Dali
{
-Texture Texture::New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
+Texture Texture::New( TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height )
{
Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height );
return Texture( texture.Get() );
}
bool Texture::Upload( PixelData pixelData,
- unsigned int layer, unsigned int mipmap,
- unsigned int xOffset, unsigned int yOffset,
- unsigned int width, unsigned int height )
+ uint32_t layer, uint32_t mipmap,
+ uint32_t xOffset, uint32_t yOffset,
+ uint32_t width, uint32_t height )
{
Internal::PixelData& internalPixelData = GetImplementation( pixelData );
return GetImplementation(*this).Upload( &internalPixelData, layer, mipmap, xOffset, yOffset, width, height );
return GetImplementation(*this).GenerateMipmaps();
}
-unsigned int Texture::GetWidth() const
+uint32_t Texture::GetWidth() const
{
return GetImplementation(*this).GetWidth();
}
-unsigned int Texture::GetHeight() const
+uint32_t Texture::GetHeight() const
{
return GetImplementation(*this).GetHeight();
}
* These constants should be used as the "layer" parameter when uploading a cube-map with Texture::Upload.
* @SINCE_1_1.43
*/
- const unsigned int POSITIVE_X = 0u; ///< CubeMap image for +x @SINCE_1_1.43
- const unsigned int NEGATIVE_X = 1u; ///< CubeMap image for -x @SINCE_1_1.43
- const unsigned int POSITIVE_Y = 2u; ///< CubeMap image for +y @SINCE_1_1.43
- const unsigned int NEGATIVE_Y = 3u; ///< CubeMap image for -y @SINCE_1_1.43
- const unsigned int POSITIVE_Z = 4u; ///< CubeMap image for +z @SINCE_1_1.43
- const unsigned int NEGATIVE_Z = 5u; ///< CubeMap image for -z @SINCE_1_1.43
+ const uint32_t POSITIVE_X = 0u; ///< CubeMap image for +x @SINCE_1_1.43
+ const uint32_t NEGATIVE_X = 1u; ///< CubeMap image for -x @SINCE_1_1.43
+ const uint32_t POSITIVE_Y = 2u; ///< CubeMap image for +y @SINCE_1_1.43
+ const uint32_t NEGATIVE_Y = 3u; ///< CubeMap image for -y @SINCE_1_1.43
+ const uint32_t POSITIVE_Z = 4u; ///< CubeMap image for +z @SINCE_1_1.43
+ const uint32_t NEGATIVE_Z = 5u; ///< CubeMap image for -z @SINCE_1_1.43
} // namespace CubeMapLayer
* @param[in] height The height of the texture
* @return A handle to a newly allocated Texture
*/
- static Texture New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height );
+ static Texture New( TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height );
/**
* @brief Creates a new Texture object from a native image.
* @return True if the PixelData object has compatible pixel format and fits in the rectangle specified, false otherwise
*/
bool Upload( PixelData pixelData,
- unsigned int layer, unsigned int mipmap,
- unsigned int xOffset, unsigned int yOffset,
- unsigned int width, unsigned int height );
+ uint32_t layer, uint32_t mipmap,
+ uint32_t xOffset, uint32_t yOffset,
+ uint32_t width, uint32_t height );
/**
* @brief Generates mipmaps for the texture.
* @SINCE_1_1.43
* @return The width, in pixels, of the texture
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* @brief Returns the height of the texture.
* @SINCE_1_1.43
* @return The height, in pixels, of the texture
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
public:
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
namespace
{
-const int INVALID_CALLBACK_INDEX = -1;
+const int32_t INVALID_CALLBACK_INDEX = -1;
} // unnamed namespace
{
DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" );
- int index = FindCallback( callback );
+ int32_t index = FindCallback( callback );
// Don't double-connect the same callback
if( INVALID_CALLBACK_INDEX == index )
{
DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" );
- int index = FindCallback( callback );
+ int32_t index = FindCallback( callback );
if( index > INVALID_CALLBACK_INDEX )
{
DALI_ASSERT_ALWAYS( NULL != tracker && "Invalid ConnectionTrackerInterface pointer passed to Connect()" );
DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" );
- int index = FindCallback( callback );
+ int32_t index = FindCallback( callback );
// Don't double-connect the same callback
if( INVALID_CALLBACK_INDEX == index )
DALI_ASSERT_ALWAYS( NULL != tracker && "Invalid ConnectionTrackerInterface pointer passed to Disconnect()" );
DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" );
- int index = FindCallback( callback );
+ int32_t index = FindCallback( callback );
if( index > INVALID_CALLBACK_INDEX )
{
return callback;
}
-int BaseSignal::FindCallback( CallbackBase* callback )
+int32_t BaseSignal::FindCallback( CallbackBase* callback )
{
- int index( INVALID_CALLBACK_INDEX );
+ int32_t index( INVALID_CALLBACK_INDEX );
// A signal can have multiple slots connected to it.
// We need to search for the slot which has the same call back function (if it's static)
// Or the same object / member function (for non-static)
- const std::size_t count( mSignalConnections.Count() );
- for( std::size_t i=0; i < count; ++i )
+ const std::size_t count = mSignalConnections.Count();
+ for( std::size_t i = 0; i < count; ++i )
{
const CallbackBase* connectionCallback = GetCallback( i );
// Note that values are set to NULL in DeleteConnection
- if( connectionCallback &&
- ( *connectionCallback == *callback ) )
+ if( connectionCallback && ( *connectionCallback == *callback ) )
{
- index = i;
+ index = static_cast<int>( i ); // only 2,147,483,647 connections supported, no error check
break;
}
}
* @param[in] callback The call back object
* @return A valid index if the callback is connected
*/
- int FindCallback( CallbackBase* callback );
+ int32_t FindCallback( CallbackBase* callback );
/**
* @brief Deletes a connection object from the list of connections.
Name: dali
Summary: DALi 3D Engine
-Version: 1.3.45
+Version: 1.3.46
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT