TestPlatformAbstraction& platform = application.GetPlatform();
platform.SetClosestImageSize(Vector2( 16, 16));
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
unsigned int initialColor = 0xFF;
return texturedQuadGeometry;
}
-int UtcFrustumCullN(void)
+Actor CreateMeshActorToStage( TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::ShaderHints shaderHints = Shader::HINT_NONE )
{
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
-
PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
+ Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, shaderHints ) );
Sampler sampler = Sampler::New( image, "sTexture" );
material.AddSampler( sampler );
Renderer renderer = Renderer::New( geometry, material );
Actor meshActor = Actor::New();
meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
- drawTrace.Reset();
-
- meshActor.SetParentOrigin( ParentOrigin::CENTER );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+ meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f ) );
+ meshActor.SetParentOrigin( parentOrigin );
+ meshActor.SetAnchorPoint( anchorPoint );
Stage::GetCurrent().Add( meshActor );
application.SendNotification();
- application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- END_TEST;
+ application.Render( 16 );
+
+ return meshActor;
}
-int UtcFrustumLeftCullP(void)
+bool GetCameraDepths( TestApplication& application, float& nearPlane, float& farPlane, float& cameraDepth )
+{
+ RenderTaskList renderTasks = Stage::GetCurrent().GetRenderTaskList();
+ CameraActor cameraActor;
+ for( unsigned int i = 0; i < renderTasks.GetTaskCount(); ++i )
+ {
+ RenderTask task = renderTasks.GetTask( i );
+ cameraActor = task.GetCameraActor();
+ if( cameraActor )
+ {
+ break;
+ }
+ }
+ if( cameraActor )
+ {
+ application.SendNotification();
+ application.Render( 16 );
+
+ nearPlane = cameraActor.GetNearClippingPlane();
+ farPlane = cameraActor.GetFarClippingPlane();
+ cameraDepth = cameraActor.GetCurrentPosition().z;
+ }
+
+ return !!cameraActor;
+}
+
+int UtcFrustumCullN(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
-
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ CreateMeshActorToStage( application );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- float offset = -0.01f;
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- meshActor.SetParentOrigin( Vector3( offset, 0.5f, 0.5f ) );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER_RIGHT );
- Stage::GetCurrent().Add( meshActor );
+ END_TEST;
+}
+
+int UtcFrustumLeftCullP(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ float offset = -0.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT );
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be box culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 stageSize = Stage::GetCurrent().GetSize();
- drawTrace.Reset();
- meshActor.SetParentOrigin( Vector3( -radius/stageSize.width + offset, 0.5f, 0.5f ) );
+ meshActor.SetParentOrigin( Vector3( -radius / stageSize.width + offset, 0.5f, 0.5f ) );
meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
END_TEST;
}
-int UtcFrustumRightCullP(void)
+int UtcFrustumLeftCullN(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
-
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ float offset = 0.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- float offset = 1.01f;
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- meshActor.SetParentOrigin( Vector3( offset, 0.5f, 0.5f ) );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- Stage::GetCurrent().Add( meshActor );
+ END_TEST;
+}
+
+int UtcFrustumRightCullP(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ float offset = 1.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT );
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be box culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 stageSize = Stage::GetCurrent().GetSize();
- drawTrace.Reset();
- meshActor.SetParentOrigin( Vector3( radius/stageSize.width + offset, 0.5f, 0.5f ) );
+ meshActor.SetParentOrigin( Vector3( radius / stageSize.width + offset, 0.5f, 0.5f ) );
meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
END_TEST;
}
-int UtcFrustumTopCullP(void)
+int UtcFrustumRightCullN(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
-
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ float offset = 0.99f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- float offset = -0.01f;
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- meshActor.SetParentOrigin( Vector3( 0.5f, offset, 0.5f ) );
- meshActor.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- Stage::GetCurrent().Add( meshActor );
+ END_TEST;
+}
+
+int UtcFrustumTopCullP(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ float offset = -0.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER );
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be box culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 stageSize = Stage::GetCurrent().GetSize();
- drawTrace.Reset();
- meshActor.SetParentOrigin( Vector3( 0.5f, -radius/stageSize.width + offset, 0.5f ) );
+ meshActor.SetParentOrigin( Vector3( 0.5f, -radius / stageSize.width + offset, 0.5f ) );
meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
END_TEST;
}
-int UtcFrustumBottomCullP(void)
+int UtcFrustumTopCullN(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
+ float offset = 0.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER );
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
-
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- float offset = 1.01f;
+ // This will be box culled
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- meshActor.SetParentOrigin( Vector3( 0.5f, offset, 0.5f ) );
- meshActor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- Stage::GetCurrent().Add( meshActor );
+ END_TEST;
+}
+
+int UtcFrustumBottomCullP(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+ float offset = 1.01f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be box culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 stageSize = Stage::GetCurrent().GetSize();
- drawTrace.Reset();
- meshActor.SetParentOrigin( Vector3( 0.5f, radius/stageSize.width + offset, 0.5f ) );
+ meshActor.SetParentOrigin( Vector3( 0.5f, radius / stageSize.width + offset, 0.5f ) );
meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
END_TEST;
}
+int UtcFrustumBottomCullN(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ float offset = 0.99f;
+ Actor meshActor = CreateMeshActorToStage( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER );
+
+ drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
+
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+
+ END_TEST;
+}
+
int UtcFrustumNearCullP(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
+ float nearPlane, farPlane, cameraDepth;
+ DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ Actor meshActor = CreateMeshActorToStage( application );
+ Vector3 meshPosition = meshActor.GetCurrentPosition();
+
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float offset = ( meshActor.GetTargetSize().z + radius ) * 0.5f; //midpoint between AABB and sphere
+ meshPosition.z = cameraDepth - nearPlane + offset;
+ meshActor.SetPosition( meshPosition );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- meshActor.SetParentOrigin( Vector3( 0.5f, 0.5f, 7.0f ) );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER );
- Stage::GetCurrent().Add( meshActor );
+ // This will be box culled
+ DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ offset = radius + 0.1f;
+ meshPosition.z = cameraDepth - nearPlane + offset;
+ meshActor.SetPosition( meshPosition );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+
+ END_TEST;
+}
+
+int UtcFrustumNearCullN(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ float nearPlane, farPlane, cameraDepth;
+ DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
+
+ Actor meshActor = CreateMeshActorToStage( application );
+ Vector3 meshPosition = meshActor.GetCurrentPosition();
+
+ float offset = meshActor.GetTargetSize().z - 0.1f;
+ meshPosition.z = cameraDepth - nearPlane + offset;
+ meshActor.SetPosition( meshPosition );
+
+ drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
+
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+
END_TEST;
}
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
+ float nearPlane, farPlane, cameraDepth;
+ DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ Actor meshActor = CreateMeshActorToStage( application );
+ Vector3 meshPosition = meshActor.GetCurrentPosition();
+
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float offset = ( meshActor.GetTargetSize().z + radius ) * 0.5f; //midpoint between AABB and sphere
+
+ meshPosition.z = cameraDepth - farPlane - offset;
+ meshActor.SetPosition( meshPosition );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- meshActor.SetParentOrigin( Vector3( 0.5f, 0.5f, -7.0f ) );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER );
- Stage::GetCurrent().Add( meshActor );
+ // This will be box culled
+ DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ offset = radius + 0.1f;
+ meshPosition.z = cameraDepth - farPlane - offset;
+ meshActor.SetPosition( meshPosition );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This will be sphere culled
DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+
END_TEST;
}
-int UtcFrustumCullDisabledP(void)
+int UtcFrustumFarCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
+ drawTrace.Enable( true );
- PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ];
- BufferImage image = BufferImage::New( pixelBuffer, 1, 1 );
+ float nearPlane, farPlane, cameraDepth;
+ DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
- Geometry geometry = CreateGeometry();
- Material material = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, Shader::HINT_MODIFIES_GEOMETRY ) );
- Sampler sampler = Sampler::New( image, "sTexture" );
- material.AddSampler( sampler );
- Renderer renderer = Renderer::New( geometry, material );
+ Actor meshActor = CreateMeshActorToStage( application );
+ Vector3 meshPosition = meshActor.GetCurrentPosition();
+
+ float offset = meshActor.GetTargetSize().z - 0.1f;
+ meshPosition.z = cameraDepth - farPlane - offset;
+ meshActor.SetPosition( meshPosition );
- Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetSize( Vector3( 400.0f, 400.0f, 0.1f) );
drawTrace.Reset();
+ application.SendNotification();
+ application.Render( 16 );
- meshActor.SetParentOrigin( ParentOrigin::CENTER );
- meshActor.SetAnchorPoint( AnchorPoint::CENTER );
- Stage::GetCurrent().Add( meshActor );
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+
+ END_TEST;
+}
+int UtcFrustumCullDisabledP(void)
+{
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ CreateMeshActorToStage( application, Vector3( 7.0f, 0.5f, 0.5f ), AnchorPoint::CENTER, Shader::HINT_MODIFIES_GEOMETRY );
+
+ drawTrace.Reset();
application.SendNotification();
- application.Render(16);
+ application.Render( 16 );
// This should not be culled
DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+
END_TEST;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
ids.push_back( textureId );
application.GetGlAbstraction().SetNextTextureIds( ids );
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
imageActor.SetPosition(0.0f, 0.0f, 0.0f);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
drawTrace.Reset();
imageActor.SetParentOrigin(ParentOrigin::TOP_LEFT);
ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
imageSize.z = 0.0f;
float radius = imageSize.Length() * 0.5f; // Radius of bounding box
ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
imageSize.z = 0.0f;
tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f) \n",
ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
imageSize.z = 0.0f;
float radius = imageSize.Length() * 0.5f; // Radius of bounding box
ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
imageSize.z = 0.0f;
tet_printf("Testing Stage Size: (%3.0f, %3.0f) image size:(%3.0f, %3.0f)\n",
ImageActor imageActor = CreateOnStageActor(application, image, width, height, true);
Vector3 imageSize = imageActor.GetCurrentSize();
- DALI_TEST_EQUALS( imageSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
+ DALI_TEST_EQUALS( imageSize, Vector3(width, height, 0), TEST_LOCATION);
imageSize.z = 0.0f;
{
// emulate load success
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource( bitmap );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height, width, height );
if( request )
application.SendNotification(); // Flush update messages
application.Render(); // Process resource request
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80,80,80,80 );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
application.SendNotification(); // Flush update messages
application.Render(); // Process resource request
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, w, h, w, h );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
// Create a resource
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Create a new resource - the image size could have changed in the meantime
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 120, 120, 120, 120 );
Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
DALI_TEST_CHECK( req->GetId() == ticket->GetId() );
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetResourcesFunc ) );
// Create a resource
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Create a resource
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 80, 80, 80, 80 );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Create a new resource - the image size could have changed in the meantime
req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 120, 120, 120, 120 );
Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
DALI_TEST_CHECK( req->GetId() == id );
tet_infoline("Testing AddBitmap with reserved buffer()");
testTicketObserver.Reset();
Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGB565, 80, 80, 80, 80 );
Internal::ImageTicketPtr imageTicket = resourceClient.AddBitmapImage( bitmap );
tet_infoline("Testing AddBitmap without reserved buffer()");
testTicketObserver.Reset();
Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Internal::ImageTicketPtr imageTicket = resourceClient.AddBitmapImage( bitmap );
DALI_TEST_CHECK( imageTicket );
testTicketObserver.Reset();
Internal::ResourceClient& resourceClient = Internal::ThreadLocalStorage::Get().GetResourceClient();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 20, 20, 80, 80 );
Internal::ImageTicketPtr imageTicket = resourceClient.AddBitmapImage( bitmap );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
TestApplication application;
Actor actor = Actor::New();
- Vector3 vector(100.0f, 100.0f, 100.0f);
+ Vector3 vector(100.0f, 100.0f, 0.0f);
DALI_TEST_CHECK(vector != actor.GetCurrentSize());
TestApplication application;
Actor actor = Actor::New();
- Vector3 vector(100.0f, 100.0f, 100.0f);
+ Vector3 vector(100.0f, 100.0f, 0.0f);
DALI_TEST_CHECK(vector != actor.GetCurrentSize());
void LoadBitmapResource(TestPlatformAbstraction& platform)
{
Integration::ResourceRequest* request = platform.GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = platform.GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
actor.SetShaderEffect( effect );
const float INVALID_SIZE = float(1u<<31);
- Vector3 vector( INVALID_SIZE, INVALID_SIZE, INVALID_SIZE );
+ Vector3 vector( INVALID_SIZE, INVALID_SIZE, 0.0f );
DALI_TEST_CHECK(vector != actor.GetCurrentSize());
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, initialImageSize.width,initialImageSize.height, initialImageSize.width,initialImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Now complete the image load
req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Now complete the image load
req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
tet_infoline("Test the successful loading of a nine-patch image\n");
platform.SetClosestImageSize(Vector2(4, 4));
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 4,4,4,4 );
memset( pixels, 0, 64 );
tet_infoline("Test the successful loading of a nine-patch image added using ImageActor::SetImage()\n");
platform.SetClosestImageSize(Vector2(4, 4));
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 4,4,4,4 );
memset( pixels, 0, 64 );
Integration::Bitmap* CreateBitmap( unsigned int imageHeight, unsigned int imageWidth, unsigned int initialColor, Pixel::Format pixelFormat )
{
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth,imageHeight,imageWidth,imageHeight );
unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
void LoadBitmapResource(TestPlatformAbstraction& platform)
{
Integration::ResourceRequest* request = platform.GetRequest();
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
if(request)
{
- application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD)));
+ application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD)));
}
application.Render(16);
Integration::Bitmap* CreateBitmap( unsigned int imageHeight, unsigned int imageWidth, unsigned int initialColor )
{
- Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, imageWidth,imageHeight,imageWidth,imageHeight );
unsigned int bytesPerPixel = GetBytesPerPixel( Pixel::RGBA8888 );
END_TEST;
}
+int UtcDaliShaderEffectMethodApplyConstraintOffStage(void)
+{
+ // The same test as UtcDaliShaderEffectMethodApplyConstraint,
+ // except the Actor is off-stage when the constraint is applied to the shader
+ TestApplication application;
+
+ ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
+ DALI_TEST_CHECK( effect );
+
+ BufferImage image = CreateBufferImage();
+
+ effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
+
+ ImageActor actor = ImageActor::New( image );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetName("TestImageFilenameActor");
+ actor.SetShaderEffect(effect);
+ // Note - Do not add actor to stage here
+
+ Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
+
+ Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+ constraint.Apply();
+
+ // Note - Now we add the actor (after constraint was applied to the shader)
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Test effects of Constraint.
+ DALI_TEST_CHECK(
+ application.GetGlAbstraction().CheckUniformValue(
+ "uVec3", Vector3( 4.0f, 9.0f, 16.0f ) ) );
+ END_TEST;
+}
int UtcDaliShaderEffectMethodApplyConstraintFromActor(void)
{
);
# Some packages like require building from source
+# v8 is currently disabled until we can get it working without a http proxy being setup
my @source_pkgs = (
- {"name" => "v8",
+ {"name" => "disabled-v8",
"force-rebuild" => 0,
"use_depot_tools" => 1,
"repo" => "https://chromium.googlesource.com/v8/v8.git",
}
Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS,
- ResourcePolicy::Discardable discardable = ResourcePolicy::DISCARD )
+ ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD )
{
DALI_ASSERT_DEBUG(profile == BITMAP_2D_PACKED_PIXELS || profile == BITMAP_COMPRESSED);
void Bitmap::DiscardBuffer()
{
- if( mDiscardable == ResourcePolicy::DISCARD )
+ if( mDiscardable == ResourcePolicy::OWNED_DISCARD )
{
DeletePixelBuffer();
}
Bitmap::~Bitmap()
{
DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- if( mDiscardable == ResourcePolicy::DISCARD )
+
+ // If owned
+ if( mDiscardable == ResourcePolicy::OWNED_DISCARD ||
+ mDiscardable == ResourcePolicy::OWNED_RETAIN )
{
DeletePixelBuffer();
}
* @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
* @param[in] pixBuf External buffer of pixel data or null.
*/
- Bitmap( ResourcePolicy::Discardable discardable = ResourcePolicy::RETAIN, Dali::Integration::PixelBuffer* pixBuf = 0 );
+ Bitmap( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN, Dali::Integration::PixelBuffer* pixBuf = 0 );
/**
* Initializes internal class members
* wrap this in a reference-counting smart pointer or store it in a similarly
* automatic owning collection.
* @param[in] profile Defines required features of the bitmap (\sa Profile).
- * @param[in] discardable If this is set to DISCARD, the bitmap
- * object owns it's own buffer of pixel data and can delete it. If
- * it's set to RETAIN, then the lifetime of the pixel buffer is
- * managed by an external component and is guaranteed to remain
- * dereferenceable at least as long as the Bitmap remains alive.
- **/
+ * @param[in] discardable OWNED_DISCARD means that the data is owned by bitmap,
+ * and may released away after uploading to GPU.
+ * OWNED_RETAIN means that the data is owned and must be kept in CPU memory
+ * e.g. for an image that cannot be reloaded from disk.
+ * NOT_OWNED means that the data is managed by an external component and is
+ * guaranteed to remain dereferenceable at least as long as the Bitmap remains alive.
+ */
static Bitmap* New( Profile profile, ResourcePolicy::Discardable discardable );
/** \name GeneralFeatures
*/
bool IsDiscardable() const
{
- return mDiscardable == ResourcePolicy::DISCARD;
+ return mDiscardable == ResourcePolicy::OWNED_DISCARD;
}
/**
bool orientationCorrection = true) = 0;
/**
- @brief Determine the size of an image the resource loaders will provide when
+ * @brief Determine the size of an image the resource loaders will provide when
* given the same image loading parameters.
*
* This is a synchronous request.
virtual void CancelLoad(ResourceId id, ResourceTypeId typeId) = 0;
/**
- * Query whether any asynchronous LoadResource() requests are ongoing.
- * Multi-threading note: this method may be called from either the main or rendering thread.
- * @return True if resources are being loaded.
- */
- virtual bool IsLoading() = 0;
-
- /**
* Retrieve newly loaded resources.
* If no resources have finished loading, then this method returns immediately.
* Multi-threading note: this method will be called from the update thread, from within
virtual int GetDefaultFontSize() const = 0;
/**
- * Sets horizontal and vertical pixels per inch value that is used by the display
- * @param[in] dpiHorizontal horizontal dpi value
- * @param[in] dpiVertical vertical dpi value
- */
- virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical) = 0;
-
- /**
* Load a file into a buffer
* @param[in] filename The filename to load
* @param[out] buffer A buffer to receive the file.
virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const = 0;
/**
- * Load a file into a buffer
- * @param[in] filename The filename to save
- * @param[out] buffer A buffer containing some data
- * The buffer is implemeneted with a Dali::Vector. The size() member specifies the buffer length.
- * @result true if the file is saved.
- */
- virtual bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const = 0;
-
- /**
* Load a shader binary file into a buffer
* @param[in] filename The shader binary filename to load
* @param[out] buffer A buffer to receive the file.
*/
enum DataRetention
{
- DALI_RETAINS_ALL_DATA, // retains Meshes and bitmaps
- DALI_RETAINS_MESH_DATA, // retains meshes, but discards bitmaps loaded from files
+ DALI_RETAINS_ALL_DATA, // retains all data e.g. bitmaps
DALI_DISCARDS_ALL_DATA, // discards all data (expects application to regenerate UI on context loss)
};
/**
- * The discardable policy describes whether a resource can be discarded (i.e. it is throw-away
- * or recoverable)
+ * The discardable policy describes whether a resource is owned or can be discarded.
+ * Discarded means that it can be released after uploading to GPU.
*/
enum Discardable
{
- DISCARD, // @todo Change to IS_RECOVERABLE?
- RETAIN
+ OWNED_DISCARD,
+ OWNED_RETAIN,
+ NOT_OWNED
};
} // namespace ResourcePolicy
RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
TextureCache& textureCache = mRenderManager->GetTextureCache();
- ResourcePolicy::Discardable discardPolicy = ResourcePolicy::DISCARD;
+ ResourcePolicy::Discardable discardPolicy = ResourcePolicy::OWNED_DISCARD;
if( dataRetentionPolicy == ResourcePolicy::DALI_RETAINS_ALL_DATA )
{
- discardPolicy = ResourcePolicy::RETAIN;
+ discardPolicy = ResourcePolicy::OWNED_RETAIN;
}
textureCache.SetDiscardBitmapsPolicy(discardPolicy);
mStage->Initialize();
- mResourceClient = new ResourceClient( *mResourceManager, *mStage, dataRetentionPolicy );
+ mResourceClient = new ResourceClient( *mResourceManager, *mStage );
mGestureEventProcessor = new GestureEventProcessor(*mStage, gestureManager, mRenderController);
mEventProcessor = new EventProcessor(*mStage, *mNotificationManager, *mGestureEventProcessor);
void Core::SetDpi( unsigned int dpiHorizontal, unsigned int dpiVertical )
{
- mPlatform.SetDpi( dpiHorizontal, dpiVertical );
mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) );
}
void Actor::SetSize( const Vector2& size )
{
- SetSize( Vector3( size.width, size.height, CalculateSizeZ( size ) ) );
+ SetSize( Vector3( size.width, size.height, 0.f ) );
}
void Actor::SetSizeInternal( const Vector2& size )
{
- SetSizeInternal( Vector3( size.width, size.height, CalculateSizeZ( size ) ) );
-}
-
-float Actor::CalculateSizeZ( const Vector2& size ) const
-{
- return std::min( size.width, size.height );
+ SetSizeInternal( Vector3( size.width, size.height, 0.f ) );
}
void Actor::SetSize( const Vector3& size )
{
if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
{
+ // TODO we cannot just ignore the given Z but that means rewrite the size negotiation!!
SetPreferredSize( size.GetVectorXY() );
}
else
}
}
-void Actor::ConnectToStage( unsigned int parentDepth, int index )
+void Actor::ConnectToStage( unsigned int parentDepth )
{
- // This container is used instead of walking the Actor hierachy.
- // It protects us when the Actor hierachy is modified during OnStageConnectionExternal callbacks.
+ // This container is used instead of walking the Actor hierarchy.
+ // It protects us when the Actor hierarchy is modified during OnStageConnectionExternal callbacks.
ActorContainer connectionList;
-
- // This stage is atomic i.e. not interrupted by user callbacks
- RecursiveConnectToStage( connectionList, parentDepth+1, index );
+ // This stage is atomic i.e. not interrupted by user callbacks.
+ RecursiveConnectToStage( connectionList, parentDepth + 1 );
// Notify applications about the newly connected actors.
const ActorIter endIter = connectionList.end();
RelayoutRequest();
}
-void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index )
+void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth )
{
DALI_ASSERT_ALWAYS( !OnStage() );
mIsOnStage = true;
mDepth = depth;
- ConnectToSceneGraph( index );
+ ConnectToSceneGraph();
// Notification for internal derived classes
OnStageConnectionInternal();
* This method is called when the Actor is connected to the Stage.
* The parent must have added its Node to the scene-graph.
* The child must connect its Node to the parent's Node.
- * This is resursive; the child calls ConnectToStage() for its children.
+ * This is recursive; the child calls ConnectToStage() for its children.
*/
-void Actor::ConnectToSceneGraph( int index )
+void Actor::ConnectToSceneGraph()
{
DALI_ASSERT_DEBUG( mNode != NULL); DALI_ASSERT_DEBUG( mParent != NULL); DALI_ASSERT_DEBUG( mParent->mNode != NULL );
if( NULL != mNode )
{
// Reparent Node in next Update
- ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode, index );
+ ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode );
}
// Notify attachment
return componentIndex;
}
-void Actor::SetParent( Actor* parent, int index )
+void Actor::SetParent( Actor* parent )
{
if( parent )
{
parent->OnStage() )
{
// Instruct each actor to create a corresponding node in the scene graph
- ConnectToStage( parent->GetHierarchyDepth(), index );
+ ConnectToStage( parent->GetHierarchyDepth() );
}
}
else // parent being set to NULL
{
if ( mRelayoutData )
{
- return mRelayoutData->preferredSize;
+ return Vector2( mRelayoutData->preferredSize );
}
return GetDefaultPreferredSize();
/**
* Called on a child during Add() when the parent actor is connected to the Stage.
- * @param[in] stage The stage.
- * @param[in] parentDepth The depth of the parent in the hierarchy
- * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
+ * @param[in] parentDepth The depth of the parent in the hierarchy.
*/
- void ConnectToStage( unsigned int parentDepth, int index = -1 );
+ void ConnectToStage( unsigned int parentDepth );
/**
* Helper for ConnectToStage, to recursively connect a tree of actors.
* This is atomic i.e. not interrupted by user callbacks.
- * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
- * @param[in] depth The depth in the hierarchy of the actor
+ * @param[in] depth The depth in the hierarchy of the actor
* @param[out] connectionList On return, the list of connected actors which require notification.
*/
- void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index = -1 );
+ void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
/**
* Connect the Node associated with this Actor to the scene-graph.
- * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
*/
- void ConnectToSceneGraph( int index = -1 );
+ void ConnectToSceneGraph();
/**
* Helper for ConnectToStage, to notify a connected actor through the public API.
*/
bool IsNodeConnected() const;
- /**
- * Calculate the size of the z dimension for a 2D size
- *
- * @param[in] size The 2D size (X, Y) to calculate Z from
- *
- * @return Return the Z dimension for this size
- */
- float CalculateSizeZ( const Vector2& size ) const;
-
public:
+
// Default property extensions from Object
/**
/**
* Set the actors parent.
* @param[in] parent The new parent.
- * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
*/
- void SetParent( Actor* parent, int index = -1 );
+ void SetParent( Actor* parent );
/**
* Helper to create a Node for this Actor.
void ImageActor::OnInitialize()
{
+ // TODO: Remove this, at the moment its needed for size negotiation to work
SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
}
Vector3 ImageActor::GetNaturalSize() const
{
Vector2 naturalSize( CalculateNaturalSize() );
- return Vector3( naturalSize.width, naturalSize.height, CalculateSizeZ( naturalSize ) );
+ return Vector3( naturalSize.width, naturalSize.height, 0.f );
}
Vector2 ImageActor::CalculateNaturalSize() const
* Constructor
* @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
*/
- BitmapCompressed( ResourcePolicy::Discardable discardable = ResourcePolicy::RETAIN );
+ BitmapCompressed( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN );
virtual const Bitmap::CompressedProfile* GetCompressedProfile() const { return this; }
virtual Bitmap::CompressedProfile* GetCompressedProfile() { return this; }
Pixel::Format pixelFormat,
unsigned int bufferWidth,
unsigned int bufferHeight)
-: BitmapPackedPixel(ResourcePolicy::RETAIN, NULL/*pixBuf is externally owned*/),
+: BitmapPackedPixel(ResourcePolicy::NOT_OWNED, NULL/*pixBuf is externally owned*/),
mExternalData(pixBuf)
{
mImageWidth = width;
* Constructor
* @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
*/
- BitmapPackedPixel( ResourcePolicy::Discardable discardable = ResourcePolicy::RETAIN, Dali::Integration::PixelBuffer* pixBuf = 0 );
+ BitmapPackedPixel( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN, Dali::Integration::PixelBuffer* pixBuf = 0 );
public:
virtual const Bitmap::PackedPixelsProfile* GetPackedPixelsProfile() const { return this; }
void Material::SetShader( Shader& shader )
{
DALI_ASSERT_DEBUG( mSceneObject )
- mShaderConnector.Set( shader, OnStage() );
+ mShader = &shader;
const SceneGraph::Shader& sceneGraphShader = dynamic_cast<const SceneGraph::Shader&>( *shader.GetSceneObject() );
SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
Shader* Material::GetShader() const
{
- return mShaderConnector.Get().Get();
+ return mShader.Get();
}
void Material::AddSampler( Sampler& sampler )
{
it->OnStageConnect();
}
- mShaderConnector.OnStageConnect();
}
void Material::Disconnect()
{
it->OnStageDisconnect();
}
- mShaderConnector.OnStageDisconnect();
}
Material::Material()
Material& operator=( const Material& );
private: //data
- typedef ObjectConnector<Shader> ShaderConnector;
- ShaderConnector mShaderConnector; ///< Connector that holds the shader used by this material
+ IntrusivePtr<Shader> mShader; ///< Connector that holds the shader used by this material
typedef ObjectConnector<Sampler> SamplerConnector;
typedef std::vector< SamplerConnector > SamplerConnectorContainer;
* |name |type |writable|animatable|constraint-input|enum for index-checking|
*/
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "minification-filter", STRING, true, false, true, Dali::Sampler::Property::MINIFICATION_FILTER )
-DALI_PROPERTY( "magnification-filter", STRING, true, false, true, Dali::Sampler::Property::MAGNIGICATION_FILTER )
-DALI_PROPERTY( "u-wrap", STRING, true, false, true, Dali::Sampler::Property::U_WRAP )
-DALI_PROPERTY( "v-wrap", STRING, true, false, true, Dali::Sampler::Property::V_WRAP )
+DALI_PROPERTY( "minification-filter", INTEGER, true, false, true, Dali::Sampler::Property::MINIFICATION_FILTER )
+DALI_PROPERTY( "magnification-filter", INTEGER, true, false, true, Dali::Sampler::Property::MAGNIGICATION_FILTER )
+DALI_PROPERTY( "u-wrap", INTEGER, true, false, true, Dali::Sampler::Property::U_WRAP )
+DALI_PROPERTY( "v-wrap", INTEGER, true, false, true, Dali::Sampler::Property::V_WRAP )
DALI_PROPERTY( "affects-transparency", BOOLEAN, true, false, true, Dali::Sampler::Property::AFFECTS_TRANSPARENCY )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
DALI_ASSERT_ALWAYS( IsPropertyAnimatable( index ) && "Property is not animatable" );
const SceneGraph::PropertyBase* property = NULL;
- if( OnStage() )
- {
- property = SHADER_IMPL.GetRegisteredSceneGraphProperty( this,
- &Shader::FindAnimatableProperty,
- &Shader::FindCustomProperty,
- index );
+ property = SHADER_IMPL.GetRegisteredSceneGraphProperty( this,
+ &Shader::FindAnimatableProperty,
+ &Shader::FindCustomProperty,
+ index );
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- DALI_ASSERT_ALWAYS( 0 && "Property is not animatable" );
- }
+ if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
+ {
+ DALI_ASSERT_ALWAYS( 0 && "Property is not animatable" );
}
return property;
{
const PropertyInputImpl* property = NULL;
- if( OnStage() )
+ const SceneGraph::PropertyBase* baseProperty =
+ SHADER_IMPL.GetRegisteredSceneGraphProperty( this,
+ &Shader::FindAnimatableProperty,
+ &Shader::FindCustomProperty,
+ index );
+ property = static_cast<const PropertyInputImpl*>( baseProperty );
+
+ if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
{
- const SceneGraph::PropertyBase* baseProperty =
- SHADER_IMPL.GetRegisteredSceneGraphProperty( this,
- &Shader::FindAnimatableProperty,
- &Shader::FindCustomProperty,
- index );
- property = static_cast<const PropertyInputImpl*>( baseProperty );
-
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
+ if( index == Dali::Shader::Property::SHADER_HINTS )
+ {
+ // @todo MESH_REWORK - return the property
+ }
+ else
{
- if( index == Dali::Shader::Property::SHADER_HINTS )
- {
- // @todo MESH_REWORK - return the property
- }
- else
- {
- DALI_ASSERT_ALWAYS( 0 && "Property is not a valid constraint input" );
- }
+ DALI_ASSERT_ALWAYS( 0 && "Property is not a valid constraint input" );
}
}
return Property::INVALID_COMPONENT_INDEX;
}
-bool Shader::OnStage() const
-{
- return mOnStage;
-}
-
-void Shader::Connect()
-{
- mOnStage = true;
-}
-
-void Shader::Disconnect()
-{
- mOnStage = false;
-}
-
Shader::Shader()
-: mSceneObject( NULL ),
- mOnStage( false )
+: mSceneObject( NULL )
{
}
#include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
#include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
#include <dali/devel-api/rendering/shader.h> // Dali::Shader
-#include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
#include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
#include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
#include <dali/internal/event/resources/resource-ticket.h> // Dali::Internal::ResourceTicketPtr
* Shader is an object that contains an array of structures of values that
* can be accessed as properties.
*/
-class Shader : public Object, public Connectable
+class Shader : public Object
{
public:
*/
virtual int GetPropertyComponentIndex( Property::Index index ) const;
-public: // Functions from Connectable
- /**
- * @copydoc Dali::Internal::Connectable::OnStage()
- */
- virtual bool OnStage() const;
-
- /**
- * @copydoc Dali::Internal::Connectable::Connect()
- */
- virtual void Connect();
-
- /**
- * @copydoc Dali::Internal::Connectable::Disconnect()
- */
- virtual void Disconnect();
-
private: // implementation
Shader();
private:
SceneGraph::Shader* mSceneObject;
- bool mOnStage;
};
} // namespace Internal
struct ResourceClient::Impl
{
- Impl(ResourcePolicy::DataRetention dataRetentionPolicy)
- : mNextId(0),
- mDataRetentionPolicy( dataRetentionPolicy )
+ Impl()
+ : mNextId(0)
{
}
ResourceId mNextId;
TicketContainer mTickets;
BitmapCache mBitmaps;
- ResourcePolicy::DataRetention mDataRetentionPolicy;
};
ResourceClient::ResourceClient( ResourceManager& resourceManager,
- EventThreadServices& eventThreadServices,
- ResourcePolicy::DataRetention dataRetentionPolicy)
+ EventThreadServices& eventThreadServices)
: mResourceManager(resourceManager),
mEventThreadServices(eventThreadServices)
{
- mImpl = new ResourceClient::Impl(dataRetentionPolicy);
+ mImpl = new ResourceClient::Impl();
mResourceManager.SetClient(*this);
}
delete mImpl;
}
-ResourcePolicy::DataRetention ResourceClient::GetResourceDataRetentionPolicy()
-{
- return mImpl->mDataRetentionPolicy;
-}
-
ResourceTicketPtr ResourceClient::RequestResource(
const ResourceType& type,
const std::string& path,
Pixel::Format pixelformat )
{
/* buffer is available via public-api, therefore not discardable */
- Bitmap* const bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
+ Bitmap* const bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
Bitmap::PackedPixelsProfile* const packedBitmap = bitmap->GetPackedPixelsProfile();
DALI_ASSERT_DEBUG(packedBitmap);
* There should exactly one of these objects per Dali Core.
* @param[in] resourceManager The resource manager
* @param[in] eventThreadServices Used for messaging to and reading from scene-graph.
- * @param[in] dataRetentionPolicy The data retention policy of the current application
*/
ResourceClient( ResourceManager& resourceManager,
- EventThreadServices& eventThreadServices,
- ResourcePolicy::DataRetention dataRetentionPolicy );
+ EventThreadServices& eventThreadServices );
/**
* Virtual destructor.
virtual ~ResourceClient();
public:
- /**
- * Get the global data retention policy.
- * @return the global data retention policy
- */
- ResourcePolicy::DataRetention GetResourceDataRetentionPolicy();
/**
* Request a resource from the native filesystem.
void BitmapTexture::DiscardBitmapBuffer()
{
- DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, "BitmapTexture::DiscardBitmapBuffer() DiscardPolicy: %s\n", mDiscardPolicy == ResourcePolicy::DISCARD?"DISCARD":"RETAIN");
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, "BitmapTexture::DiscardBitmapBuffer() DiscardPolicy: %s\n", mDiscardPolicy == ResourcePolicy::OWNED_DISCARD?"DISCARD":"RETAIN");
- if( ResourcePolicy::DISCARD == mDiscardPolicy )
+ if( ResourcePolicy::OWNED_DISCARD == mDiscardPolicy )
{
DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, " Discarding bitmap\n");
mBitmap->DiscardBuffer();
{
AssignBitmap( false, pixels, mBitmap->GetBufferSize() );
- if( mDiscardPolicy == ResourcePolicy::DISCARD )
+ if( mDiscardPolicy == ResourcePolicy::OWNED_DISCARD )
{
mBitmap->DiscardBuffer();
}
: TextureCacheDispatcher(renderQueue),
mPostProcessResourceDispatcher(postProcessResourceDispatcher),
mContext(context),
- mDiscardBitmapsPolicy(ResourcePolicy::DISCARD)
+ mDiscardBitmapsPolicy(ResourcePolicy::OWNED_DISCARD)
{
}
void TextureCache::SetDiscardBitmapsPolicy( ResourcePolicy::Discardable policy )
{
DALI_LOG_INFO( gTextureCacheFilter, Debug::General, "TextureCache::SetDiscardBitmapsPolicy(%s)\n",
- policy==ResourcePolicy::RETAIN?"RETAIN":"DISCARD" );
+ policy==ResourcePolicy::OWNED_DISCARD?"DISCARD":"RETAIN" );
mDiscardBitmapsPolicy = policy;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
#define __DALI_INTERNAL_SCENE_GRAPH_SHADER_H__
/*
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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
{
-namespace Integration
-{
-typedef unsigned int ResourceId;
-} // namespace Integration
-
namespace Internal
{
mImpl->activeDisconnectedNodes.insert( node ); // Takes ownership of node
}
-void UpdateManager::ConnectNode( Node* parent, Node* node, int index )
+void UpdateManager::ConnectNode( Node* parent, Node* node )
{
DALI_ASSERT_ALWAYS( NULL != parent );
DALI_ASSERT_ALWAYS( NULL != node );
node->SetActive( true );
- parent->ConnectChild( node, index );
+ parent->ConnectChild( node );
}
void UpdateManager::DisconnectNode( Node* node )
* Connect a Node to the scene-graph.
* A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
* @pre The node does not already have a parent.
- * @param[in] node The new parent node.
- * @param[in] node The node to connect.
+ * @param[in] parent The new parent node.
*/
- void ConnectNode( Node* parent, Node* node, int index );
+ void ConnectNode( Node* parent, Node* node );
/**
* Disconnect a Node from the scene-graph.
new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
}
-inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
+inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
{
// Update thread can edit the object
Node& parent = const_cast< Node& >( constParent );
Node& child = const_cast< Node& >( constChild );
- typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
+ typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
+ new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
}
inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
mIsRoot = isRoot;
}
-void Node::ConnectChild( Node* childNode, int index )
+void Node::ConnectChild( Node* childNode )
{
DALI_ASSERT_ALWAYS( this != childNode );
DALI_ASSERT_ALWAYS( IsRoot() || NULL != mParent ); // Parent should be connected first
// Everything should be reinherited when reconnected to scene-graph
childNode->SetAllDirtyFlags();
- if (index == -1)
- {
- mChildren.PushBack( childNode );
- }
- else
- {
- mChildren.Insert(mChildren.Begin()+index, childNode);
- }
+ // Add the node to the end of the child list.
+ mChildren.PushBack( childNode );
// Inform property observers of new connection
childNode->ConnectToSceneGraph();
* @pre The childNode does not already have a parent.
* @pre The childNode is not a root node.
* @param[in] childNode The child to add.
- * @param[in] index to insert at, if not supplied or -1 it will be appended
- *
*/
- void ConnectChild( Node* childNode, int index = -1);
+ void ConnectChild( Node* childNode );
/**
* Disconnect a child (& its children) from the scene-graph.
const unsigned int CORE_MAJOR_VERSION = 1;
const unsigned int CORE_MINOR_VERSION = 0;
-const unsigned int CORE_MICRO_VERSION = 50;
+const unsigned int CORE_MICRO_VERSION = 51;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali
Summary: The OpenGLES Canvas Core Library
-Version: 1.0.50
+Version: 1.0.51
Release: 1
Group: System/Libraries
License: Apache-2.0