mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
}
- inline void Uniform1f(GLint location, GLfloat x)
+ inline void Uniform1f(GLint location, GLfloat value )
{
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, x ) )
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
+ if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, value ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params;
+ for( int i = 0; i < count; ++i )
+ {
+ params = params + ToString( v[i] ) + ",";
+ }
+
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
inline void Uniform1i(GLint location, GLint x)
{
+ std::string params = ToString( x );
+
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
{
mGetErrorResult = GL_INVALID_OPERATION;
inline void Uniform1iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
inline void Uniform2f(GLint location, GLfloat x, GLfloat y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
location,
Vector2( x, y ) ) )
inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
inline void Uniform2i(GLint location, GLint x, GLint y)
{
+ std::string params = ToString( x ) + "," + ToString( y );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform2iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
location,
Vector3( x, y, z ) ) )
inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms3f.SetUniformValue(
inline void Uniform3i(GLint location, GLint x, GLint y, GLint z)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform3iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
+
if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
location,
Vector4( x, y, z, w ) ) )
inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniforms4f.SetUniformValue(
inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
+ std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
+ AddUniformCallToTraceStack( location, params );
}
inline void Uniform4iv(GLint location, GLsizei count, const GLint* v)
{
+ std::string params = ToString( v );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
}
inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat3.SetUniformValue(
inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
+ std::string params = ToString( value );
+ AddUniformCallToTraceStack( location, params );
+
for( int i = 0; i < count; ++i )
{
if( ! mProgramUniformsMat4.SetUniformValue(
{
}
+private:
+
+ inline void AddUniformCallToTraceStack( GLint location, std::string& value )
+ {
+ std::string name = "<not found>";
+ bool matched = false;
+
+ UniformIDMap& map = mUniforms[mCurrentProgram];
+ for (UniformIDMap::iterator it=map.begin(); it!=map.end(); ++it)
+ {
+ if( it->second == location )
+ {
+ name = it->first;
+ matched = true;
+ break;
+ }
+ }
+
+ if ( matched )
+ {
+ mSetUniformTrace.PushCall( name, value );
+ }
+ }
+
+
public: // TEST FUNCTIONS
inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+ //Methods for Uniform function verification
+ inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
+ inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
+ inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
+
template <typename T>
inline bool GetUniformValue( const char* name, T& value ) const
{
TraceCallStack mDrawTrace;
TraceCallStack mDepthFunctionTrace;
TraceCallStack mStencilFunctionTrace;
+ TraceCallStack mSetUniformTrace;
// Shaders & Uniforms
GLuint mLastShaderIdUsed;
ProgramUniformValue<Matrix> mProgramUniformsMat4;
ProgramUniformValue<Matrix3> mProgramUniformsMat3;
-
-
-
inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
{
return mProgramUniforms1i;
TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
mIsLoadingResult( false ),
- mGetDefaultFontSizeResult( 0 ),
- mLoadedResourcesQueue(),
- mFailedLoadQueue(),
- mResourceRequests(),
mSize(),
mClosestSize(),
mLoadFileResult(),
TestPlatformAbstraction::~TestPlatformAbstraction()
{
- DiscardRequest();
-}
-
-void TestPlatformAbstraction::Suspend()
-{
- mTrace.PushCall("Suspend", "");
-}
-
-void TestPlatformAbstraction::Resume()
-{
- mTrace.PushCall("Resume", "");
}
ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
return closestSize;
}
-void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
-{
- std::ostringstream out;
- out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
-
- mTrace.PushCall("LoadResource", out.str());
-
- mResourceRequests.PushBack( new Integration::ResourceRequest(request) );
-}
-
Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
{
mTrace.PushCall("LoadResourceSynchronously", "");
return mDecodedBitmap;
}
-void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
- mTrace.PushCall("CancelLoad", "");
-}
-
-void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
-{
- mTrace.PushCall("GetResources", "");
-
- while( !mLoadedResourcesQueue.empty() )
- {
- LoadedResource loaded( *mLoadedResourcesQueue.begin() );
- mLoadedResourcesQueue.erase( mLoadedResourcesQueue.begin() );
- cache.LoadResponse( loaded.id, loaded.type, loaded.resource, Integration::RESOURCE_COMPLETELY_LOADED );
- }
-
- // iterate through the resources which failed to load
- while( !mFailedLoadQueue.empty() )
- {
- FailedLoad failed( *mFailedLoadQueue.begin() );
- mFailedLoadQueue.erase( mFailedLoadQueue.begin() );
- cache.LoadFailed( failed.id, failed.failure );
- }
-}
-
-bool TestPlatformAbstraction::IsLoading()
-{
- mTrace.PushCall("IsLoading", "");
- return mIsLoadingResult;
-}
-
-int TestPlatformAbstraction::GetDefaultFontSize() const
-{
- mTrace.PushCall("GetDefaultFontSize", "");
- return mGetDefaultFontSizeResult;
-}
-
-void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
-{
- mTrace.PushCall("SetDpi", "");
-}
-
-bool TestPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
-{
- mTrace.PushCall("LoadFile", "");
- if( mLoadFileResult.loadResult )
- {
- buffer = mLoadFileResult.buffer;
- }
-
- return mLoadFileResult.loadResult;
-}
-
bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
{
mTrace.PushCall("LoadShaderBinaryFile", "");
return mLoadFileResult.loadResult;
}
-bool TestPlatformAbstraction::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const
-{
- mTrace.PushCall("SaveFile", "");
- return false;
-}
-
-void TestPlatformAbstraction::JoinLoaderThreads()
-{
- mTrace.PushCall("JoinLoaderThreads", "");
-}
/** Call this every test */
void TestPlatformAbstraction::Initialize()
{
mTrace.Reset();
mTrace.Enable(true);
- mLoadedResourcesQueue.clear();
- mFailedLoadQueue.clear();
- mResourceRequests.Clear();
mIsLoadingResult=false;
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
{
switch(func)
{
- case SuspendFunc: return mTrace.FindMethod("Suspend");
- case ResumeFunc: return mTrace.FindMethod("Resume");
- case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
case LoadResourceSynchronouslyFunc: return mTrace.FindMethod("LoadResourceSynchronously");
- case LoadFileFunc: return mTrace.FindMethod("LoadFile");
case LoadShaderBinaryFileFunc: return mTrace.FindMethod("LoadShaderBinaryFile");
case SaveShaderBinaryFileFunc: return mTrace.FindMethod("SaveShaderBinaryFile");
- case SaveFileFunc: return mTrace.FindMethod("SaveFile");
- case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
- case GetResourcesFunc: return mTrace.FindMethod("GetResources");
- case IsLoadingFunc: return mTrace.FindMethod("IsLoading");
- case SetDpiFunc: return mTrace.FindMethod("SetDpi");
- case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads");
}
return false;
}
void TestPlatformAbstraction::ClearReadyResources()
{
- mLoadedResourcesQueue.clear();
- mFailedLoadQueue.clear();
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
}
-void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId,
- Integration::ResourceTypeId loadedType,
- Integration::ResourcePointer loadedResource)
-{
- LoadedResource loadedInfo;
- loadedInfo.id = loadedId;
- loadedInfo.type = loadedType;
- loadedInfo.resource = loadedResource;
- mLoadedResourcesQueue.push_back( loadedInfo );
-}
-
-void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId id,
- Integration::ResourceFailure failure)
-{
- FailedLoad failedInfo;
- failedInfo.id = id;
- failedInfo.failure = failure;
- mFailedLoadQueue.push_back( failedInfo );
-}
-
-Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
-{
- Integration::ResourceRequest* request = NULL;
-
- // Return last request
- if( ! mResourceRequests.Empty() )
- {
- request = *( mResourceRequests.End() - 1 );
- }
-
- return request;
-}
-
-const TestPlatformAbstraction::ResourceRequestContainer& TestPlatformAbstraction::GetAllRequests() const
-{
- return mResourceRequests;
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsLoaded()
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- 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);
- SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
- delete request;
- }
- mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure )
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- SetResourceLoadFailed( (*iter)->GetId(), failure);
- delete request;
- }
- mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::DiscardRequest()
-{
- for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
- iter != endIter; ++iter )
- {
- Integration::ResourceRequest* request = *iter;
- delete request;
- }
- mResourceRequests.Clear();
-}
-
void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
{
mClosestSize = size;
public:
- typedef Vector< Integration::ResourceRequest* > ResourceRequestContainer;
-
/**
* Constructor
*/
virtual ~TestPlatformAbstraction();
/**
- * @copydoc PlatformAbstraction::Suspend()
- */
- virtual void Suspend();
-
- /**
- * @copydoc PlatformAbstraction::Resume()
- */
- virtual void Resume();
-
- /**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
virtual ImageDimensions GetClosestImageSize( const std::string& filename,
bool orientationCorrection );
/**
- * @copydoc PlatformAbstraction::LoadResource()
- */
- virtual void LoadResource(const Integration::ResourceRequest& request);
-
- /**
* @copydoc PlatformAbstraction::LoadResourceSynchronously()
*/
virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
/**
- * @copydoc PlatformAbstraction::CancelLoad()
- */
- virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
- /**
- * @copydoc PlatformAbstraction::GetResources()
- */
- virtual void GetResources(Integration::ResourceCache& cache);
-
- /**
- * @copydoc PlatformAbstraction::IsLoading()
- */
- virtual bool IsLoading();
-
- /**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
- virtual int GetDefaultFontSize() const;
-
- /**
- * @copydoc PlatformAbstraction::SetDpi()
- */
- virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
-
- /**
- * @copydoc PlatformAbstraction::LoadFile()
- */
- virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
- /**
* @copydoc PlatformAbstraction::LoadShaderBinaryFile()
*/
virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
/**
- * @copydoc PlatformAbstraction::SaveFile()
+ * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
*/
- virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
-
- /**
- * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
- */
virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
- virtual void JoinLoaderThreads();
public: // TEST FUNCTIONS
// Enumeration of Platform Abstraction methods
typedef enum
{
- SuspendFunc,
- ResumeFunc,
- LoadResourceFunc,
LoadResourceSynchronouslyFunc,
- SaveFileFunc,
- LoadFileFunc,
LoadShaderBinaryFileFunc,
- SaveShaderBinaryFileFunc,
- CancelLoadFunc,
- GetResourcesFunc,
- IsLoadingFunc,
- SetDpiFunc,
- JoinLoaderThreadsFunc,
+ SaveShaderBinaryFileFunc
} TestFuncEnum;
/** Call this every test */
void SetIsLoadingResult(bool result);
/**
- * @brief Sets the value returned by GetDefaultFontSize
- * @param[in] result The value to return
- */
- void SetGetDefaultFontSizeResult(float result);
-
- /**
* @brief Clears all resource queues
*/
void ClearReadyResources();
/**
- * @brief Sets a particular resource request as loaded.
- * @param[in] loadedId The ResourceID of the resource that has been loaded.
- * @param[in] loadedType The type of resource that has been loaded.
- * @param[in] loadedResource A pointer to the resource that has been loaded.
- */
- void SetResourceLoaded(Integration::ResourceId loadedId,
- Integration::ResourceTypeId loadedType,
- Integration::ResourcePointer loadedResource);
-
- /**
- * @brief Sets a particular resource request as load failure.
- * @param[in] id The ID of the failed resource request.
- * @param[in] failure The type of failure.
- */
- void SetResourceLoadFailed(Integration::ResourceId id,
- Integration::ResourceFailure failure);
-
- /**
- * @brief Retrieves the latest resource request
- * @return A pointer to the latest resource request.
- */
- Integration::ResourceRequest* GetRequest();
-
- /**
- * @brief Retrieves a reference to a container of all the resource requests.
- * @return A reference to a container of all the resource requests.
- */
- const ResourceRequestContainer& GetAllRequests() const;
-
- /**
- * @brief Sets all resource requests as loaded.
- */
- void SetAllResourceRequestsAsLoaded();
-
- /**
- * @brief Sets all resource requests as loaded.
- * @param[in] failure The failure type
- */
- void SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure );
-
- /**
- * @brief Discards all current resource requests.
- */
- void DiscardRequest();
-
- /**
* @brief Sets the value returned by GetClosestImageSize.
* @param[in] size The size that should be returned.
*/
private:
- struct LoadedResource
- {
- Integration::ResourceId id;
- Integration::ResourceTypeId type;
- Integration::ResourcePointer resource;
- };
-
- struct FailedLoad
- {
- Integration::ResourceId id;
- Integration::ResourceFailure failure;
- };
-
struct LoadFileResult
{
inline LoadFileResult()
Dali::Vector< unsigned char> buffer;
};
- typedef std::vector< LoadedResource > LoadedResourceContainer;
- typedef std::vector< FailedLoad > FailedLoadContainer;
-
mutable TraceCallStack mTrace;
bool mIsLoadingResult;
- int mGetDefaultFontSizeResult;
- LoadedResourceContainer mLoadedResourcesQueue;
- FailedLoadContainer mFailedLoadQueue;
- ResourceRequestContainer mResourceRequests;
Vector2 mSize;
Vector2 mClosestSize;
namespace Dali
{
+
+template<typename T>
+std::string ToString(const T& x)
+{
+ return "undefined";
+}
+
std::string ToString(int x);
std::string ToString(unsigned int x);
std::string ToString(float x);
namespace
{
bool gTouchCallBackCalled=false;
+bool gTouchCallBackCalled2=false;
+bool gTouchCallBackCalled3=false;
+
bool gHoverCallBackCalled=false;
static bool gTestConstraintCalled;
END_TEST;
}
+static bool TestTouchCallback(Actor actor, const TouchData& touchData )
+{
+ gTouchCallBackCalled = true;
+ return true;
+ END_TEST;
+}
+
+static bool TestTouchCallback2(Actor actor, const TouchData& touchData )
+{
+ gTouchCallBackCalled2 = true;
+ return true;
+ END_TEST;
+}
+
+static bool TestTouchCallback3(Actor actor, const TouchData& touchData )
+{
+ gTouchCallBackCalled3 = true;
+ return true;
+ END_TEST;
+}
+
+static void ResetTouchCallbacks()
+{
+ gTouchCallBackCalled = false;
+ gTouchCallBackCalled2 = false;
+ gTouchCallBackCalled3 = false;
+}
+
static bool TestCallback3(Actor actor, const HoverEvent& event)
{
gHoverCallBackCalled = true;
{
TestApplication application;
- gTouchCallBackCalled = false;
+ ResetTouchCallbacks();
// get the root layer
Actor actor = Stage::GetCurrent().GetRootLayer();
Stage::GetCurrent().Add( actor );
- gTouchCallBackCalled = false;
+ ResetTouchCallbacks();
unsigned int index = 0;
while( NULL != hitTestData[index] )
hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
hitTestData[index]->mResult );
- gTouchCallBackCalled = false;
+ ResetTouchCallbacks();
++index;
}
END_TEST;
DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliActorRaiseLower(void)
+{
+ tet_infoline( "UtcDaliActor Raise and Lower test\n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ stage.Add( actorA );
+ stage.Add( actorB );
+ stage.Add( actorC );
+
+ ResetTouchCallbacks();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Testing Raising of Actor\n" );
+
+ int preActorOrder( 0 );
+ int postActorOrder( 0 );
+
+ Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( preActorOrder );
+
+ DevelActor::Raise( actorB );
+
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( postActorOrder );
+
+ tet_printf( "Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true , TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Testing Lowering of Actor\n" );
+
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( preActorOrder );
+
+ DevelActor::Lower( actorB );
+
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( postActorOrder );
+
+ tet_printf( "Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false , TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ END_TEST;
+}
+
+int UtcDaliActorRaiseToTopLowerToBottom(void)
+{
+ tet_infoline( "UtcDaliActorRaiseToTop and LowerToBottom test \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
+ // enables checking of which actor the uniform is assigned too
+ Shader shaderA = CreateShader();
+ shaderA.RegisterProperty( "uRendererColor",1.f);
+
+ Shader shaderB = CreateShader();
+ shaderB.RegisterProperty( "uRendererColor", 2.f );
+
+ Shader shaderC = CreateShader();
+ shaderC.RegisterProperty( "uRendererColor", 3.f );
+
+ Geometry geometry = CreateQuadGeometry();
+
+ // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
+ Renderer rendererA = Renderer::New(geometry, shaderA);
+ actorA.AddRenderer(rendererA);
+
+ Renderer rendererB = Renderer::New(geometry, shaderB);
+ actorB.AddRenderer(rendererB);
+
+ Renderer rendererC = Renderer::New(geometry, shaderC);
+ actorC.AddRenderer(rendererC);
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ stage.Add( actorA );
+ stage.Add( actorB );
+ stage.Add( actorC );
+
+ ResetTouchCallbacks();
+
+ // Set up gl abstraction trace so can query the set uniform order
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ glAbstraction.EnableSetUniformCallTrace(true);
+ glAbstraction.ResetSetUniformCallStack();
+
+ TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+
+ // Test order of uniforms in stack
+ int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ bool CBA = ( indexC > indexB) && ( indexB > indexA );
+
+ DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "RaiseToTop ActorA\n" );
+
+ DevelActor::RaiseToTop( actorA );
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ tet_infoline( "Testing A above C and B at bottom\n" );
+ bool ACB = ( indexA > indexC) && ( indexC > indexB );
+
+ DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "RaiseToTop ActorB\n" );
+
+ DevelActor::RaiseToTop( actorB );
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ tet_infoline( "Testing B above A and C at bottom\n" );
+ bool BAC = ( indexB > indexA ) && ( indexA > indexC );
+
+ DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" );
+
+ DevelActor::LowerToBottom( actorA );
+ application.SendNotification();
+ application.Render();
+
+ DevelActor::LowerToBottom( actorB );
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ tet_infoline( "Testing C above A and B at bottom\n" );
+ bool CAB = ( indexC > indexA ) && ( indexA > indexB );
+
+ DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ END_TEST;
+}
+
+int UtcDaliActorRaiseAbove(void)
+{
+ tet_infoline( "UtcDaliActor RaiseToAbove test \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ stage.Add( actorA );
+ stage.Add( actorB );
+ stage.Add( actorC );
+
+ ResetTouchCallbacks();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Raise actor B Above Actor C\n" );
+
+ DevelActor::RaiseAbove( actorB, actorC );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Raise actor A Above Actor B\n" );
+
+ DevelActor::RaiseAbove( actorA, actorB );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ END_TEST;
+}
+
+int UtcDaliActorLowerBelow(void)
+{
+ tet_infoline( "UtcDaliActor LowerBelow test \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ // Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
+ // enables checking of which actor the uniform is assigned too
+ Shader shaderA = CreateShader();
+ shaderA.RegisterProperty( "uRendererColor",1.f);
+
+ Shader shaderB = CreateShader();
+ shaderB.RegisterProperty( "uRendererColor", 2.f );
+
+ Shader shaderC = CreateShader();
+ shaderC.RegisterProperty( "uRendererColor", 3.f );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ // Add renderers to Actors so ( uRendererColor, 1 ) is A, ( uRendererColor, 2 ) is B, and ( uRendererColor, 3 ) is C,
+ Geometry geometry = CreateQuadGeometry();
+
+ Renderer rendererA = Renderer::New(geometry, shaderA);
+ actorA.AddRenderer(rendererA);
+
+ Renderer rendererB = Renderer::New(geometry, shaderB);
+ actorB.AddRenderer(rendererB);
+
+ Renderer rendererC = Renderer::New(geometry, shaderC);
+ actorC.AddRenderer(rendererC);
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ stage.Add( actorA );
+ stage.Add( actorB );
+ stage.Add( actorC );
+
+ ResetTouchCallbacks();
+
+ // Set up gl abstraction trace so can query the set uniform order
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ glAbstraction.EnableSetUniformCallTrace(true);
+ glAbstraction.ResetSetUniformCallStack();
+ TraceCallStack& glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ glAbstraction.ResetSetUniformCallStack();
+
+ application.SendNotification();
+ application.Render();
+
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ tet_infoline( "Testing C above B and A at bottom\n" );
+ bool CBA = ( indexC > indexB) && ( indexB > indexA );
+
+ DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ tet_infoline( "UtcDaliActor Test Set up completed \n" );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n" );
+
+ DevelActor::LowerBelow( actorC, actorB );
+
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ tet_infoline( "Testing B above A and C at bottom\n" );
+ bool BAC = ( indexB > indexA) && ( indexA > indexC ); // B at TOP, then A then C at bottom
+
+ DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Lower actor B below Actor C leaving A on top\n" );
+
+ DevelActor::LowerBelow( actorB, actorC );
+
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.Render();
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ bool ACB = ( indexA > indexC) && ( indexC > indexB ); // A on TOP, then C then B at bottom
+
+ DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Lower actor A below Actor C leaving C on top\n" );
+
+ DevelActor::LowerBelow( actorA, actorC );
+
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( event );
+
+ glAbstraction.ResetSetUniformCallStack();
+ glSetUniformStack = glAbstraction.GetSetUniformTrace();
+
+ application.Render();
+ tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+
+ // Test order of uniforms in stack
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+
+ bool CAB = ( indexC > indexA) && ( indexA > indexB );
+
+ DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliActorMaxSiblingOrder(void)
+{
+ tet_infoline( "UtcDaliActor De-fragment of sibling order once max index reached\n" );
+
+ TestApplication application;
+
+ int testOrders[] = { 0,1,3,5,17,998, 999 };
+ int resultingOrders[] = { 0,1,2,3,4,6,5 };
+
+ const int TEST_ORDERS_COUNT = sizeof( testOrders ) / sizeof( testOrders[0] );
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor parent = Actor::New();
+
+ for ( int index = 0; index < TEST_ORDERS_COUNT; index++ )
+ {
+ Actor newActor = Actor::New();
+ newActor.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, testOrders[index] );
+ parent.Add( newActor );
+ }
+ stage.Add( parent );
+
+ tet_printf( "Sibling Order %d children :", parent.GetChildCount() );
+ for ( unsigned int index = 0; index < parent.GetChildCount(); index ++)
+ {
+ Actor sibling = parent.GetChildAt( index );
+ int siblingOrder = 0;
+ Property::Value value = sibling.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( siblingOrder );
+ tet_printf( "%d, ", siblingOrder );
+ }
+ tet_printf( "\n" );
+
+ Actor sibling = parent.GetChildAt( 5 );
+ DevelActor::RaiseToTop( sibling );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Sibling Order %d children :", parent.GetChildCount() );
+ for ( unsigned int index = 0; index < parent.GetChildCount(); index ++)
+ {
+ Actor sibling = parent.GetChildAt( index );
+ int siblingOrder = 0;
+ Property::Value value = sibling.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ value.Get( siblingOrder );
+ tet_printf( "%d, ", siblingOrder );
+ DALI_TEST_EQUALS( siblingOrder, resultingOrders[ index] , TEST_LOCATION );
+ }
+
+ tet_printf( "\n" );
+
+ END_TEST;
+}
+
+int UtcDaliActorRaiseAboveLowerBelowDifferentParentsN(void)
+{
+ tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor parentA = Actor::New();
+ Actor parentB = Actor::New();
+ parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ parentA.SetAnchorPoint( AnchorPoint::CENTER );
+ parentA.SetParentOrigin( ParentOrigin::CENTER );
+
+ parentB.SetAnchorPoint( AnchorPoint::CENTER );
+ parentB.SetParentOrigin( ParentOrigin::CENTER );
+
+ stage.Add( parentA );
+ stage.Add( parentB );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ parentA.Add( actorA );
+ parentA.Add( actorB );
+
+ tet_printf( "Actor C added to different parent from A and B \n" );
+ parentB.Add( actorC );
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ ResetTouchCallbacks();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Raise actor A Above Actor C which have different parents\n" );
+
+ DevelActor::RaiseAbove( actorA, actorC );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ END_TEST;
+}
+
+int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
+{
+ tet_infoline( "UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ ResetTouchCallbacks();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ tet_printf( "Raise actor A Above Actor C which have no parents\n" );
+
+ DevelActor::RaiseAbove( actorA, actorC );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ stage.Add ( actorB );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Lower actor A below Actor C when only A is not on stage \n" );
+ DevelActor::LowerBelow( actorA, actorC );
+ application.ProcessEvent( event );
+
+ tet_printf( "Actor A not parented so LowerBelow should show no effect\n" );
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Adding Actor A to stage, will be on top\n" );
+
+ stage.Add ( actorA );
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Raise actor B Above Actor C when only B has a parent\n" );
+ DevelActor::RaiseAbove( actorB, actorC );
+ application.ProcessEvent( event );
+
+ tet_printf( "C not parented so RaiseAbove should show no effect\n" );
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_printf( "Lower actor A below Actor C when only A has a parent\n" );
+ DevelActor::LowerBelow( actorA, actorC );
+ application.ProcessEvent( event );
+
+ tet_printf( "C not parented so LowerBelow should show no effect\n" );
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ stage.Add ( actorC );
+
+ application.SendNotification();
+ application.Render();
+
+ DevelActor::RaiseAbove( actorA, actorC );
+ application.ProcessEvent( event );
+
+ tet_printf( "Raise actor A Above Actor C, now both have same parent \n" );
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliActorTestAllAPIwhenActorNotParented(void)
+{
+ tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ ResetTouchCallbacks();
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ stage.Add ( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+
+ DevelActor::Raise( actorB );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+ ResetTouchCallbacks();
+
+ DevelActor::Lower( actorC );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ ResetTouchCallbacks();
+
+ tet_printf( "Lower actor C below B but C not parented\n" );
+
+ DevelActor::Lower( actorB );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so Lower should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ ResetTouchCallbacks();
+
+ tet_printf( "Raise actor B to top\n" );
+
+ DevelActor::RaiseToTop( actorB );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so RaiseToTop should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ ResetTouchCallbacks();
+
+ tet_printf( "Add ActorB to stage so only Actor C not parented\n" );
+
+ stage.Add ( actorB );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Lower actor C to Bottom, B stays at top\n" );
+
+ DevelActor::LowerToBottom( actorC );
+
+ application.ProcessEvent( event );
+
+ tet_printf( "Not parented so LowerToBottom should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ ResetTouchCallbacks();
+
+ END_TEST;
+}
+
+
+int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
+{
+ tet_infoline( "UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ Actor actorB = Actor::New();
+ Actor actorC = Actor::New();
+
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorB.SetAnchorPoint( AnchorPoint::CENTER );
+ actorB.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorC.SetAnchorPoint( AnchorPoint::CENTER );
+ actorC.SetParentOrigin( ParentOrigin::CENTER );
+
+ actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+
+ stage.Add( actorA );
+ stage.Add( actorB );
+ stage.Add( actorC );
+
+ // connect to actor touch signals, will use touch callbacks to determine which actor is on top.
+ // Only top actor will get touched.
+ actorA.TouchSignal().Connect( TestTouchCallback );
+ actorB.TouchSignal().Connect( TestTouchCallback2 );
+ actorC.TouchSignal().Connect( TestTouchCallback3 );
+
+ ResetTouchCallbacks();
+
+ application.SendNotification();
+ application.Render();
+
+ Dali::Integration::Point point;
+ point.SetDeviceId( 1 );
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ Dali::Integration::TouchEvent event;
+ event.AddPoint( point );
+
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" );
+
+ DevelActor::RaiseAbove( actorA, actorA );
+
+ application.ProcessEvent( event );
+
+ tet_infoline( "No target is source Actor so RaiseAbove should show no effect\n" );
+
+ DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+
+ ResetTouchCallbacks();
+
+ DevelActor::RaiseAbove( actorA, actorC );
+ application.ProcessEvent( event );
+
+ tet_infoline( "Raise actor A Above Actor C which will now be successful \n" );
+ DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliActorGetScreenPosition(void)
+{
+ tet_infoline( "UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ actorA.SetAnchorPoint( AnchorPoint::CENTER );
+
+ Vector2 size2( 10.0f, 20.0f );
+ actorA.SetSize( size2 );
+
+ actorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n" );
+
+ stage.Add( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+
+ tet_infoline( "UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n" );
+
+ actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+
+ tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n" );
+
+ actorA.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+
+ tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n" );
+
+ actorA.SetPosition( 30.0, 0.0 );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+
+ tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n" );
+
+ actorA.SetPosition( 30.0, 420.0 );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 420lu , TEST_LOCATION );
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y );
+
+
+ END_TEST;
+}
+
+int UtcDaliActorGetScreenPositionAfterScaling(void)
+{
+ tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ Vector2 size2( 10.0f, 20.0f );
+ actorA.SetSize( size2 );
+ actorA.SetScale( 1.5f );
+ actorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n" );
+
+ stage.Add( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+
+ tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n" );
+
+ actorA.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x , 0.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
+{
+ tet_infoline( "UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ Actor actorA = Actor::New();
+ actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+ Vector2 size2( 10.0f, 20.0f );
+ actorA.SetSize( size2 );
+ actorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( " TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ stage.Add( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 240.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 400.0f , TEST_LOCATION );
+
+ tet_infoline( " BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n" );
+
+ actorA.SetParentOrigin( ParentOrigin::TOP_RIGHT );
+ actorA.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x , 480.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
+
+ END_TEST;
+ END_TEST;
+}
+
+int UtcDaliActorGetScreenPositionWithChildActors(void)
+{
+ tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ Actor actorA = Actor::New();
+ actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+ Vector2 size1( 10.0f, 20.0f );
+ actorA.SetSize( size1 );
+ actorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ Actor parentActorA = Actor::New();
+ parentActorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ parentActorA.SetParentOrigin( ParentOrigin::CENTER );
+ Vector2 size2( 30.0f, 60.0f );
+ parentActorA.SetSize( size2 );
+ parentActorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
+
+ stage.Add( parentActorA );
+ parentActorA.Add ( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 255.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 430.0f , TEST_LOCATION );
+
+ tet_infoline( "Test 2\n");
+
+ tet_infoline( "change parent anchor point and parent origin then check screen position \n" );
+
+ parentActorA.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+ parentActorA.SetParentOrigin( ParentOrigin::TOP_LEFT );
+
+ application.SendNotification();
+ application.Render();
+
+ actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 15.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, -30.0f , TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliActorGetScreenPositionWithChildActors02(void)
+{
+ tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n" );
+
+ TestApplication application;
+
+ Stage stage( Stage::GetCurrent() );
+
+ tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ Actor actorA = Actor::New();
+ actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actorA.SetParentOrigin( ParentOrigin::CENTER );
+ Vector2 size1( 10.0f, 20.0f );
+ actorA.SetSize( size1 );
+ actorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ Actor parentActorA = Actor::New();
+ parentActorA.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ parentActorA.SetParentOrigin( ParentOrigin::CENTER );
+ Vector2 size2( 30.0f, 60.0f );
+ parentActorA.SetSize( size2 );
+ parentActorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "Create Grand Parent Actor 1 TOP_RIGHT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+
+ Actor grandParentActorA = Actor::New();
+ grandParentActorA.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+ grandParentActorA.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
+ Vector2 size3( 60.0f, 120.0f );
+ grandParentActorA.SetSize( size3 );
+ grandParentActorA.SetPosition( 0.f, 0.f );
+
+ tet_infoline( "Add Parent 1 to Grand Parent 1 \n" );
+
+ stage.Add( grandParentActorA );
+ grandParentActorA.Add ( parentActorA );
+
+ tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
+
+ parentActorA.Add ( actorA );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
+ Vector2 actorScreenPosition = actorA.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >();
+
+ tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
+ tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+
+ DALI_TEST_EQUALS( actorScreenPosition.x, 45.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS( actorScreenPosition.y, 770.0f , TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliActorPositionUsesAnchorPoint(void)
+{
+ TestApplication application;
+ tet_infoline( "Check default behaviour\n" );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( 100.0f, 100.0f );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Check that the world position is in the center\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Set the position uses anchor point property to false\n" );
+ actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Check that the world position has changed appropriately\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliActorPositionUsesAnchorPointCheckScale(void)
+{
+ TestApplication application;
+ tet_infoline( "Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetScale( 2.0f );
+ actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Check the world position is the same as it would be without a scale\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 100.0f, 100.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
+{
+ TestApplication application;
+ tet_infoline( "Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
+ actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Check the world position is the same as it would be without a rotation\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( -50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 150.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
+{
+ TestApplication application;
+ tet_infoline( "Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetOrientation( Degree( 90.0f), Vector3::ZAXIS );
+ actor.SetScale( 2.0f );
+ actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Check the world position is the same as it would be without a scale and rotation\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( -100.0f, 100.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
+ actor.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), Vector3( 200.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
+{
+ TestApplication application;
+ tet_infoline( "Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+
+ Actor parent = Actor::New();
+
+ Stage::GetCurrent().Add( parent );
+ Vector2 stageSize( Stage::GetCurrent().GetSize() );
+
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::CENTER );
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetInheritScale( false );
+ actor.SetInheritOrientation( false );
+ actor.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+ parent.Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector3 expectedWorldPosition( -stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f );
+
+ tet_infoline( "Check the world position is in the right place\n" );
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), expectedWorldPosition, TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed" );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), expectedWorldPosition, TEST_LOCATION );
+
+ tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed" );
+ actor.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentWorldPosition(), expectedWorldPosition, TEST_LOCATION );
+
+ END_TEST;
+}
+
namespace
{
-void LoadBitmapResource(TestPlatformAbstraction& platform)
-{
- Integration::ResourceRequest* request = platform.GetRequest();
- 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);
-
- if(request)
- {
- platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
- }
-}
}
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
- TestPlatformAbstraction& platform = application.GetPlatform();
- LoadBitmapResource( platform );
application.Render(16);
application.SendNotification();
} // Drop image handle
application.SendNotification();
application.Render(16);
- 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::OWNED_DISCARD)));
- }
-
- application.Render(16);
- application.SendNotification();
-
DALI_TEST_CHECK( SignalLoadFlag == true );
END_TEST;
}
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/internal/event/actors/actor-impl.h>
+
+namespace Dali
+{
+
+namespace DevelActor
+{
+
+void Raise( Actor actor )
+{
+ GetImplementation( actor ).Raise();
+}
+
+void Lower( Actor actor )
+{
+ GetImplementation( actor ).Lower();
+}
+
+void RaiseToTop( Actor actor )
+{
+ GetImplementation( actor ).RaiseToTop();
+}
+
+void LowerToBottom( Actor actor )
+{
+ GetImplementation( actor ).LowerToBottom();
+}
+
+void RaiseAbove( Actor actor, Actor target )
+{
+ GetImplementation( actor ).RaiseAbove( GetImplementation( target ) );
+}
+
+void LowerBelow( Actor actor, Actor target )
+{
+ GetImplementation( actor ).LowerBelow( GetImplementation( target ) );
+}
+
+} // namespace DevelActor
+
+} // namespace Dali
#define DALI_ACTOR_DEVEL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
INHERIT_POSITION = Dali::Actor::Property::INHERIT_POSITION,
CLIPPING_MODE = Dali::Actor::Property::CLIPPING_MODE,
- SIBLING_ORDER = CLIPPING_MODE + 1,
+ /**
+ * @brief Sets the sibling order of the actor so depth position can be defined within the same parent.
+ * @details Name "siblingOrder", type Property::INTEGER.
+ * @note The initial value is 0.
+ * @note Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the
+ * sibling order. The values set by this Property will likely change.
+ */
+ SIBLING_ORDER = CLIPPING_MODE + 1,
/**
* @brief The opacity of the actor.
* @details Name "opacity", type Property::FLOAT.
- * @SINCE_1_2.28
*/
- OPACITY = CLIPPING_MODE + 2,
+ OPACITY = CLIPPING_MODE + 2,
+
+ /**
+ * @brief Returns the screen position of the Actor
+ * @details Name "screenPosition", type Property::VECTOR2. Read-only
+ * @note This assumes default camera and default render-task and the Z position is ZERO.
+ */
+ SCREEN_POSITION = CLIPPING_MODE + 3,
+
+ /**
+ * @brief Determines whether the anchor point should be used to determine the position of the actor.
+ * @details Name "positionUsesAnchorPoint", type Property::BOOLEAN.
+ * @note This is true by default.
+ * @note If false, then the top-left of the actor is used for the position.
+ * @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position.
+ */
+ POSITION_USES_ANCHOR_POINT = CLIPPING_MODE + 4
};
} // namespace Property
+/**
+ * @brief Raise actor above the next highest level of actor(s).
+ *
+ * @param[in] actor The Actor to raise
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Initially actors added to a parent will have the same sibling order and shown in relation to insertion order.
+ * Raising this actor above actors with the same sibling order as each other will raise this actor above them.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ *
+ */
+DALI_IMPORT_API void Raise( Actor actor );
+
+/**
+ * @brief Lower the actor to underneath the level below actor(s).
+ *
+ * @param[in] actor The Actor to lower
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Lowering this actor below actors with the same sibling order as each other will lower this actor above them.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ */
+DALI_IMPORT_API void Lower( Actor actor );
+
+/**
+ * @brief Raise actor above all other actors.
+ *
+ * @param[in] actor The Actor to raise to the top
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ */
+DALI_IMPORT_API void RaiseToTop( Actor actor );
+
+/**
+ * @brief Lower actor to the bottom of all actors.
+ *
+ * @param[in] actor The Actor to lower to the bottom
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ */
+DALI_IMPORT_API void LowerToBottom( Actor actor );
+
+/**
+ * @brief Raise the actor to above the target actor.
+ *
+ * @param[in] actor The actor to raise
+ * @param[in] target Will be raised above this actor
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Actors on the level above the target actor will still be shown above this actor.
+ * Raising this actor above actors with the same sibling order as each other will raise this actor above them.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ */
+DALI_IMPORT_API void RaiseAbove( Actor actor, Dali::Actor target );
+
+/**
+ * @brief Lower the actor to below the target actor.
+ *
+ * @param[in] actor The Actor to lower
+ * @param[in] target Will be lowered below this actor
+ * @note Sibling order of actors within the parent will be updated automatically.
+ * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors.
+ * Lowering this actor below actors with the same sibling order as each other will lower this actor above them.
+ * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion.
+ */
+DALI_IMPORT_API void LowerBelow( Actor actor, Dali::Actor target );
+
} // namespace DevelActor
} // namespace Dali
*/
Iterator Erase( Iterator position )
{
- delete (*position);
+ Delete (*position);
return Vector< T >::Erase( position );
}
ConstIterator end = Vector< T >::End();
for( Iterator iter = Vector< T >::Begin(); iter != end; ++iter )
{
- delete (*iter);
+ Delete (*iter);
}
Vector< T >::Clear();
}
ConstIterator end = Vector< T >::End();
for( Iterator iter = Vector< T >::Begin() + size; iter != end; ++iter )
{
- delete (*iter);
+ Delete (*iter);
}
}
Vector< T >::Resize( size );
// Undefined assignment operator.
OwnerContainer& operator=( const OwnerContainer& );
+ /**
+ * @brief delete the contents of the pointer
+ * Function provided to allow classes to provide a custom destructor through template specialisation
+ * @param pointer to the object
+ */
+ void Delete( T pointer )
+ {
+ delete pointer;
+ }
+
+
};
} // namespace Dali
# Add devel source files here for DALi internal developer files used by Adaptor & Toolkit
devel_api_src_files = \
+ $(devel_api_src_dir)/actors/actor-devel.cpp \
$(devel_api_src_dir)/animation/animation-data.cpp \
$(devel_api_src_dir)/animation/path-constrainer.cpp \
$(devel_api_src_dir)/common/hash.cpp \
void TextureSetImage( TextureSet textureSet, size_t index, Image image )
{
- Internal::NewTexture* texture = NULL;
+ Internal::Texture* texture = NULL;
if( image )
{
texture = GetImplementation( image ).GetTexture();
NOT_REQUESTED = 0, ///< Zero means that no further updates are required
STAGE_KEEP_RENDERING = 1<<1, ///< - Stage::KeepRendering() is being used
ANIMATIONS_RUNNING = 1<<2, ///< - Animations are ongoing
- LOADING_RESOURCES = 1<<3, ///< - Resources are being loaded
- MONITORING_PERFORMANCE = 1<<4, ///< - The --enable-performance-monitor option is being used
- RENDER_TASK_SYNC = 1<<5 ///< - A render task is waiting for render sync
+ MONITORING_PERFORMANCE = 1<<3, ///< - The --enable-performance-monitor option is being used
+ RENDER_TASK_SYNC = 1<<4 ///< - A render task is waiting for render sync
};
}
$(platform_abstraction_src_dir)/bitmap.h \
$(platform_abstraction_src_dir)/resource-policies.h \
$(platform_abstraction_src_dir)/resource-types.h \
- $(platform_abstraction_src_dir)/resource-request.h \
- $(platform_abstraction_src_dir)/resource-cache.h \
$(platform_abstraction_src_dir)/resource-declarations.h \
$(platform_abstraction_src_dir)/gl-abstraction.h \
$(platform_abstraction_src_dir)/gl-defines.h \
// INTERNAL INCLUDES
-#include <dali/integration-api/resource-cache.h>
#include <dali/integration-api/bitmap.h>
+#include <dali/integration-api/resource-types.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/common/dali-vector.h>
namespace Integration
{
+typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
+
/**
* PlatformAbstraction is an abstract interface, used by Dali to access platform specific services.
* A concrete implementation must be created for each platform, and provided when creating the
*/
virtual ~PlatformAbstraction() {}
- // DALi Lifecycle
-
- /**
- * Tell the platform abstraction that Dali is ready to pause, such as when the
- * application enters a background state.
- * Allows background threads to pause their work until Resume() is called.
- * This is a good time to release recreatable data such as memory caches
- * to cooperate with other apps and reduce the chance of this one being
- * force-killed in a low memory situation.
- */
- virtual void Suspend() = 0;
-
- /**
- * Tell the platform abstraction that Dali is resuming from a pause, such as
- * when it has transitioned from a background state to a foreground one.
- * It is time to wake up sleeping background threads and recreate memory
- * caches and other temporary data.
- */
- virtual void Resume() = 0;
-
// Resource Loading
/**
bool orientationCorrection = true) = 0;
/**
- * Request a resource from the native filesystem. This is an asynchronous request.
- * After this method returns, FillResourceCache() will be called to retrieve the result(s) of the
- * resource loading operation. Loading resources in separate worker thread is recommended.
- * Multi-threading note: this method will be called from the main thread only i.e. not
- * from within the Core::Render() method.
- * @param[in] request A unique resource request. This is not guaranteed to survive after LoadResource
- * returns; the loading process should take a copy.
- */
- virtual void LoadResource(const ResourceRequest& request) = 0;
-
- /**
* Request a resource from the native filesystem. This is a synchronous request, i.e.
* it will block the main loop whilst executing. It should therefore be used sparingly.
*
virtual BitmapPtr DecodeBuffer( const ResourceType& resourceType, uint8_t * buffer, size_t bufferSize ) = 0;
/**
- * Cancel an ongoing LoadResource() request.
- * Multi-threading note: this method will be called from the main thread only i.e. not
- * from within the Core::Render() method.
- * @param[in] id The ID of the resource to cancel.
- * @param[in] typeId The ID type of the resource to cancel.
- */
- virtual void CancelLoad(ResourceId id, ResourceTypeId typeId) = 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
- * the UpdateManager::Update() method.
- * @param[in] cache The resource cache to fill.
- */
- virtual void GetResources(ResourceCache& cache) = 0;
-
- /**
- * Waits for the asynchronous loader threads (if any) to finish.
- * This will be only be called before Core destruction; no resource loading requests will be
- * made following this method.
- */
- virtual void JoinLoaderThreads() = 0;
-
- // Font Queries
-
- /**
- * Called by Dali to retrieve the default font size for the platform.
- * This is an accessibility size, which is mapped to a UI Control specific point-size in stylesheets.
- * For example if zero the smallest size, this could potentially map to TextLabel point-size 8.
- * Multi-threading note: this method will be called from the main thread only i.e. not
- * from within the Core::Render() method.
- * @return The default font size.
- */
- virtual int GetDefaultFontSize() const = 0;
-
- /**
- * Load a file into a buffer
- * @param[in] filename The filename to load
- * @param[out] buffer A buffer to receive the file.
- * @result true if the file is loaded.
- */
- virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) 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.
#include <dali/internal/event/images/image-impl.h>
-#include <dali/internal/event/resources/resource-ticket.h>
-#include <dali/internal/event/resources/image-ticket.h>
-
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
-#include <dali/internal/update/resources/texture-metadata.h>
-#include <dali/internal/render/gl-resources/bitmap-texture.h>
#include <dali/internal/render/renderers/render-geometry.h>
#include <dali/internal/render/renderers/render-property-buffer.h>
#include <dali/internal/render/renderers/render-renderer.h>
sizeof( Internal::SceneGraph::Layer ) );
const int IMAGE_MEMORY_SIZE(
sizeof( Internal::Image ) +
- sizeof( Integration::Bitmap ) +
- sizeof( Internal::TextureMetadata ) +
- sizeof( Internal::BitmapTexture ) +
- sizeof( Internal::ImageTicket ) );
+ sizeof( Integration::Bitmap ) );
const int RENDERER_MEMORY_SIZE(
sizeof( Internal::Renderer ) +
sizeof( Internal::SceneGraph::Renderer ) +
+++ /dev/null
-#ifndef __DALI_INTEGRATION_RESOURCE_CACHE_H__
-#define __DALI_INTEGRATION_RESOURCE_CACHE_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/integration-api/resource-request.h>
-
-namespace Dali
-{
-
-namespace Integration
-{
-/**
- * Used to determine why a resource IO operation has failed.
- */
-enum ResourceFailure
-{
- FailureUnknown,
- FailureFileNotFound,
- FailureInvalidPath
-};
-
-/**
- * Used to return loaded resources for rendering etc.
- */
-typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
-
-/**
- * Abstract interface to receive notifications of resource IO operations.
- * This is used when pulling loaded resources from the PlatformAbstraction.
- */
-class ResourceCache
-{
-protected:
-
- /**
- * Virtual protected destructor, no deletion through this interface
- */
- virtual ~ResourceCache() {}
-
-public:
-
- /**
- * Provide the results of a resource loading operation to the cache.
- * @param[in] id The unique ID of the load request.
- * This should match an ID previously passed into PlatformAbstraction::LoadResource().
- * LoadResponse() may be called multiple times with the same ID, when results are available
- * at different stages e.g. a thumbnail image may be provided, before the full image is loaded.
- * @param[in] type The type of the resource.
- * @param[in] resource A pointer to a resource (Bitmap etc).
- * @param[in] status The current loading status. RESOURCE_LOADING and RESOURCE_PARTIALLY_LOADED indicate there are more responses to come, RESOURCE_COMPLETELY_LOADED indicates this is the last response for this id.
- */
- virtual void LoadResponse(ResourceId id, ResourceTypeId type, ResourcePointer resource, LoadStatus status) = 0;
-
- /**
- * Report that a resource loading operation has failed.
- * @param[in] id The unique ID of the load request.
- * This should match an ID previously passed into PlatformAbstraction::LoadResource().
- * @param[in] failure An error code, used to determine why the load failed.
- */
- virtual void LoadFailed(ResourceId id, ResourceFailure failure) = 0;
-};
-
-
-} // namespace Integration
-
-} // namespace Dali
-
-#endif // __DALI_INTEGRATION_RESOURCE_CACHE_H__
+++ /dev/null
-#ifndef __DALI_INTEGRATION_RESOURCE_REQUEST_H__
-#define __DALI_INTEGRATION_RESOURCE_REQUEST_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/resource-types.h>
-#include <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-class RefObject;
-
-namespace Integration
-{
-
-// Resource Requests
-
-/**
- * Used to return loaded resources for rendering etc.
- */
-typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
-
-/**
- * Used to prioritize between loading operations.
- */
-enum LoadResourcePriority
-{
- LoadPriorityLowest,
- LoadPriorityLow,
- LoadPriorityNormal,
- LoadPriorityHigh,
- LoadPriorityHighest,
-};
-
-/**
- * Used to request a resource from the native filesystem.
- */
-class ResourceRequest
-{
-public:
-
- /**
- * Used to request a resource be accessed from the native filesystem.
- * @param[in] newId A unique ID for this request.
- * @param[in] resourceType The type of resource requested. The implementation of
- * PlatformAbstraction::LoadResource() is responsible for
- * converting the native file(s) to this type
- * e.g. decoding a jpeg to a bitmap.
- * @param[in] resourcePath The path of the resource; typically a filename.
- * @param[in] loadPriority The priority of the request.
- */
- ResourceRequest(ResourceId newId,
- const ResourceType& resourceType,
- const std::string& resourcePath,
- LoadResourcePriority loadPriority = LoadPriorityNormal)
- : id(newId),
- type(NULL),
- path(resourcePath),
- priority(loadPriority)
- {
- type = resourceType.Clone();
- }
-
- /**
- * Used to request or save a resource from/to the native filesystem.
- * @param[in] newId A unique ID for this request.
- * @param[in] resourceType The type of resource.
- * @param[in] resourcePath The location of the resource / where the resource should be saved.
- * @param[in] resourcePtr The resource to decode / save.
- * @param[in] savePriority The priority of the request.
- */
- ResourceRequest(ResourceId newId,
- const ResourceType& resourceType,
- const std::string& resourcePath,
- ResourcePointer resourcePtr,
- LoadResourcePriority savePriority = LoadPriorityNormal)
- : id(newId),
- type(NULL),
- path(resourcePath),
- resource(resourcePtr),
- priority(savePriority)
- {
- type = resourceType.Clone();
- }
-
- /**
- * Copy constructor.
- * @param[in] request The resource request to copy.
- */
- ResourceRequest(const ResourceRequest& request)
- : id(request.id),
- type(NULL),
- path(request.path),
- resource(request.resource),
- priority(request.priority)
- {
- type = request.type->Clone();
- }
-
- /**
- * Assignment operator.
- * @param[in] rhs The resource request to copy.
- */
- ResourceRequest& operator=(const ResourceRequest& rhs)
- {
- if( this != &rhs )
- {
- id = rhs.id;
- type = rhs.type->Clone();
- path = rhs.path;
- resource = rhs.resource;
- priority = rhs.priority;
- }
-
- return *this;
- }
-
- /**
- * Non-virtual destructor; not intended as a base class
- */
- ~ResourceRequest()
- {
- delete type;
- }
-
- /**
- * Retrieve the resource ID
- * @return The ID
- */
- ResourceId GetId() const
- {
- return id;
- }
-
- /**
- * Retrieve the resource type
- * @return The type
- */
- ResourceType* GetType() const
- {
- return type;
- }
-
- /**
- * Retrieve the resource path
- * @return The path
- */
- const std::string& GetPath() const
- {
- return path;
- }
-
- /**
- * Retrieve the resource (for save and decode requests)
- * @return The resource
- */
- ResourcePointer GetResource() const
- {
- return resource;
- }
-
- /**
- * Retrieve the load priority
- * @return The priority
- */
- LoadResourcePriority GetPriority() const
- {
- return priority;
- }
-
-private:
-
- ResourceId id;
- ResourceType* type;
- std::string path;
- /** When saving resources or decoding them, the resource data will be passed
- * through in a reference counted object here. When Loading, it will be null. */
- ResourcePointer resource;
- LoadResourcePriority priority;
-};
-
-} // namespace Integration
-
-} // namespace Dali
-
-#endif // __DALI_INTEGRATION_RESOURCE_REQUEST_H__
*/
enum ResourceTypeId
{
- ResourceBitmap,
- ResourceNativeImage,
- ResourceTargetImage
+ ResourceBitmap
};
/**
BitmapResourceType& operator=(const BitmapResourceType& rhs);
};
-/**
- * NativeImageResourceType describes a native image resource, which can be injected
- * through ResourceManager::AddNativeImage() or requested through ResourceLoader::LoadResource().
- * If the adaptor does not support NativeImages, it can fall back to Bitmap type.
- */
-struct NativeImageResourceType : public ResourceType
-{
- /**
- * Constructor.
- */
- NativeImageResourceType()
- : ResourceType(ResourceNativeImage) {}
-
- /**
- * Constructor.
- * @param[in] dimensions Width and Height to allocate for image.
- */
- NativeImageResourceType( ImageDimensions dimensions )
- : ResourceType(ResourceNativeImage),
- imageDimensions(dimensions) {}
-
- /**
- * Destructor.
- */
- virtual ~NativeImageResourceType() {}
-
- /**
- * @copydoc ResourceType::Clone
- */
- virtual ResourceType* Clone() const
- {
- return new NativeImageResourceType(imageDimensions);
- }
-
- /**
- * Attributes are copied from the request (if supplied).
- */
- ImageDimensions imageDimensions;
-
-private:
-
- // Undefined copy constructor.
- NativeImageResourceType(const NativeImageResourceType& typePath);
-
- // Undefined assignment operator.
- NativeImageResourceType& operator=(const NativeImageResourceType& rhs);
-};
-
-/**
- * RenderTargetResourceType describes a bitmap resource, which can injected
- * through ResourceManager::AddTargetImage()
- */
-struct RenderTargetResourceType : public ResourceType
-{
- /**
- * Constructor.
- */
- RenderTargetResourceType()
- : ResourceType(ResourceTargetImage) {}
-
- /**
- * Constructor.
- * @param[in] dims Width and Height to allocate for image.
- */
- RenderTargetResourceType( ImageDimensions dims )
- : ResourceType(ResourceTargetImage),
- imageDimensions(dims) {}
-
- /**
- * Destructor.
- */
- virtual ~RenderTargetResourceType() {}
-
- /**
- * @copydoc ResourceType::Clone
- */
- virtual ResourceType* Clone() const
- {
- return new RenderTargetResourceType(imageDimensions);
- }
-
- /**
- * Image size is copied from the request.
- */
- ImageDimensions imageDimensions;
-
-private:
-
- // Undefined copy constructor.
- RenderTargetResourceType(const RenderTargetResourceType& typePath);
-
- // Undefined assignment operator.
- RenderTargetResourceType& operator=(const RenderTargetResourceType& rhs);
-};
-
} // namespace Integration
} // namespace Dali
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
#include <dali/internal/update/common/discard-queue.h>
-#include <dali/internal/update/common/texture-cache-dispatcher.h>
#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/manager/render-task-processor.h>
-#include <dali/internal/update/resources/resource-manager.h>
#include <dali/internal/render/common/performance-monitor.h>
#include <dali/internal/render/common/render-manager.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
#include <dali/internal/render/gl-resources/context.h>
using Dali::Internal::SceneGraph::UpdateManager;
using Dali::Internal::SceneGraph::RenderManager;
using Dali::Internal::SceneGraph::DiscardQueue;
using Dali::Internal::SceneGraph::RenderQueue;
-using Dali::Internal::SceneGraph::TextureCache;
-using Dali::Internal::SceneGraph::TextureCacheDispatcher;
namespace
{
mUpdateManager(NULL),
mRenderManager(NULL),
mDiscardQueue(NULL),
- mTextureUploadedQueue(),
mNotificationManager(NULL),
mShaderFactory(NULL),
mIsActive(true),
mPropertyNotificationManager = PropertyNotificationManager::New();
- mTextureUploadedQueue = new LockedResourceQueue;
-
mRenderTaskProcessor = new SceneGraph::RenderTaskProcessor();
- mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, *mTextureUploadedQueue );
+ mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction );
RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
- TextureCache& textureCache = mRenderManager->GetTextureCache();
-
- ResourcePolicy::Discardable discardPolicy = ResourcePolicy::OWNED_DISCARD;
- if( dataRetentionPolicy == ResourcePolicy::DALI_RETAINS_ALL_DATA )
- {
- discardPolicy = ResourcePolicy::OWNED_RETAIN;
- }
- textureCache.SetDiscardBitmapsPolicy(discardPolicy);
-
- mTextureCacheDispatcher = new SceneGraph::TextureCacheDispatcher( renderQueue, textureCache );
mDiscardQueue = new DiscardQueue( renderQueue );
- mResourceManager = new ResourceManager( mPlatform,
- *mNotificationManager,
- *mTextureCacheDispatcher,
- *mTextureUploadedQueue,
- *mDiscardQueue,
- renderQueue );
-
mUpdateManager = new UpdateManager( *mNotificationManager,
*mAnimationPlaylist,
*mPropertyNotificationManager,
- *mResourceManager,
*mDiscardQueue,
renderController,
*mRenderManager,
renderQueue,
- *mTextureCacheDispatcher,
*mRenderTaskProcessor );
mRenderManager->SetShaderSaver( *mUpdateManager );
Core::~Core()
{
- /**
- * TODO this should be done by Adaptor, Core does not know about threading
- * First stop the resource loading thread(s)
- */
- mPlatform.JoinLoaderThreads();
-
/*
* The order of destructing these singletons is important!!!
*/
delete mGestureEventProcessor;
delete mNotificationManager;
delete mShaderFactory;
- delete mResourceManager;
delete mDiscardQueue;
- delete mTextureCacheDispatcher;
delete mUpdateManager;
delete mRenderManager;
delete mRenderTaskProcessor;
- delete mTextureUploadedQueue;
}
Integration::ContextNotifierInterface* Core::GetContextNotifier()
// No need to keep update running if there are notifications to process.
// Any message to update will wake it up anyways
-
- if ( mResourceManager->ResourcesToProcess() )
- {
- // If we are still processing resources, then we have to continue the update
- status.keepUpdating |= Integration::KeepUpdating::LOADING_RESOURCES;
- }
}
void Core::Render( RenderStatus& status )
void Core::Suspend()
{
- mPlatform.Suspend();
-
mIsActive = false;
}
void Core::Resume()
{
- mPlatform.Resume();
-
mIsActive = true;
// trigger processing of events queued up while paused
return *(mNotificationManager);
}
-ResourceManager& Core::GetResourceManager()
-{
- return *(mResourceManager);
-}
-
ShaderFactory& Core::GetShaderFactory()
{
return *(mShaderFactory);
#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/event/animation/animation-playlist-declarations.h>
#include <dali/internal/event/common/stage-def.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
#include <dali/public-api/common/view-mode.h>
#include <dali/integration-api/resource-policies.h>
class PropertyNotificationManager;
class EventProcessor;
class GestureEventProcessor;
-class ResourceManager;
class ShaderFactory;
class TouchResampler;
class RelayoutController;
class UpdateManager;
class RenderManager;
class DiscardQueue;
-class TextureCacheDispatcher;
class RenderTaskProcessor;
}
NotificationManager& GetNotificationManager();
/**
- * Returns the Resource Manager.
- * @return A reference to the Resource Manager.
- */
- ResourceManager& GetResourceManager();
-
- /**
* Returns the Shader factory
* @return A reference to the Shader binary factory.
*/
SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
SceneGraph::RenderManager* mRenderManager; ///< Render manager
SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
- SceneGraph::TextureCacheDispatcher* mTextureCacheDispatcher; ///< Used to send messages to TextureCache
- LockedResourceQueue* mTextureUploadedQueue; ///< Stores resource ids which require post processing after render
NotificationManager* mNotificationManager; ///< Notification manager
AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
ShaderFactory* mShaderFactory; ///< Shader resource factory
- ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
SceneGraph::RenderTaskProcessor* mRenderTaskProcessor; ///< Handles the processing of render tasks
bool mIsActive : 1; ///< Whether Core is active or suspended
{
void* blockMemory; ///< The allocated memory from which allocations can be made
Block* nextBlock; ///< The next block in the linked list
-
+#ifdef DEBUG_ENABLED
+ SizeType mBlockSize; ///< Size of the block in bytes
+#endif
/**
* @brief Construct a new block with given size
*
*/
Block( SizeType size )
: nextBlock( NULL )
+#ifdef DEBUG_ENABLED
+ ,mBlockSize( size )
+#endif
{
blockMemory = ::operator new( size );
DALI_ASSERT_ALWAYS( blockMemory && "Out of memory" );
mCurrentBlockSize = 0;
}
+#ifdef DEBUG_ENABLED
+
+ /**
+ * @brief check the memory being free'd exists inside the memory pool
+ * @param[in] memory address of object to remove
+ */
+ void CheckMemoryIsInsidePool( const void* const memory )
+ {
+ bool inRange = false;
+ const Block* block = &mMemoryBlocks;
+
+ while( block )
+ {
+ const void* const endOfBlock = reinterpret_cast<char *>( block->blockMemory )+ block->mBlockSize;
+
+ if( ( memory >= block->blockMemory ) && ( memory < (endOfBlock) ) )
+ {
+ inRange = true;
+ break;
+ }
+ block = block->nextBlock;
+ }
+ DALI_ASSERT_DEBUG( inRange && "Freeing memory that does not exist in memory pool" );
+ }
+#endif
Mutex mMutex; ///< Mutex for thread-safe allocation and deallocation
void FixedSizeMemoryPool::Free( void* memory )
{
+#ifdef DEBUG_ENABLED
+ mImpl->CheckMemoryIsInsidePool( memory );
+#endif
+
// Add memory to head of deleted objects list. Store next address in the same memory space as the old object.
*( reinterpret_cast< void** >( memory ) ) = mImpl->mDeletedObjects;
mImpl->mDeletedObjects = memory;
const SizeScalePolicy::Type DEFAULT_SIZE_SCALE_POLICY = SizeScalePolicy::USE_SIZE_SET;
+int GetSiblingOrder( ActorPtr actor )
+{
+ Property::Value value = actor->GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
+ int order;
+ value.Get( order );
+ return order;
+}
+
+bool ValidateActors( const Internal::Actor& actor, const Internal::Actor& target )
+{
+ bool validTarget = true;
+
+ if( &actor == &target )
+ {
+ DALI_LOG_WARNING( "Source actor and target actor can not be the same, Sibling order not changed.\n" );
+ validTarget = false;
+ }
+ else if( actor.GetParent() != target.GetParent() )
+ {
+ DALI_LOG_WARNING( "Source actor and target actor need to have common parent, Sibling order not changed.\n" );
+ validTarget = false;
+ }
+
+ return validTarget;
+}
+
} // unnamed namespace
/**
* Name Type writable animatable constraint-input enum for index-checking
*/
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN )
-DALI_PROPERTY( "parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X )
-DALI_PROPERTY( "parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y )
-DALI_PROPERTY( "parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z )
-DALI_PROPERTY( "anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT )
-DALI_PROPERTY( "anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X )
-DALI_PROPERTY( "anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y )
-DALI_PROPERTY( "anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z )
-DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE )
-DALI_PROPERTY( "sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH )
-DALI_PROPERTY( "sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT )
-DALI_PROPERTY( "sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH )
-DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION )
-DALI_PROPERTY( "positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X )
-DALI_PROPERTY( "positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y )
-DALI_PROPERTY( "positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z )
-DALI_PROPERTY( "worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION )
-DALI_PROPERTY( "worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X )
-DALI_PROPERTY( "worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y )
-DALI_PROPERTY( "worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z )
-DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION )
-DALI_PROPERTY( "worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION )
-DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE )
-DALI_PROPERTY( "scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X )
-DALI_PROPERTY( "scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y )
-DALI_PROPERTY( "scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z )
-DALI_PROPERTY( "worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE )
-DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE )
-DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR )
-DALI_PROPERTY( "colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED )
-DALI_PROPERTY( "colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN )
-DALI_PROPERTY( "colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE )
-DALI_PROPERTY( "colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA )
-DALI_PROPERTY( "worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR )
-DALI_PROPERTY( "worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX )
-DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME )
-DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE )
-DALI_PROPERTY( "leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED )
-DALI_PROPERTY( "inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION )
-DALI_PROPERTY( "inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE )
-DALI_PROPERTY( "colorMode", STRING, true, false, false, Dali::Actor::Property::COLOR_MODE )
-DALI_PROPERTY( "positionInheritance", STRING, true, false, false, Dali::Actor::Property::POSITION_INHERITANCE )
-DALI_PROPERTY( "drawMode", STRING, true, false, false, Dali::Actor::Property::DRAW_MODE )
-DALI_PROPERTY( "sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR )
-DALI_PROPERTY( "widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY )
-DALI_PROPERTY( "heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY )
-DALI_PROPERTY( "sizeScalePolicy", STRING, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY )
-DALI_PROPERTY( "widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT )
-DALI_PROPERTY( "heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH )
-DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING )
-DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE )
-DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE )
-DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION )
-DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE )
-DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER )
-DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY )
+DALI_PROPERTY( "parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN )
+DALI_PROPERTY( "parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X )
+DALI_PROPERTY( "parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y )
+DALI_PROPERTY( "parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z )
+DALI_PROPERTY( "anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT )
+DALI_PROPERTY( "anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X )
+DALI_PROPERTY( "anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y )
+DALI_PROPERTY( "anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z )
+DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE )
+DALI_PROPERTY( "sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH )
+DALI_PROPERTY( "sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT )
+DALI_PROPERTY( "sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH )
+DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION )
+DALI_PROPERTY( "positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X )
+DALI_PROPERTY( "positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y )
+DALI_PROPERTY( "positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z )
+DALI_PROPERTY( "worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION )
+DALI_PROPERTY( "worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X )
+DALI_PROPERTY( "worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y )
+DALI_PROPERTY( "worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z )
+DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION )
+DALI_PROPERTY( "worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION )
+DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE )
+DALI_PROPERTY( "scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X )
+DALI_PROPERTY( "scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y )
+DALI_PROPERTY( "scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z )
+DALI_PROPERTY( "worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE )
+DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE )
+DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR )
+DALI_PROPERTY( "colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED )
+DALI_PROPERTY( "colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN )
+DALI_PROPERTY( "colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE )
+DALI_PROPERTY( "colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA )
+DALI_PROPERTY( "worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR )
+DALI_PROPERTY( "worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX )
+DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME )
+DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE )
+DALI_PROPERTY( "leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED )
+DALI_PROPERTY( "inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION )
+DALI_PROPERTY( "inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE )
+DALI_PROPERTY( "colorMode", STRING, true, false, false, Dali::Actor::Property::COLOR_MODE )
+DALI_PROPERTY( "positionInheritance", STRING, true, false, false, Dali::Actor::Property::POSITION_INHERITANCE )
+DALI_PROPERTY( "drawMode", STRING, true, false, false, Dali::Actor::Property::DRAW_MODE )
+DALI_PROPERTY( "sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR )
+DALI_PROPERTY( "widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY )
+DALI_PROPERTY( "heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY )
+DALI_PROPERTY( "sizeScalePolicy", STRING, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY )
+DALI_PROPERTY( "widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT )
+DALI_PROPERTY( "heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH )
+DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING )
+DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE )
+DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE )
+DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION )
+DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE )
+DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER )
+DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY )
+DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
+DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
return Vector3::ZERO;
}
+const Vector2 Actor::GetCurrentScreenPosition() const
+{
+ if( OnStage() && NULL != mNode )
+ {
+ StagePtr stage = Stage::GetCurrent();
+ Vector3 worldPosition = mNode->GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+ Vector3 actorSize = GetCurrentSize() * GetCurrentScale();
+ Vector2 halfStageSize( stage->GetSize() * 0.5f ); // World position origin is center of stage
+ Vector3 halfActorSize( actorSize * 0.5f );
+ // Anchor point offset first set to TOP_LEFT (0,0.5) then moved to required anchor point.
+ Vector3 anchorPointOffSet = halfActorSize - actorSize * GetCurrentAnchorPoint();
+
+ return Vector2( halfStageSize.width + worldPosition.x - anchorPointOffSet.x,
+ halfStageSize.height + worldPosition.y - anchorPointOffSet.y );
+ }
+
+ return Vector2::ZERO;
+}
+
void Actor::SetPositionInheritanceMode( PositionInheritanceMode mode )
{
// this flag is not animatable so keep the value
mInheritPosition( true ),
mInheritOrientation( true ),
mInheritScale( true ),
+ mPositionUsesAnchorPoint( true ),
mDrawMode( DrawMode::NORMAL ),
mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
mColorMode( Node::DEFAULT_COLOR_MODE ),
{
if( static_cast<unsigned int>(value) != mSiblingOrder )
{
- mSiblingOrder = value;
- if( mIsOnStage )
- {
- SetDepthIndexMessage( GetEventThreadServices(), *mNode, GetDepthIndex( mDepth, mSiblingOrder ) );
- }
+ SetSiblingOrder( value );
}
}
break;
break;
}
+ case Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT:
+ {
+ bool value = false;
+ if( property.Get( value ) && value != mPositionUsesAnchorPoint )
+ {
+ mPositionUsesAnchorPoint = value;
+ if( NULL != mNode )
+ {
+ SetPositionUsesAnchorPointMessage( GetEventThreadServices(), *mNode, mPositionUsesAnchorPoint );
+ }
+ }
+ break;
+ }
+
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
value = mClippingMode;
break;
}
+
+ case Dali::DevelActor::Property::SCREEN_POSITION:
+ {
+ value = GetCurrentScreenPosition();
+ break;
+ }
+
+ case Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT:
+ {
+ value = mPositionUsesAnchorPoint;
+ break;
+ }
}
return value;
return mParent;
}
+void Actor::SetSiblingOrder( unsigned int order )
+{
+ mSiblingOrder = std::min( order, static_cast<unsigned int>( DevelLayer::SIBLING_ORDER_MULTIPLIER ) );
+ if( mIsOnStage )
+ {
+ SetDepthIndexMessage( GetEventThreadServices(), *mNode, GetDepthIndex( mDepth, mSiblingOrder ) );
+ }
+}
+
+void Actor::DefragmentSiblingIndexes( ActorContainer& siblings )
+{
+ // Sibling index may not be in consecutive order as the sibling range is limited ( DevelLayer::SIBLING_ORDER_MULTIPLIER )
+ // we need to remove the gaps and ensure the number start from 0 and consecutive hence have a full range.
+
+ // Start at index 0, while index <= highest order
+ // Find next index higher than 0
+ // if nextHigher > index+1
+ // set all nextHigher orders to index+1
+
+ // Limitation: May reach the ceiling of DevelLayer::SIBLING_ORDER_MULTIPLIER with highest sibling.
+
+ ActorIter end = siblings.end();
+ int highestOrder = 0;
+ for( ActorIter iter = siblings.begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ int siblingOrder = sibling->mSiblingOrder;
+ highestOrder = std::max( highestOrder, siblingOrder );
+ }
+
+ for ( int index = 0; index <= highestOrder; index++ )
+ {
+ int nextHighest = -1;
+
+ // Find Next highest
+ for( ActorIter iter = siblings.begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ int siblingOrder = sibling->mSiblingOrder;
+
+ if ( siblingOrder > index )
+ {
+ if ( nextHighest == -1 )
+ {
+ nextHighest = siblingOrder;
+ }
+ nextHighest = std::min( nextHighest, siblingOrder );
+ }
+ }
+
+ // Check if a gap exists between indexes, if so set next index to consecutive number
+ if ( ( nextHighest - index ) > 1 )
+ {
+ for( ActorIter iter = siblings.begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ int siblingOrder = sibling->mSiblingOrder;
+ if ( siblingOrder == nextHighest )
+ {
+ sibling->mSiblingOrder = index + 1;
+ if ( sibling->mSiblingOrder >= Dali::DevelLayer::SIBLING_ORDER_MULTIPLIER )
+ {
+ DALI_LOG_WARNING( "Reached max sibling order level for raising / lowering actors\n" );
+ sibling->mSiblingOrder = Dali::DevelLayer::SIBLING_ORDER_MULTIPLIER;
+ }
+ sibling->SetSiblingOrder( sibling->mSiblingOrder );
+ }
+ }
+ }
+ }
+}
+
+bool Actor::ShiftSiblingsLevels( ActorContainer& siblings, int targetLevelToShiftFrom )
+{
+ // Allows exclusive levels for an actor by shifting all sibling levels at the target and above by 1
+ bool defragmentationRequired( false );
+ ActorIter end = siblings.end();
+ for( ActorIter iter = siblings.begin(); ( iter != end ) ; ++iter )
+ {
+ // Move actors at nearest order and above up by 1
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ // Iterate through container of actors, any actor with a sibling order of the target or greater should
+ // be incremented by 1.
+ if ( sibling->mSiblingOrder >= targetLevelToShiftFrom )
+ {
+ sibling->mSiblingOrder++;
+ if ( sibling->mSiblingOrder + 1 >= DevelLayer::SIBLING_ORDER_MULTIPLIER )
+ {
+ // If a sibling order raises so that it is only 1 from the maximum allowed then set flag so
+ // can re-order all sibling orders.
+ defragmentationRequired = true;
+ }
+ sibling->SetSiblingOrder( sibling->mSiblingOrder );
+ }
+ }
+ }
+ return defragmentationRequired;
+}
+
+void Actor::Raise()
+{
+ /*
+ 1) Check if already at top and nothing to be done.
+ This Actor can have highest sibling order but if not exclusive then another actor at same sibling
+ order can be positioned above it due to insertion order of actors.
+ 2) Find nearest sibling level above, these are the siblings this actor needs to be above
+ 3) a) There may be other levels above this target level
+ b) Increment all sibling levels at the level above nearest(target)
+ c) Now have a vacant sibling level
+ 4) Set this actor's sibling level to nearest +1 as now vacated.
+
+ Note May not just be sibling level + 1 as could be empty levels in-between
+
+ Example:
+
+ 1 ) Initial order
+ ActorC ( sibling level 4 )
+ ActorB ( sibling level 3 )
+ ActorA ( sibling level 1 )
+
+ 2 ) ACTION: Raise A above B
+ a) Find nearest level above A = Level 3
+ b) Increment levels above Level 3
+
+ ActorC ( sibling level 5 )
+ ActorB ( sibling level 3 ) NEAREST
+ ActorA ( sibling level 1 )
+
+ 3 ) Set Actor A sibling level to nearest +1 as vacant
+
+ ActorC ( sibling level 5 )
+ ActorA ( sibling level 4 )
+ ActorB ( sibling level 3 )
+
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+ if ( mParent )
+ {
+ int nearestLevel = mSiblingOrder;
+ int shortestDistanceToNextLevel = DevelLayer::SIBLING_ORDER_MULTIPLIER;
+ bool defragmentationRequired( false );
+
+ ActorContainer* siblings = mParent->mChildren;
+
+ // Find Nearest sibling level above this actor
+ ActorIter end = siblings->end();
+ for( ActorIter iter = siblings->begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ int order = GetSiblingOrder( sibling );
+
+ if ( ( order >= mSiblingOrder ) )
+ {
+ int distanceToNextLevel = order - mSiblingOrder;
+ if ( distanceToNextLevel < shortestDistanceToNextLevel )
+ {
+ nearestLevel = order;
+ shortestDistanceToNextLevel = distanceToNextLevel;
+ }
+ }
+ }
+ }
+
+ if ( nearestLevel < DevelLayer::SIBLING_ORDER_MULTIPLIER ) // Actor is not already exclusively at top
+ {
+ mSiblingOrder = nearestLevel + 1; // Set sibling level to that above the nearest level
+ defragmentationRequired = ShiftSiblingsLevels( *siblings, mSiblingOrder );
+ // Move current actor to newly vacated order level
+ SetSiblingOrder( mSiblingOrder );
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *siblings );
+ }
+ }
+ SetSiblingOrder( mSiblingOrder );
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
+void Actor::Lower()
+{
+ /**
+ 1) Check if actor already at bottom and if nothing needs to be done
+ This Actor can have lowest sibling order but if not exclusive then another actor at same sibling
+ order can be positioned above it due to insertion order of actors so need to move this actor below it.
+ 2) Find nearest sibling level below, this Actor needs to be below it
+ 3) a) Need to vacate a sibling level below nearest for this actor to occupy
+ b) Shift up all sibling order values of actor at the nearest level and levels above it to vacate a level.
+ c) Set this actor's sibling level to this newly vacated level.
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+
+ if ( mParent )
+ {
+ // 1) Find nearest level below
+ int nearestLevel = mSiblingOrder;
+ int shortestDistanceToNextLevel = DevelLayer::SIBLING_ORDER_MULTIPLIER;
+
+ ActorContainer* siblings = mParent->mChildren;
+
+ ActorIter end = siblings->end();
+ for( ActorIter iter = siblings->begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ int order = GetSiblingOrder( sibling );
+
+ if ( order <= mSiblingOrder )
+ {
+ int distanceToNextLevel = mSiblingOrder - order;
+ if ( distanceToNextLevel < shortestDistanceToNextLevel )
+ {
+ nearestLevel = order;
+ shortestDistanceToNextLevel = distanceToNextLevel;
+ }
+ }
+ }
+ }
+
+ bool defragmentationRequired ( false );
+
+ // 2) If actor already not at bottom, raise all actors at required level and above
+ if ( shortestDistanceToNextLevel < DevelLayer::SIBLING_ORDER_MULTIPLIER ) // Actor is not already exclusively at bottom
+ {
+ mSiblingOrder = nearestLevel;
+ defragmentationRequired = ShiftSiblingsLevels( *siblings, mSiblingOrder );
+ // Move current actor to newly vacated order
+ SetSiblingOrder( mSiblingOrder );
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *siblings );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
+void Actor::RaiseToTop()
+{
+ /**
+ 1 ) Find highest sibling order actor
+ 2 ) If highest sibling level not itself then set sibling order to that + 1
+ 3 ) highest sibling order can be same as itself so need to increment over that
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+
+ if ( mParent )
+ {
+ int maxOrder = 0;
+
+ ActorContainer* siblings = mParent->mChildren;
+
+ ActorIter end = siblings->end();
+ for( ActorIter iter = siblings->begin(); iter != end; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ maxOrder = std::max( GetSiblingOrder( sibling ), maxOrder );
+ }
+ }
+
+ bool defragmentationRequired( false );
+
+ if ( maxOrder >= mSiblingOrder )
+ {
+ mSiblingOrder = maxOrder + 1;
+ if ( mSiblingOrder + 1 >= DevelLayer::SIBLING_ORDER_MULTIPLIER )
+ {
+ defragmentationRequired = true;
+ }
+ }
+
+ SetSiblingOrder( mSiblingOrder );
+
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *siblings );
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
+void Actor::LowerToBottom()
+{
+ /**
+ See Actor::LowerToBottom()
+
+ 1 ) Check if this actor already at exclusively at the bottom, if so then no more to be done.
+ 2 ) a ) Check if the bottom position 0 is vacant.
+ b ) If 0 position is not vacant then shift up all sibling order values from 0 and above
+ c ) 0 sibling position is vacant.
+ 3 ) Set this actor to vacant sibling order 0;
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+
+ if ( mParent )
+ {
+ bool defragmentationRequired( false );
+ bool orderZeroFree ( true );
+
+ ActorContainer* siblings = mParent->mChildren;
+
+ bool actorAtLowestOrder = true;
+ ActorIter end = siblings->end();
+ for( ActorIter iter = siblings->begin(); ( iter != end ) ; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ int siblingOrder = GetSiblingOrder( sibling );
+ if ( siblingOrder <= mSiblingOrder )
+ {
+ actorAtLowestOrder = false;
+ }
+
+ if ( siblingOrder == 0 )
+ {
+ orderZeroFree = false;
+ }
+ }
+ }
+
+ if ( ! actorAtLowestOrder )
+ {
+ if ( ! orderZeroFree )
+ {
+ defragmentationRequired = ShiftSiblingsLevels( *siblings, 0 );
+ }
+ mSiblingOrder = 0;
+ SetSiblingOrder( mSiblingOrder );
+
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *siblings );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
+void Actor::RaiseAbove( Internal::Actor& target )
+{
+ /**
+ 1 ) a) Find target actor's sibling order
+ b) If sibling order of target is the same as this actor then need to this Actor's sibling order
+ needs to be above it or the insertion order will determine which is drawn on top.
+ 2 ) Shift up by 1 all sibling order greater than target sibling order
+ 3 ) Set this actor to the sibling order to target +1 as will be a newly vacated gap above
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+
+ if ( mParent )
+ {
+ if ( ValidateActors( *this, target ) )
+ {
+ // Find target's sibling order
+ // Set actor sibling order to this number +1
+ int targetSiblingOrder = GetSiblingOrder( &target );
+ ActorContainer* siblings = mParent->mChildren;
+ mSiblingOrder = targetSiblingOrder + 1;
+ bool defragmentationRequired = ShiftSiblingsLevels( *siblings, mSiblingOrder );
+
+ SetSiblingOrder( mSiblingOrder );
+
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *(mParent->mChildren) );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
+void Actor::LowerBelow( Internal::Actor& target )
+{
+ /**
+ 1 ) a) Find target actor's sibling order
+ b) If sibling order of target is the same as this actor then need to this Actor's sibling order
+ needs to be below it or the insertion order will determine which is drawn on top.
+ 2 ) Shift the target sibling order and all sibling orders at that level or above by 1
+ 3 ) Set this actor to the sibling order of the target before it changed.
+ 4 ) Sibling order levels have a maximum defined in DevelLayer::SIBLING_ORDER_MULTIPLIER
+ If shifting causes this ceiling to be reached. then a defragmentation can be performed to
+ remove any empty sibling order gaps and start from sibling level 0 again.
+ If the number of actors reaches this maximum and all using exclusive sibling order values then
+ defragmention will stop and new sibling orders will be set to same max value.
+ */
+
+ if ( mParent )
+ {
+ if ( ValidateActors( *this, target ) )
+ {
+ bool defragmentationRequired ( false );
+ // Find target's sibling order
+ // Set actor sibling order to target sibling order - 1
+ int targetSiblingOrder = GetSiblingOrder( &target);
+ ActorContainer* siblings = mParent->mChildren;
+ if ( targetSiblingOrder == 0 )
+ {
+ //lower to botton
+ ActorIter end = siblings->end();
+ for( ActorIter iter = siblings->begin(); ( iter != end ) ; ++iter )
+ {
+ ActorPtr sibling = (*iter);
+ if ( sibling != this )
+ {
+ sibling->mSiblingOrder++;
+ if ( sibling->mSiblingOrder + 1 >= DevelLayer::SIBLING_ORDER_MULTIPLIER )
+ {
+ defragmentationRequired = true;
+ }
+ sibling->SetSiblingOrder( sibling->mSiblingOrder );
+ }
+ }
+ mSiblingOrder = 0;
+ }
+ else
+ {
+ defragmentationRequired = ShiftSiblingsLevels( *siblings, targetSiblingOrder );
+
+ mSiblingOrder = targetSiblingOrder;
+ }
+ SetSiblingOrder( mSiblingOrder );
+
+ if ( defragmentationRequired )
+ {
+ DefragmentSiblingIndexes( *(mParent->mChildren) );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
+ }
+}
+
} // namespace Internal
} // namespace Dali
#define DALI_INTERNAL_ACTOR_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
*/
virtual int GetPropertyComponentIndex( Property::Index index ) const;
+ /**
+ * @copydoc Dali::DevelActor::Raise()
+ */
+ void Raise();
+
+ /**
+ * @copydoc Dali::DevelActor::Lower()
+ */
+ void Lower();
+
+ /**
+ * @copydoc Dali::DevelActor::RaiseToTop()
+ */
+ void RaiseToTop();
+
+ /**
+ * @copydoc Dali::DevelActor::LowerToBottom()
+ */
+ void LowerToBottom();
+
+ /**
+ * @copydoc Dali::DevelActor::RaiseAbove()
+ */
+ void RaiseAbove( Internal::Actor& target );
+
+ /**
+ * @copydoc Dali::DevelActor::LowerBelow()
+ */
+ void LowerBelow( Internal::Actor& target );
+
private:
// Undefined
*/
virtual Object* GetParentObject() const;
+ /**
+ * Set Sibling order
+ * @param[in] order The sibling order this Actor should be
+ */
+ void SetSiblingOrder( unsigned int order);
+
+ /**
+ * @brief Re-orders the sibling order when any actor raised to the max level
+ * @param[in] siblings the container of sibling actors
+ */
+ void DefragmentSiblingIndexes( ActorContainer& siblings );
+
+ /**
+ * @brief Shifts all siblings levels from the target level up by 1 to make space for a newly insert sibling
+ * at an exclusive level.
+ *
+ * @note Used with Raise and Lower API
+ *
+ * @param[in] siblings the actor container of the siblings
+ * @param[in] targetLevelToShiftFrom the sibling level to start shifting from
+ */
+ bool ShiftSiblingsLevels( ActorContainer& siblings, int targetLevelToShiftFrom );
+
+
+ /**
+ * @brief Get the current position of the actor in screen coordinates.
+ *
+ * @return Returns the screen position of actor
+ */
+ const Vector2 GetCurrentScreenPosition() const;
+
protected:
Actor* mParent; ///< Each actor (except the root) can have one parent
bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
+ bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
void PropertyBuffer::SetData( const void* data, std::size_t size )
{
- DALI_ASSERT_DEBUG( mFormat.Count() && "Format must be set before setting the data." );
+ mSize = size; // size is the number of elements
- mSize = size;
+ unsigned int bufferSize = mBufferFormatSize * mSize;
- // Check if format and size have been set yet
- if( mBufferFormat != NULL )
- {
- unsigned int bufferSize = mBufferFormat->size * mSize;
- mBuffer.Resize( bufferSize );
- }
+ // create a new DALi vector to store the buffer data
+ // the heap allocated vector will end up being owned by Render::PropertyBuffer
+ Dali::Vector<char>* bufferCopy = new Dali::Vector<char>();
+ bufferCopy->Resize( bufferSize );
+ // copy the data
const char* source = static_cast<const char*>( data );
- std::copy( source, source + mBuffer.Size(), &mBuffer[0] );
+ char *destination = &((*bufferCopy)[0]);
+ std::copy( source, source + bufferSize, destination );
- SceneGraph::SetPropertyBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, new Dali::Vector<char>( mBuffer ), mSize );
+ // Ownership of the bufferCopy is passed to the message ( uses an owner pointer )
+ SceneGraph::SetPropertyBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, bufferCopy, mSize );
}
std::size_t PropertyBuffer::GetSize() const
PropertyBuffer::PropertyBuffer()
: mEventThreadServices( *Stage::GetCurrent() ),
mRenderObject( NULL ),
- mBufferFormat( NULL ),
+ mBufferFormatSize( 0 ),
mSize( 0 )
{
}
mRenderObject = new Render::PropertyBuffer();
SceneGraph::AddPropertyBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject );
- mFormat = formatMap;
-
- size_t numComponents = mFormat.Count();
+ size_t numComponents = formatMap.Count();
// Create the format
- DALI_ASSERT_DEBUG( mBufferFormat == NULL && "PropertyFormat should not be set yet" );
Render::PropertyBuffer::Format* format = new Render::PropertyBuffer::Format();
format->components.resize( numComponents );
for( size_t i = 0u; i < numComponents; ++i )
{
- KeyValuePair component = mFormat.GetKeyValue( i );
+ KeyValuePair component = formatMap.GetKeyValue( i );
// Get the name
if(component.first.type == Property::Key::INDEX)
// Set the format size
format->size = currentAlignment;
- mBufferFormat = format;
+ mBufferFormatSize = format->size;
SceneGraph::SetPropertyBufferFormat(mEventThreadServices.GetUpdateManager(), *mRenderObject, format );
}
private: // data
EventThreadServices& mEventThreadServices; ///<Used to send messages to the render thread via update thread
- Render::PropertyBuffer* mRenderObject; ///<Render side object
-
- Property::Map mFormat; ///< Format of the property buffer
- const Render::PropertyBuffer::Format* mBufferFormat; ///< Metadata for the format of the property buffer
+ Render::PropertyBuffer* mRenderObject; ///<Render side object
+ unsigned int mBufferFormatSize;
unsigned int mSize; ///< Number of elements in the buffer
- Dali::Vector< char > mBuffer; // Data of the property-buffer
};
/**
return mCore->GetNotificationManager();
}
-ResourceManager& ThreadLocalStorage::GetResourceManager()
-{
- return mCore->GetResourceManager();
-}
-
ShaderFactory& ThreadLocalStorage::GetShaderFactory()
{
return mCore->GetShaderFactory();
class Core;
class NotificationManager;
-class ResourceManager;
class ShaderFactory;
class GestureEventProcessor;
class RelayoutController;
NotificationManager& GetNotificationManager();
/**
- * Returns the Resource Manager
- * @return reference to the Resource Manager
- */
- ResourceManager& GetResourceManager();
-
- /**
* Returns the Shader Factory
* @return reference to the Shader Factory
*/
{
if ( !mTexture )
{
- mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, mPixelFormat, mWidth, mHeight );
+ mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, mPixelFormat, mWidth, mHeight );
}
DALI_ASSERT_DEBUG( updateArea.x + updateArea.width <= mWidth && updateArea.y + updateArea.height <= mHeight );
UploadArea( updateArea );
class BufferImage;
typedef IntrusivePtr<BufferImage> BufferImagePtr;
-class ResourceManager;
-
/**
* BufferImage represents an image resource that can be added to actors etc.
* Its pixel buffer data is provided by the application developer.
// INTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
+#include <dali/devel-api/common/ref-counted-dali-vector.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/integration-api/platform-abstraction.h>
namespace
{
+
TypeRegistration mType( typeid( Dali::EncodedBufferImage ), typeid( Dali::Image ), NULL );
+
+/** Raw bytes of a resource laid out exactly as it would be in a file, but in memory. */
+typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
+/** Counting smart pointer for managing a buffer of raw bytes. */
+typedef IntrusivePtr<RequestBuffer> RequestBufferPtr;
+
} // unnamed namespace
EncodedBufferImagePtr EncodedBufferImage::New( const uint8_t * const encodedImage,
//Create texture
Pixel::Format format = bitmap->GetPixelFormat();
- image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
+ image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
//Upload data to the texture
size_t bufferSize = bitmap->GetBufferSize();
}
else
{
- image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
+ image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
image->mWidth = image->mHeight = 0u;
}
class EncodedBufferImage;
typedef IntrusivePtr<EncodedBufferImage> EncodedBufferImagePtr;
-class ResourceManager;
-
namespace SceneGraph
{
class UpdateManager;
FrameBufferImagePtr image = new FrameBufferImage( width, height );
image->Initialize();
- image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
+ image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
image->mFrameBufferObject = FrameBuffer::New( width, height, RenderBufferFormatToFrameBufferAttachments[bufferformat] );
image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
image->Initialize();
- image->mTexture = NewTexture::New( nativeImage );
+ image->mTexture = Texture::New( nativeImage );
image->mFrameBufferObject = FrameBuffer::New( image->mTexture->GetWidth(), image->mTexture->GetHeight(), Dali::FrameBuffer::Attachment::NONE );
image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
#include <dali/public-api/object/type-registry.h>
#include <dali/integration-api/debug.h>
-#include <dali/internal/event/resources/resource-ticket.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/stage-impl.h>
bool Image::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
- DALI_ASSERT_DEBUG( dynamic_cast<Image*>( object ) && "Resource ticket not ImageTicket subclass for image resource.\n" );
+ DALI_ASSERT_DEBUG( dynamic_cast<Image*>( object ) && "Failed to downcast from BaseObject to Image.\n" );
Image* image = static_cast<Image*>(object);
if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_UPLOADED ) )
return connected;
}
-ResourceId Image::GetResourceId() const
-{
- ResourceId ret = mTicket ? mTicket->GetId() : 0;
-
- return ret;
-}
-
-void Image::ResourceLoadingFailed(const ResourceTicket& ticket)
-{
- // do nothing
-}
-
-void Image::ResourceLoadingSucceeded(const ResourceTicket& ticket)
-{
- // do nothing
-}
-
-void Image::ResourceUploaded(const ResourceTicket& ticket)
-{
- mUploaded.Emit( Dali::Image( this ) );
-}
-
unsigned int Image::GetWidth() const
{
return mWidth;
Image::~Image()
{
- if( mTicket )
- {
- mTicket->RemoveObserver( *this );
- mTicket.Reset();
- }
-
if( Stage::IsInstalled() )
{
UnregisterObject();
#include <dali/public-api/images/image.h>
#include <dali/public-api/object/base-object.h>
#include <dali/internal/event/rendering/texture-impl.h>
-#include <dali/internal/event/resources/resource-client-declarations.h>
-#include <dali/internal/event/resources/resource-ticket-observer.h>
namespace Dali
{
* When the Image object is created, resource loading will be attempted.
* Provided this is successful, the resource will exist until the Image is destroyed.
*/
-class Image : public BaseObject, public ResourceTicketObserver
+class Image : public BaseObject
{
public:
static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
/**
- * returns the Id used for lookups
- * @note if LoadPolicy::OnDemand is used and Image is off Stage, this will return 0.
- * @return the unique ID of the image data resource. This is actually also the same as Dali Texture id.
- */
- ResourceId GetResourceId() const;
-
- /**
* Get the width of the image.
* Only to be used after the image has finished loading.
* (Ticket's LoadingSucceeded callback was called)
/**
* Returns a pointer to the internal texture used by the image
*/
- NewTexture* GetTexture() const
+ Texture* GetTexture() const
{
return mTexture.Get();
}
-public: // From ResourceTicketObserver
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceLoadingFailed()
- */
- virtual void ResourceLoadingFailed(const ResourceTicket& ticket);
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceLoadingSucceeded()
- */
- virtual void ResourceLoadingSucceeded(const ResourceTicket& ticket);
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceUploaded()
- */
- virtual void ResourceUploaded(const ResourceTicket& ticket);
-
public:
/**
protected:
- ResourceTicketPtr mTicket; ///< smart pointer to the ticket object that gets completed when load finishes
- NewTexturePtr mTexture; ///< smart pointer to the texture used by the image
+ TexturePtr mTexture; ///< smart pointer to the texture used by the image
unsigned int mWidth; ///< natural width of the image
unsigned int mHeight; ///< natural height of the image
image->mWidth = resourceData.GetWidth();
image->mHeight = resourceData.GetHeight();
- image->mTexture = NewTexture::New( resourceData );
+ image->mTexture = Texture::New( resourceData );
return image;
}
#include <dali/internal/update/manager/update-manager.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/integration-api/resource-types.h>
-#include <dali/integration-api/resource-cache.h>
namespace
mWidth = mBitmap->GetImageWidth();
mHeight = mBitmap->GetImageHeight();
- mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, mBitmap->GetPixelFormat(), mWidth, mHeight );
+ mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, mBitmap->GetPixelFormat(), mWidth, mHeight );
size_t bufferSize = mBitmap->GetBufferSize();
unsigned char* buffer = new unsigned char[bufferSize];
class NinePatchImage;
typedef IntrusivePtr<NinePatchImage> NinePatchImagePtr;
-class ResourceManager;
-
namespace SceneGraph
{
class UpdateManager;
bool ResourceImage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
- DALI_ASSERT_DEBUG( dynamic_cast<ResourceImage*>( object ) && "Resource ticket not ImageTicket subclass for image resource.\n" );
+ DALI_ASSERT_DEBUG( dynamic_cast<ResourceImage*>( object ) && "Failed to downcast from BaseObject to ResourceImage.\n" );
ResourceImage* image = static_cast<ResourceImage*>(object);
if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_LOADING_FINISHED ) )
//Create texture
Pixel::Format format = bitmap->GetPixelFormat();
- mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
+ mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
//Upload data to the texture
size_t bufferSize = bitmap->GetBufferSize();
}
else
{
- mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
+ mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
mWidth = mHeight = 0u;
mLoadingState = Dali::ResourceLoadingFailed;
}
AddFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject );
}
-void FrameBuffer::AttachColorTexture( NewTexturePtr texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( TexturePtr texture, unsigned int mipmapLevel, unsigned int layer )
{
if( (unsigned int)( texture->GetWidth() / ( 1 << mipmapLevel ) ) == mWidth &&
(unsigned int)( texture->GetHeight() / ( 1 << mipmapLevel ) ) == mHeight )
}
}
-NewTexture* FrameBuffer::GetColorTexture()
+Texture* FrameBuffer::GetColorTexture()
{
return mColor.Get();
}
/**
* @copydoc Dali::FrameBuffer::AttachColorTexture()
*/
- void AttachColorTexture( NewTexturePtr texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTexture( TexturePtr texture, unsigned int mipmapLevel, unsigned int layer );
/**
* @copydoc Dali::FrameBuffer::GetColorTexture()
*/
- NewTexture* GetColorTexture();
+ Texture* GetColorTexture();
private: // implementation
Internal::EventThreadServices& mEventThreadServices; ///< Used to send messages to the render thread via update thread
Internal::Render::FrameBuffer* mRenderObject; ///< The Render::Texture associated to this texture
- NewTexturePtr mColor;
+ TexturePtr mColor;
unsigned int mWidth;
unsigned int mHeight;
unsigned int mAttachments; ///< Bit-mask of type FrameBuffer::Attachment::Mask
#include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/effects/shader-factory.h>
-#include <dali/internal/event/resources/resource-ticket.h>
#include <dali/internal/update/manager/update-manager.h>
namespace Dali
#include <dali/public-api/rendering/shader.h> // Dali::Shader
#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
#include <dali/internal/common/shader-data.h> // ShaderPtr
namespace Dali
namespace Internal
{
-NewTexturePtr NewTexture::New(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
+TexturePtr Texture::New(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
{
- NewTexturePtr texture( new NewTexture( type, format, width, height ) );
+ TexturePtr texture( new Texture( type, format, width, height ) );
texture->Initialize();
return texture;
}
-NewTexturePtr NewTexture::New( NativeImageInterface& nativeImageInterface )
+TexturePtr Texture::New( NativeImageInterface& nativeImageInterface )
{
- NewTexturePtr texture( new NewTexture( &nativeImageInterface ) );
+ TexturePtr texture( new Texture( &nativeImageInterface ) );
texture->Initialize();
return texture;
}
-Render::NewTexture* NewTexture::GetRenderObject() const
+Render::Texture* Texture::GetRenderObject() const
{
return mRenderObject;
}
-NewTexture::NewTexture(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
+Texture::Texture(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
: mEventThreadServices( *Stage::GetCurrent() ),
mRenderObject( NULL ),
mNativeImage(),
{
}
-NewTexture::NewTexture( NativeImageInterfacePtr nativeImageInterface )
+Texture::Texture( NativeImageInterfacePtr nativeImageInterface )
: mEventThreadServices( *Stage::GetCurrent() ),
mRenderObject( NULL ),
mNativeImage( nativeImageInterface ),
{
}
-void NewTexture::Initialize()
+void Texture::Initialize()
{
if( EventThreadServices::IsCoreRunning() )
{
if( mNativeImage )
{
- mRenderObject = new Render::NewTexture( mNativeImage );
+ mRenderObject = new Render::Texture( mNativeImage );
}
else
{
- mRenderObject = new Render::NewTexture( mType, mFormat, mWidth, mHeight );
+ mRenderObject = new Render::Texture( mType, mFormat, mWidth, mHeight );
}
AddTexture( mEventThreadServices.GetUpdateManager(), *mRenderObject );
}
}
-NewTexture::~NewTexture()
+Texture::~Texture()
{
if( EventThreadServices::IsCoreRunning() && mRenderObject )
{
}
}
-bool NewTexture::Upload( PixelDataPtr pixelData )
+bool Texture::Upload( PixelDataPtr pixelData )
{
return Upload( pixelData, 0u, 0u, 0u, 0u, pixelData->GetWidth(), pixelData->GetHeight() );
}
-bool NewTexture::Upload( PixelDataPtr pixelData,
+bool Texture::Upload( PixelDataPtr pixelData,
unsigned int layer, unsigned int mipmap,
unsigned int xOffset, unsigned int yOffset,
unsigned int width, unsigned int height )
return result;
}
-void NewTexture::GenerateMipmaps()
+void Texture::GenerateMipmaps()
{
if( EventThreadServices::IsCoreRunning() && mRenderObject )
{
}
}
-unsigned int NewTexture::GetWidth() const
+unsigned int Texture::GetWidth() const
{
return mWidth;
}
-unsigned int NewTexture::GetHeight() const
+unsigned int Texture::GetHeight() const
{
return mHeight;
}
{
namespace Render
{
-class NewTexture;
+class Texture;
}
-class NewTexture;
-typedef IntrusivePtr<NewTexture> NewTexturePtr;
+class Texture;
+typedef IntrusivePtr<Texture> TexturePtr;
-class NewTexture : public BaseObject
+class Texture : public BaseObject
{
public:
* @param[in] height The height of the texture
* @return A smart-pointer to the newly allocated Texture.
*/
- static NewTexturePtr New(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height);
+ static TexturePtr New(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height);
/**
* @brief Creates a new Texture from a native image
* @param[in] nativeImageInterface The native image
* @return A smart-pointer to the newly allocated Texture.
*/
- static NewTexturePtr New( NativeImageInterface& nativeImageInterface );
+ static TexturePtr New( NativeImageInterface& nativeImageInterface );
/**
* @brief Get the texture render object
*
* @return the texture render object
*/
- Render::NewTexture* GetRenderObject() const;
+ Render::Texture* GetRenderObject() const;
/**
* @copydoc Dali::Texture::Upload()
* @param[in] width The width of the texture
* @param[in] height The height of the texture
*/
- NewTexture(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height );
+ Texture(TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height );
/**
* Constructor from native image
* @param[in] nativeImageInterface The native image
*/
- NewTexture( NativeImageInterfacePtr nativeImageInterface );
+ Texture( NativeImageInterfacePtr nativeImageInterface );
/**
* Second stage initialization of the Texture
/**
* A reference counted object may only be deleted by calling Unreference()
*/
- virtual ~NewTexture();
+ virtual ~Texture();
private: // unimplemented methods
- NewTexture( const NewTexture& );
- NewTexture& operator=( const NewTexture& );
+ Texture( const Texture& );
+ Texture& operator=( const Texture& );
private: // data
Internal::EventThreadServices& mEventThreadServices; ///<Used to send messages to the render thread via update thread
- Internal::Render::NewTexture* mRenderObject; ///<The Render::Texture associated to this texture
+ Internal::Render::Texture* mRenderObject; ///<The Render::Texture associated to this texture
NativeImageInterfacePtr mNativeImage; ///< Pointer to native image
Dali::TextureType::Type mType; ///< Texture type (cached)
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Internal::NewTexture& GetImplementation(Dali::Texture& handle)
+inline Internal::Texture& GetImplementation(Dali::Texture& handle)
{
DALI_ASSERT_ALWAYS(handle && "Texture handle is empty");
BaseObject& object = handle.GetBaseObject();
- return static_cast<Internal::NewTexture&>(object);
+ return static_cast<Internal::Texture&>(object);
}
-inline const Internal::NewTexture& GetImplementation(const Dali::Texture& handle)
+inline const Internal::Texture& GetImplementation(const Dali::Texture& handle)
{
DALI_ASSERT_ALWAYS(handle && "Texture handle is empty");
const BaseObject& object = handle.GetBaseObject();
- return static_cast<const Internal::NewTexture&>(object);
+ return static_cast<const Internal::Texture&>(object);
}
} // namespace Dali
return textureSet;
}
-void TextureSet::SetTexture( size_t index, NewTexturePtr texture )
+void TextureSet::SetTexture( size_t index, TexturePtr texture )
{
- size_t textureCount( mNewTextures.size() );
+ size_t textureCount( mTextures.size() );
if( index >= textureCount )
{
- mNewTextures.resize(index + 1);
+ mTextures.resize(index + 1);
bool samplerExist = true;
if( mSamplers.size() < index + 1 )
for( size_t i(textureCount); i<=index; ++i )
{
- mNewTextures[i] = NULL;
+ mTextures[i] = NULL;
if( !samplerExist )
{
}
}
- mNewTextures[index]= texture;
+ mTextures[index]= texture;
- Render::NewTexture* renderTexture(0);
+ Render::Texture* renderTexture(0);
if( texture )
{
renderTexture = texture->GetRenderObject();
SceneGraph::SetTextureMessage( mEventThreadServices, *mSceneObject, index, renderTexture );
}
-NewTexture* TextureSet::GetTexture( size_t index ) const
+Texture* TextureSet::GetTexture( size_t index ) const
{
- NewTexture* result(0);
- if( index < mNewTextures.size() )
+ Texture* result(0);
+ if( index < mTextures.size() )
{
- result = mNewTextures[index].Get();
+ result = mTextures[index].Get();
}
else
{
size_t TextureSet::GetTextureCount() const
{
- return mNewTextures.size();
+ return mTextures.size();
}
const SceneGraph::TextureSet* TextureSet::GetTextureSetSceneObject() const
/**
* @copydoc Dali::TextureSet::SetTexture()
*/
- void SetTexture( size_t index, NewTexturePtr texture );
+ void SetTexture( size_t index, TexturePtr texture );
/**
* @copydoc Dali::TextureSet::GetTexture()
*/
- NewTexture* GetTexture( size_t index ) const;
+ Texture* GetTexture( size_t index ) const;
/**
* @copydoc Dali::TextureSet::SetSampler()
EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
SceneGraph::TextureSet* mSceneObject;
std::vector<SamplerPtr> mSamplers;
- std::vector<NewTexturePtr> mNewTextures;
+ std::vector<TexturePtr> mTextures;
};
} // namespace Internal
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/event/resources/image-ticket.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-ImageTicket::ImageTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath )
-: ResourceTicket( observer, id, typePath )
-{
-}
-
-int ImageTicket::GetWidth() const
-{
- return mAttributes.GetWidth();
-}
-
-int ImageTicket::GetHeight() const
-{
- return mAttributes.GetHeight();
-}
-
-} // namespace Internal
-
-} // namespace Dali
-
+++ /dev/null
-#ifndef __DALI_INTERNAL_IMAGE_TICKET_H__
-#define __DALI_INTERNAL_IMAGE_TICKET_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/resources/resource-ticket.h>
-#include <dali/public-api/images/image.h>
-#include <dali/internal/common/image-attributes.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-class ImageTicket;
-class ResourceManager;
-
-typedef IntrusivePtr<ImageTicket> ImageTicketPtr;
-
-/**
- * ImageTicket is essentially the same as a ResourceTicket,
- * except that it contains additional information about the loaded image resource.
- * The data is the result of the resource loading request.
- *
- * Multi-threading note: this class should be used in the main thread only
- * i.e. not from within Dali::Integration::Core::Render().
- */
-class ImageTicket : public ResourceTicket
-{
-public:
-
- /**
- * Create an image resource request.
- * This should only be done by the ResourceTicketRegistry.
- * @param [in] observer A resource ticket lifetime observer.
- * @param [in] id A unique ID for this ticket (loading request).
- * @param [in] typePath The resource Type & Path pair.
- */
- ImageTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath );
-
- /**
- * Get the attributes of an image.
- * Only to be used after the image has finished loading.
- * (Ticket's LoadingSucceeded callback was called)
- * Reflects the last cached values after a LoadComplete.
- * If requested width or height was 0, they are replaced by concrete dimensions.
- * @return a copy of the image attributes
- */
- const ImageAttributes& GetAttributes() const { return mAttributes;}
-
- /**
- * Get the width of an image.
- * Only to be used after the image has finished loading.
- * (Ticket's LoadingSucceeded callback was called)
- * Reflects the last cached values after a LoadComplete.
- * If requested width or height was 0, they are replaced by concrete dimensions.
- * @return the width
- */
- int GetWidth() const;
-
- /**
- * Get the height of an image.
- * Only to be used after the image has finished loading.
- * (Ticket's LoadingSucceeded callback was called)
- * Reflects the last cached values after a LoadComplete.
- * If requested width or height was 0, they are replaced by concrete dimensions.
- * @return the height
- */
- int GetHeight() const;
-
-protected:
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~ImageTicket()
- {
- }
-
-private:
-
- // Undefined copy constructor.
- ImageTicket(const ImageTicket& typePath);
-
- // Undefined copy constructor.
- ImageTicket& operator=(const ImageTicket& rhs);
-
-private:
-
- /**
- * Loaded Image attributes (width, height, pixelformat etc.).
- * Contains actual values only after the image has finished loading.
- * If requested width or height was 0, the natural size is used.
- */
- ImageAttributes mAttributes;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_IMAGE_TICKET_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_CLIENT_DECLARATIONS_H__
-#define __DALI_INTERNAL_RESOURCE_CLIENT_DECLARATIONS_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h> // for uint32_t
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/common/ref-counted-dali-vector.h>
-#include <dali/integration-api/resource-declarations.h>
-#include <dali/internal/common/type-abstraction.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-typedef Integration::ResourceId ResourceId;
-
-/** Raw bytes of a resource laid out exactly as it wouldbe in a file, but in memory. */
-typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
-/** Counting smart pointer for managing a buffer of raw bytes. */
-typedef IntrusivePtr<RequestBuffer> RequestBufferPtr;
-
-typedef Rect<unsigned int> RectArea;
-
-template <> struct ParameterType< Integration::LoadStatus >
-: public BasicType< Integration::LoadStatus > {};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_CLIENT_DECLARATIONS_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_TICKET_LIFETIME_OBSERVER_H__
-#define __DALI_INTERNAL_RESOURCE_TICKET_LIFETIME_OBSERVER_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class ResourceTicket;
-
-/**
- * The ResourceTicketLifetimeObserver observes the lifetime of resource tickets.
- */
-class ResourceTicketLifetimeObserver
-{
-public:
-
- /**
- * Called when a resource ticket is discarded.
- * This occurs during the ResourceTicket destructor.
- * @param[in] ticket The discarded ticket.
- */
- virtual void ResourceTicketDiscarded( const ResourceTicket& ticket ) = 0;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_TICKET_LIFETIME_OBSERVER_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_TICKET_OBSERVER_H__
-#define __DALI_INTERNAL_RESOURCE_TICKET_OBSERVER_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class ResourceTicket;
-
-typedef IntrusivePtr<ResourceTicket> ResourceTicketPtr;
-
-/**
- * ResourceTicketObserver is used to observe the status of resource loading requests.
- */
-class ResourceTicketObserver
-{
-public:
-
- /**
- * Called when a resource loads successfully.
- * @param[in] ticket The ticket for this resource.
- */
- virtual void ResourceLoadingSucceeded( const ResourceTicket& ticket ) = 0;
-
- /**
- * Called when a resource fails to load.
- * @param[in] ticket The ticket for this resource.
- */
- virtual void ResourceLoadingFailed( const ResourceTicket& ticket ) = 0;
-
- /**
- * Called when a resource is uploaded to graphics memory.
- * @param[in] ticket The ticket for this resource.
- */
- virtual void ResourceUploaded( const ResourceTicket& ticket ) = 0;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_TICKET_OBSERVER_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/event/resources/resource-ticket.h>
-
-// EXTERNAL INCLUDES
-#include <algorithm>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/images/image.h>
-#include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/event/resources/resource-ticket-observer.h>
-#include <dali/internal/event/resources/resource-ticket-lifetime-observer.h>
-
-namespace // unnamed namespace
-{
-
-// predicate for std::remove_if algorithm for compressing observer list
-bool isNULL(void* ptr)
-{
- return ptr == NULL;
-}
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-ResourceTicket::ResourceTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath )
-: mLifetimeObserver( &observer ),
- mId( id ),
- mTypePath( typePath ),
- mLoadingState( ResourceLoading )
-{
-}
-
-ResourceTicket::~ResourceTicket()
-{
- // Guard to allow handle destruction after Core has been destroyed
- if ( Stage::IsInstalled() &&
- mLifetimeObserver )
- {
- mLifetimeObserver->ResourceTicketDiscarded( *this );
- }
-}
-
-void ResourceTicket::AddObserver(ResourceTicketObserver& observer)
-{
- mObservers.push_back(&observer);
-}
-
-void ResourceTicket::RemoveObserver(ResourceTicketObserver& observer)
-{
- ObserverIter iter = find(mObservers.begin(), mObservers.end(), &observer);
- DALI_ASSERT_DEBUG( mObservers.end() != iter );
- if( mObservers.end() != iter )
- {
- (*iter) = NULL;
- }
-}
-
-void ResourceTicket::LoadingSucceeded()
-{
- DALI_ASSERT_DEBUG(mLoadingState == ResourceLoading);
-
- mLoadingState = ResourceLoadingSucceeded;
-
- // Using array operator as the call back out to application code might call back in
- // and corrupt the mObservers list. Presumption is the operator gets the current address
- // and adds an offset so a push_back() triggered reallocation should still work.
- size_t count = mObservers.size();
- for(size_t i = 0; i < count; i++)
- {
- if( mObservers[i] != NULL)
- {
- mObservers[i]->ResourceLoadingSucceeded(*this);
- }
- }
-
- // Move NULL pointers to the end...
- ObserverIter endIter = remove_if( mObservers.begin(), mObservers.end(), isNULL );
-
- // ...and remove them
- mObservers.erase( endIter, mObservers.end() );
-}
-
-void ResourceTicket::LoadingFailed()
-{
- DALI_ASSERT_DEBUG(mLoadingState == ResourceLoading);
-
- mLoadingState = ResourceLoadingFailed;
-
- // Using array operator as the call back out to application code might call back in
- // and corrupt the mObservers list. Presumption is the operator gets the current address
- // and adds an offset so a push_back() triggered reallocation should still work.
- size_t count = mObservers.size();
- for(size_t i = 0; i < count; i++)
- {
- if( mObservers[i] != NULL)
- {
- mObservers[i]->ResourceLoadingFailed(*this);
- }
- }
-
- // Move NULL pointers to the end...
- ObserverIter endIter = remove_if( mObservers.begin(), mObservers.end(), isNULL );
-
- // ...and remove them
- mObservers.erase( endIter, mObservers.end() );
-}
-
-void ResourceTicket::Loading()
-{
- mLoadingState = ResourceLoading;
-
- // Move NULL pointers to the end...
- ObserverIter endIter = remove_if( mObservers.begin(), mObservers.end(), isNULL );
-
- // ...and remove them
- mObservers.erase( endIter, mObservers.end() );
-}
-
-void ResourceTicket::Uploaded()
-{
- // Using array operator as the call back out to application code might call back in
- // and corrupt the mObservers list. Presumption is the operator gets the current address
- // and adds an offset so a push_back() triggered reallocation should still work.
- size_t count = mObservers.size();
- for(size_t i = 0; i < count; i++)
- {
- if( mObservers[i] != NULL)
- {
- mObservers[i]->ResourceUploaded(*this);
- }
- }
-
- // Move NULL pointers to the end...
- ObserverIter endIter = remove_if( mObservers.begin(), mObservers.end(), isNULL );
-
- // ...and remove them
- mObservers.erase( endIter, mObservers.end() );
-}
-
-void ResourceTicket::StopLifetimeObservation()
-{
- mLifetimeObserver = NULL;
-}
-
-} // namespace Internal
-
-} // namespace Dali
-
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_TICKET_H__
-#define __DALI_INTERNAL_RESOURCE_TICKET_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/devel-api/common/map-wrapper.h>
-#include <dali/public-api/common/loading-state.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/internal/event/resources/resource-type-path.h>
-#include <dali/integration-api/resource-cache.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class ResourceTicket;
-typedef IntrusivePtr<ResourceTicket> ResourceTicketPtr;
-typedef std::vector<ResourceTicketPtr> ResourceTicketContainer;
-
-class ResourceTicketObserver;
-class ResourceTicketLifetimeObserver;
-
-/**
- * @brief ResourceTicket records the lifetime of a resource loading request.
- *
- * When a resource is requested from ResourceClient, you get a ticket.
- * The state of the loading operation, can be observed using the ticket.
- * After the ticket is destroyed, the resource will be discarded.
- *
- * Multi-threading note: this class should be used in the main thread only
- * i.e. not from within Dali::Integration::Core::Render().
- */
-class ResourceTicket : public RefObject
-{
-public:
-
- /**
- * Create a resource request.
- * This should only be done by the ResourceTicketRegistry.
- * @param [in] observer The object which observes ticket lifetimes.
- * @param [in] id A unique ID for this ticket (loading request).
- * @param [in] typePath The resource Type & Path pair.
- */
- ResourceTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath );
-
- /**
- * Retrieve the unique ID of the resource request.
- * This can be shared with Nodes etc. which will require the resource when rendering.
- * @return The unique ID for this request.
- */
- unsigned int GetId() const { return mId; }
-
- /**
- * Retrieve the type and path of the resource request.
- * @return The type and path.
- */
- const ResourceTypePath& GetTypePath() const { return mTypePath; }
-
- /**
- * Query the state of the resource loading request.
- * @return The state.
- */
- Dali::LoadingState GetLoadingState() const { return mLoadingState; }
-
- /**
- * Adds an observer.
- * @param[in] observer The observer.
- */
- void AddObserver(ResourceTicketObserver& observer);
-
- /**
- * Removes an observer.
- * @param[in] observer The observer.
- */
- void RemoveObserver(ResourceTicketObserver& observer);
-
-public: // Used by the ResourceClient
-
- /**
- * Called when a resource loads successfully.
- * The ResourceTicketObservers will be notified.
- */
- void LoadingSucceeded();
-
- /**
- * Called when a resource fails to load.
- * The ResourceTicketObservers will be notified.
- */
- void LoadingFailed();
-
- /**
- * Reset state to ResourceLoading.
- */
- void Loading();
-
- /**
- * Notification when a resource has been uploaded to GL.
- * The ResourceTicketObservers will be notified.
- */
- void Uploaded();
-
- /**
- * Called when the ResourceTicketLifetimeObserver is being destroyed.
- * This method should only be called during destruction of the Dali core.
- */
- void StopLifetimeObservation();
-
-protected:
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~ResourceTicket();
-
-private:
-
- /**
- * Undefined copy constructor.
- */
- ResourceTicket(const ResourceTicket&);
-
- /**
- * Undefined assignment operator.
- */
- ResourceTicket& operator=(const ResourceTicket& rhs);
-
-private:
-
- ResourceTicketLifetimeObserver* mLifetimeObserver; ///< reference to the lifetime-observer; not owned
-
- unsigned int mId;
- ResourceTypePath mTypePath;
-
- Dali::LoadingState mLoadingState;
-
- // These ticket observers are not owned by the ticket.
- // Observers must remove themselves by calling RemoveObserver e.g. during destruction.
- typedef std::vector<ResourceTicketObserver*> ObserverContainer;
- typedef ObserverContainer::iterator ObserverIter;
-
- ObserverContainer mObservers;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_MANAGER_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/event/resources/resource-type-path.h>
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace
-{
-
-/**
- * @brief Compare two sets of image loading parameters for equality.
- */
-inline bool AttributesEqual( ImageDimensions aDims, FittingMode::Type aScaling, SamplingMode::Type aSampling, bool aOrient, ImageDimensions bDims, FittingMode::Type bScaling, SamplingMode::Type bSampling, bool bOrient )
-{
- return aDims == bDims &&
- aScaling == bScaling &&
- aSampling == bSampling &&
- aOrient == bOrient;
-}
-
-/**
- * @brief Compare two sets of image loading parameters
- * @pre The two sets are not identical.
- */
-inline bool AttributesLessAssumingNotEqual( ImageDimensions aDims, FittingMode::Type aScaling, SamplingMode::Type aSampling, bool aOrient, ImageDimensions bDims, FittingMode::Type bScaling, SamplingMode::Type bSampling, bool bOrient )
-{
- return aDims < bDims &&
- aScaling < bScaling &&
- aSampling < bSampling &&
- aOrient < bOrient;
-}
-
-/**
- * Compare two resource types.
- * @return zero if the types are equal,
- * less than zero if lhs < rhs or
- * greater than zero if lhs > rhs
- */
-int ResourceTypeCompare(const ResourceType& lhs, const ResourceType& rhs)
-{
- int result = 0;
-
- if (lhs.id != rhs.id)
- {
- result = lhs.id > rhs.id ? 1 : -1;
- }
- else // lhs.id == rhs.id
- {
- // Cast to a derived resource type and compare...
-
- switch (lhs.id)
- {
- case ResourceBitmap:
- {
- // compare bitmap widths & heights
- const BitmapResourceType& lhsBitmap = static_cast<const BitmapResourceType&>(lhs);
- const BitmapResourceType& rhsBitmap = static_cast<const BitmapResourceType&>(rhs);
-
- if( ! AttributesEqual( lhsBitmap.size, lhsBitmap.scalingMode, lhsBitmap.samplingMode, lhsBitmap.orientationCorrection,
- rhsBitmap.size, rhsBitmap.scalingMode, rhsBitmap.samplingMode, rhsBitmap.orientationCorrection ) )
- {
- result = AttributesLessAssumingNotEqual( lhsBitmap.size, lhsBitmap.scalingMode, lhsBitmap.samplingMode, lhsBitmap.orientationCorrection,
- rhsBitmap.size, rhsBitmap.scalingMode, rhsBitmap.samplingMode, rhsBitmap.orientationCorrection );
- }
- // else result = 0
- break;
- }
-
- case ResourceNativeImage:
- {
- // compare native image widths & heights
-
- const NativeImageResourceType& lhsNativeImage = static_cast<const NativeImageResourceType&>(lhs);
- const NativeImageResourceType& rhsNativeImage = static_cast<const NativeImageResourceType&>(rhs);
-
- if (lhsNativeImage.imageDimensions != rhsNativeImage.imageDimensions)
- {
- result = lhsNativeImage.imageDimensions < rhsNativeImage.imageDimensions ? -1 : 1;
- }
- // else result = 0
- break;
- }
-
- case ResourceTargetImage:
- {
- // compare bitmap widths & heights
- const RenderTargetResourceType& lhsImage = static_cast<const RenderTargetResourceType&>(lhs);
- const RenderTargetResourceType& rhsImage = static_cast<const RenderTargetResourceType&>(rhs);
-
- if (lhsImage.imageDimensions != rhsImage.imageDimensions)
- {
- result = lhsImage.imageDimensions < rhsImage.imageDimensions ? -1 : 1;
- }
- // else result = 0
- break;
- }
- }
- }
- return result;
-}
-}
-
-bool ResourceTypePath::operator<(const ResourceTypePath& rhs) const
-{
- int typeComparison = ResourceTypeCompare(*type, *(rhs.type));
-
- if (typeComparison != 0)
- {
- return (typeComparison < 0);
- }
- else
- {
- return path < rhs.path;
- }
-}
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_TYPE_PATH_H__
-#define __DALI_INTERNAL_RESOURCE_TYPE_PATH_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <memory>
-// INTERNAL INCLUDES
-#include <dali/integration-api/resource-types.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/**
- * A resource Type & Path pair. This is used by ResourceManager when creating tickets.
- * A new ticket will only be needed, if the same resource Type & Path has not already been requested.
- */
-class ResourceTypePath
-{
-public:
-
- /**
- * Create a resource Type and Path pair.
- * @param[in] requestType The type of resource.
- * @param[in] requestPath The path of the resource.
- */
- ResourceTypePath(const Integration::ResourceType& requestType,
- const std::string& requestPath)
- : type(requestType.Clone()),
- path(requestPath)
- {
- }
-
- /**
- * Copy constructor.
- * @param[in] typePath The Type & Path to copy.
- */
- ResourceTypePath(const ResourceTypePath& typePath)
- : type(typePath.type->Clone()),
- path(typePath.path)
- {
- }
-
- ~ResourceTypePath()
- {
- delete type;
- }
-
- /**
- * Less than operator.
- * @param[in] rhs The request to compare with.
- */
- bool operator<(const ResourceTypePath& rhs) const;
-
-private:
-
- /**
- * Undefined assignment operator.
- * @param[in] rhs The resource request to copy.
- */
- ResourceTypePath& operator=(const ResourceTypePath& rhs);
-
-public:
-
- const Integration::ResourceType* type;
- const std::string path;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_TYPE_PATH_H__
$(internal_src_dir)/event/rendering/renderer-impl.cpp \
$(internal_src_dir)/event/rendering/sampler-impl.cpp \
$(internal_src_dir)/event/rendering/shader-impl.cpp \
- $(internal_src_dir)/event/resources/image-ticket.cpp \
- $(internal_src_dir)/event/resources/resource-ticket.cpp \
- $(internal_src_dir)/event/resources/resource-type-path.cpp \
$(internal_src_dir)/event/size-negotiation/memory-pool-relayout-container.cpp \
$(internal_src_dir)/event/size-negotiation/relayout-controller-impl.cpp \
\
$(internal_src_dir)/render/common/render-tracker.cpp \
$(internal_src_dir)/render/common/render-manager.cpp \
$(internal_src_dir)/render/data-providers/render-data-provider.cpp \
- $(internal_src_dir)/render/gl-resources/bitmap-texture.cpp \
$(internal_src_dir)/render/gl-resources/context.cpp \
$(internal_src_dir)/render/gl-resources/frame-buffer-state-cache.cpp \
- $(internal_src_dir)/render/gl-resources/compressed-bitmap-texture.cpp \
- $(internal_src_dir)/render/gl-resources/frame-buffer-texture.cpp \
$(internal_src_dir)/render/gl-resources/gl-call-debug.cpp \
$(internal_src_dir)/render/gl-resources/gpu-buffer.cpp \
- $(internal_src_dir)/render/gl-resources/native-texture.cpp \
- $(internal_src_dir)/render/gl-resources/gl-texture.cpp \
- $(internal_src_dir)/render/gl-resources/texture-factory.cpp \
- $(internal_src_dir)/render/gl-resources/texture-cache.cpp \
$(internal_src_dir)/render/queue/render-queue.cpp \
$(internal_src_dir)/render/renderers/render-frame-buffer.cpp \
$(internal_src_dir)/render/renderers/render-geometry.cpp \
$(internal_src_dir)/update/common/scene-graph-buffers.cpp \
$(internal_src_dir)/update/common/scene-graph-connection-change-propagator.cpp \
$(internal_src_dir)/update/common/scene-graph-property-notification.cpp \
- $(internal_src_dir)/update/common/texture-cache-dispatcher.cpp \
$(internal_src_dir)/update/common/uniform-map.cpp \
$(internal_src_dir)/update/controllers/render-message-dispatcher.cpp \
$(internal_src_dir)/update/controllers/scene-controller-impl.cpp \
$(internal_src_dir)/update/render-tasks/scene-graph-render-task.cpp \
$(internal_src_dir)/update/render-tasks/scene-graph-render-task-list.cpp \
$(internal_src_dir)/update/rendering/scene-graph-texture-set.cpp \
- $(internal_src_dir)/update/rendering/scene-graph-renderer.cpp \
- $(internal_src_dir)/update/resources/resource-manager.cpp
+ $(internal_src_dir)/update/rendering/scene-graph-renderer.cpp
inline void ProcessRenderList(
const RenderList& renderList,
Context& context,
- SceneGraph::TextureCache& textureCache,
SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex,
const Matrix& viewMatrix,
// Render the item
item.mRenderer->Render( context,
- textureCache,
bufferIndex,
*item.mNode,
defaultShader,
void ProcessRenderInstruction( const RenderInstruction& instruction,
Context& context,
- SceneGraph::TextureCache& textureCache,
SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex )
{
{
ProcessRenderList( *renderList,
context,
- textureCache,
defaultShader,
bufferIndex,
*viewMatrix,
* Process a render-instruction.
* @param[in] instruction The render-instruction to process.
* @param[in] context The GL context.
- * @param[in] textureCache The texture cache used to get textures.
* @param[in] defaultShader The default shader.
* @param[in] bufferIndex The current render buffer index (previous update buffer)
*/
void ProcessRenderInstruction( const SceneGraph::RenderInstruction& instruction,
Context& context,
- SceneGraph::TextureCache& textureCache,
SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex );
#include <dali/internal/render/common/render-instruction-container.h>
#include <dali/internal/render/common/render-instruction.h>
#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/frame-buffer-texture.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
#include <dali/internal/render/queue/render-queue.h>
#include <dali/internal/render/renderers/render-frame-buffer.h>
#include <dali/internal/render/renderers/render-geometry.h>
typedef OwnerContainer< Render::Sampler* > SamplerOwnerContainer;
typedef SamplerOwnerContainer::Iterator SamplerOwnerIter;
-typedef OwnerContainer< Render::NewTexture* > TextureOwnerContainer;
+typedef OwnerContainer< Render::Texture* > TextureOwnerContainer;
typedef TextureOwnerContainer::Iterator TextureOwnerIter;
typedef OwnerContainer< Render::FrameBuffer* > FrameBufferOwnerContainer;
struct RenderManager::Impl
{
Impl( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- LockedResourceQueue& textureUploadedQ,
- TextureUploadedDispatcher& postProcessDispatcher )
+ Integration::GlSyncAbstraction& glSyncAbstraction )
: context( glAbstraction ),
glSyncAbstraction( glSyncAbstraction ),
renderQueue(),
- textureCache( renderQueue, postProcessDispatcher, context ),
- textureUploadedQueue( textureUploadedQ ),
instructions(),
backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
frameCount( 0 ),
Context context; ///< holds the GL state
Integration::GlSyncAbstraction& glSyncAbstraction; ///< GL sync abstraction
RenderQueue renderQueue; ///< A message queue for receiving messages from the update-thread.
- TextureCache textureCache; ///< Cache for all GL textures
- LockedResourceQueue& textureUploadedQueue; ///< A queue for requesting resource post processing in update thread
// Render instructions describe what should be rendered during RenderManager::Render()
// Owned by RenderManager. Update manager updates instructions for the next frame while we render the current one
};
RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- LockedResourceQueue& textureUploadedQ )
+ Integration::GlSyncAbstraction& glSyncAbstraction )
{
RenderManager* manager = new RenderManager;
manager->mImpl = new Impl( glAbstraction,
- glSyncAbstraction,
- textureUploadedQ,
- *manager );
+ glSyncAbstraction );
return manager;
}
return mImpl->renderQueue;
}
-TextureCache& RenderManager::GetTextureCache()
-{
- return mImpl->textureCache;
-}
-
void RenderManager::ContextCreated()
{
mImpl->context.GlContextCreated();
mImpl->context.GlContextDestroyed();
mImpl->programController.GlContextDestroyed();
- // inform texture cache
- mImpl->textureCache.GlContextDestroyed(); // Clears gl texture ids
-
//Inform textures
for( TextureOwnerIter iter = mImpl->textureContainer.Begin(); iter != mImpl->textureContainer.End(); ++iter )
{
}
}
-void RenderManager::DispatchTextureUploaded(ResourceId request)
-{
- mImpl->textureUploadedQueue.PushBack( request );
-}
-
void RenderManager::SetShaderSaver( ShaderSaver& upstream )
{
mImpl->programController.SetShaderSaver( upstream );
void RenderManager::AddRenderer( Render::Renderer* renderer )
{
// Initialize the renderer as we are now in render thread
- renderer->Initialize( mImpl->context, mImpl->textureCache );
+ renderer->Initialize( mImpl->context );
mImpl->rendererContainer.PushBack( renderer );
}
}
-void RenderManager::AddTexture( Render::NewTexture* texture )
+void RenderManager::AddTexture( Render::Texture* texture )
{
mImpl->textureContainer.PushBack( texture );
texture->Initialize(mImpl->context);
}
-void RenderManager::RemoveTexture( Render::NewTexture* texture )
+void RenderManager::RemoveTexture( Render::Texture* texture )
{
DALI_ASSERT_DEBUG( NULL != texture );
}
}
-void RenderManager::UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params )
+void RenderManager::UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
{
texture->Upload( mImpl->context, pixelData, params );
}
-void RenderManager::GenerateMipmaps( Render::NewTexture* texture )
+void RenderManager::GenerateMipmaps( Render::Texture* texture )
{
texture->GenerateMipmaps( mImpl->context );
}
}
}
-void RenderManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
+void RenderManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
{
frameBuffer->AttachColorTexture( mImpl->context, texture, mipmapLevel, layer );
}
DALI_PRINT_RENDER_END();
- // check if anything has been posted to the update thread, if IsEmpty then no update required.
- return !mImpl->textureUploadedQueue.IsEmpty();
+ return false;
}
void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader )
clearColor = Dali::RenderTask::DEFAULT_CLEAR_COLOR;
}
- FrameBufferTexture* offscreen = NULL;
-
if( instruction.mFrameBuffer != 0 )
{
instruction.mFrameBuffer->Bind( mImpl->context );
Render::ProcessRenderInstruction( instruction,
mImpl->context,
- mImpl->textureCache,
defaultShader,
mImpl->renderBufferIndex );
- if( instruction.mRenderTracker && ( offscreen != NULL || instruction.mFrameBuffer != NULL ) )
+ if( instruction.mRenderTracker && ( instruction.mFrameBuffer != NULL ) )
{
// This will create a sync object every frame this render tracker
// is alive (though it should be now be created only for
// INTERNAL INCLUDES
#include <dali/public-api/math/rect.h>
#include <dali/internal/common/shader-saver.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
-#include <dali/internal/render/common/texture-uploaded-dispatcher.h>
#include <dali/internal/render/gl-resources/gpu-buffer.h>
#include <dali/internal/render/renderers/render-property-buffer.h>
#include <dali/internal/event/rendering/texture-impl.h>
struct Sampler;
class RenderTracker;
class Geometry;
-class NewTexture;
+class Texture;
}
namespace SceneGraph
{
class RenderQueue;
-class TextureCache;
class RenderInstruction;
class RenderInstructionContainer;
class Shader;
* RenderManager is responsible for rendering the result of the previous "update", which
* is provided in a RenderCommand during UpdateManager::Update().
*/
-class RenderManager : public TextureUploadedDispatcher
+class RenderManager
{
public:
* @param[out] resourcePostProcessQueue A queue for sending rendered texture ids to the update-thread.*
*/
static RenderManager* New( Integration::GlAbstraction& glAbstraction,
- Integration::GlSyncAbstraction& glSyncAbstraction,
- LockedResourceQueue& resourcePostProcessQueue );
+ Integration::GlSyncAbstraction& glSyncAbstraction );
/**
* Non-virtual destructor; not intended as a base class
RenderQueue& GetRenderQueue();
/**
- * Retrieve the texture cache. Messages should only be sent to this from the update thread,
- * accessor methods should only be used from the render thread.
- * @return The texture cache
- */
- TextureCache& GetTextureCache();
-
- /**
* @copydoc Dali::Integration::Core::ContextCreated()
*/
void ContextCreated();
void ContextDestroyed();
/**
- * Dispatch requests onto the postProcessResourcesQueue
- * @param[in] resource The Id of the resource to dispatch
- */
- virtual void DispatchTextureUploaded( ResourceId resource );
-
- /**
* Set the upstream interface for compiled shader binaries to be sent back to for eventual
* caching and saving.
* @param[in] upstream The abstract interface to send any received ShaderDatas onwards to..
* Adds a texture to the render manager
* @param[in] texture The texture to add
*/
- void AddTexture( Render::NewTexture* texture );
+ void AddTexture( Render::Texture* texture );
/**
* Removes a texture from the render manager
* @param[in] texture The texture to remove
*/
- void RemoveTexture( Render::NewTexture* texture );
+ void RemoveTexture( Render::Texture* texture );
/**
* Uploads data to an existing texture
* @param[in] pixelData The pixel data object
* @param[in] params The parameters for the upload
*/
- void UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params );
+ void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
/**
* Generates mipmaps for a given texture
* @param[in] texture The texture
*/
- void GenerateMipmaps( Render::NewTexture* texture );
+ void GenerateMipmaps( Render::Texture* texture );
/**
* Adds a framebuffer to the render manager
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer );
/**
* Adds a render tracker to the RenderManager. RenderManager takes ownership of the
+++ /dev/null
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_POST_PROCESS_RESOURCE_DISPATCHER_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_POST_PROCESS_RESOURCE_DISPATCHER_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/resource-declarations.h>
-
-namespace Dali
-{
-namespace Internal
-{
-typedef Integration::ResourceId ResourceId;
-
-namespace SceneGraph
-{
-
-/**
- * Interface which offers a dispatch mechanism for uploaded notifications on textures
- * Should be offered by a Render Thread object
- */
-class TextureUploadedDispatcher
-{
-public:
- /**
- * Dispatch a post process resource uploaded request to the Update thread
- * @param[in] resource A post process request
- */
- virtual void DispatchTextureUploaded( ResourceId resource ) = 0;
-
-protected:
- /**
- * Virtual destructor
- */
- virtual ~TextureUploadedDispatcher(){}
-};
-
-
-} // namespaces
-}
-}
-
-
-#endif // __DALI_INTERNAL_SCENE_GRAPH_POST_PROCESS_RESOURCE_DISPATCHER_H__
return mSamplers;
}
-std::vector<Render::NewTexture*>& RenderDataProvider::GetNewTextures()
+std::vector<Render::Texture*>& RenderDataProvider::GetTextures()
{
- return mNewTextures;
+ return mTextures;
}
} // SceneGraph
Samplers& GetSamplers();
/**
- * Returns the list of NewTextures
- * @return The list of NewTextures
+ * Returns the list of Textures
+ * @return The list of Textures
*/
- std::vector<Render::NewTexture*>& GetNewTextures();
+ std::vector<Render::Texture*>& GetTextures();
private:
const UniformMapDataProvider* mUniformMapDataProvider;
Shader* mShader;
- std::vector<Render::NewTexture*> mNewTextures;
+ std::vector<Render::Texture*> mTextures;
Samplers mSamplers;
// Give Renderer access to our private data to reduce copying vectors on construction.
+++ /dev/null
-/*
- * Copyright (c) 2016 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/internal/render/gl-resources/bitmap-texture.h>
-
-// EXTERNAL INCLUDES
-#include <cstring>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/images/buffer-image.h> // For PixelBuffer
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/common/performance-monitor.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-BitmapTexture::BitmapTexture(
- Integration::Bitmap* const bitmap,
- const Integration::Bitmap::PackedPixelsProfile * const bitmapPackedPixelsProfile,
- Context& context,
- ResourcePolicy::Discardable policy)
-: Texture( context,
- bitmapPackedPixelsProfile->GetBufferWidth(),
- bitmapPackedPixelsProfile->GetBufferHeight(),
- bitmap->GetImageWidth(),
- bitmap->GetImageHeight()),
- mBitmap(bitmap),
- mPixelFormat(bitmap->GetPixelFormat()),
- mDiscardPolicy(policy),
- mClearPixels(false)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_SET_OBJECT_STRING(this, DALI_LOG_GET_OBJECT_STRING(bitmap));
-}
-
-BitmapTexture::BitmapTexture(
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels,
- Context& context,
- ResourcePolicy::Discardable policy)
-: Texture( context,
- width, height,
- width, height),
- mBitmap(NULL),
- mPixelFormat( pixelFormat ),
- mDiscardPolicy(policy),
- mClearPixels(clearPixels)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-}
-
-BitmapTexture::~BitmapTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-
- // GlCleanup() should already have been called by TextureCache ensuring the resource is destroyed
- // on the render thread. (And avoiding a potentially problematic virtual call in the destructor)
-}
-
-bool BitmapTexture::HasAlphaChannel() const
-{
- return Pixel::HasAlpha(mPixelFormat);
-}
-
-bool BitmapTexture::IsFullyOpaque() const
-{
- if( mBitmap )
- {
- return mBitmap->IsFullyOpaque();
- }
- else
- {
- return ! HasAlphaChannel(); // Todo: amalgamate updated bitmap's IsFullyOpaque()
- }
-}
-
-// Bitmap buffer has been changed. Upload changes to GPU.
-void BitmapTexture::AreaUpdated( const RectArea& updateArea, const unsigned char* pixels )
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "BitmapTexture::AreaUpdated()\n");
-
- GLenum pixelFormat = GL_RGBA;
- GLenum pixelDataType = GL_UNSIGNED_BYTE;
- Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat);
-
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
-
- mContext.Bind2dTexture(mId);
-
- if( ! updateArea.IsEmpty() )
- {
- mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); // We always use tightly packed data
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "Update x:%d y:%d w:%d h:%d\n",
- updateArea.x, updateArea.y, updateArea.width ,updateArea.height );
-
- const unsigned int pitchPixels = mWidth;
- const unsigned int pixelDepth = Dali::Pixel::GetBytesPerPixel( mPixelFormat );
-
- // If the width of the source update area is the same as the pitch, then can
- // copy the contents in a single contiguous TexSubImage call.
- if(updateArea.x == 0 && updateArea.width == pitchPixels)
- {
- pixels += updateArea.y * pitchPixels * pixelDepth;
- mContext.TexSubImage2D( GL_TEXTURE_2D,0, updateArea.x, updateArea.y,
- updateArea.width, updateArea.height,
- pixelFormat, pixelDataType, pixels );
- }
- else
- {
- // Otherwise the source buffer needs to be copied line at a time, as OpenGL ES
- // does not support source strides. (no GL_UNPACK_ROW_LENGTH supported)
- unsigned int yBottom = updateArea.y + updateArea.height;
- pixels += (updateArea.y * pitchPixels + updateArea.x) * pixelDepth;
-
- for(unsigned int y = updateArea.y; y < yBottom; y++)
- {
- mContext.TexSubImage2D( GL_TEXTURE_2D,0, updateArea.x, y,
- updateArea.width, 1,
- pixelFormat, pixelDataType, pixels );
- pixels += pitchPixels * pixelDepth;
- }
- }
-
- INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED,
- updateArea.Area()* GetBytesPerPixel( mPixelFormat ));
- }
-}
-
-void BitmapTexture::AssignBitmap( bool generateTexture, const unsigned char* pixels )
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "BitmapTexture::AssignBitmap()\n");
-
- GLenum pixelFormat = GL_RGBA;
- GLenum pixelDataType = GL_UNSIGNED_BYTE;
-
- if( generateTexture )
- {
- mContext.GenTextures(1, &mId);
- }
- DALI_ASSERT_DEBUG( mId != 0 );
-
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
- mContext.Bind2dTexture(mId);
- Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat);
-
- mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1); // We always use tightly packed data
- mContext.TexImage2D(GL_TEXTURE_2D, 0, pixelFormat, mWidth, mHeight, 0, pixelFormat, pixelDataType, pixels);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- // If the resource policy is to discard on upload then release buffer
- DiscardBitmapBuffer();
-
- if( pixels != NULL )
- {
- INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, GetBytesPerPixel(mPixelFormat) * mWidth * mHeight );
- }
-}
-
-void BitmapTexture::Update( Integration::Bitmap* bitmap )
-{
- DALI_LOG_INFO( Debug::Filter::gGLResource, Debug::General, "BitmapTexture::Update(bitmap:%p )\n", bitmap );
- DALI_ASSERT_DEBUG( bitmap != 0 );
- if( !bitmap )
- {
- DALI_LOG_ERROR( "Passed a null bitmap to update this bitmap texture.\n" );
- return;
- }
-
- // Only Packed-pixel bitmaps are ever associated with BitmapTextures, so we should never be passed any other kind:
- const Integration::Bitmap::PackedPixelsProfile * const bitmapPackedPixels = bitmap->GetPackedPixelsProfile();
- DALI_ASSERT_DEBUG(bitmapPackedPixels);
- if( !bitmapPackedPixels )
- {
- ///! This should never happen.
- DALI_LOG_ERROR("Passed an incompatible bitmap type to update this bitmap texture.\n");
- return;
- }
- mBitmap = bitmap;
-
- const unsigned char* pixels = mBitmap->GetBuffer();
-
- // We should never have null pixel data here - resource manager has deliberately loaded/reloaded data
-
- DALI_ASSERT_DEBUG( pixels != NULL );
-
- if( NULL == pixels )
- {
- DALI_LOG_ERROR("BitmapTexture::Upload() - Bitmap has no pixel data.\n");
- }
- else if( mId != 0 )
- {
- if( mImageWidth == mBitmap->GetImageWidth() &&
- mImageHeight == mBitmap->GetImageHeight() &&
- mWidth == bitmapPackedPixels->GetBufferWidth() &&
- mHeight == bitmapPackedPixels->GetBufferHeight() &&
- mPixelFormat == mBitmap->GetPixelFormat() ) // and size hasn't changed
- {
- RectArea area(0, 0, mImageWidth, mImageHeight); // just update whole texture
- AreaUpdated( area, pixels );
- DiscardBitmapBuffer();
- }
- else // Otherwise, reload the pixel data
- {
- mImageWidth = mBitmap->GetImageWidth();
- mImageHeight = mBitmap->GetImageHeight();
- mWidth = bitmapPackedPixels->GetBufferWidth();
- mHeight = bitmapPackedPixels->GetBufferHeight();
- mPixelFormat = mBitmap->GetPixelFormat();
-
- AssignBitmap( false, pixels );
- }
- }
-}
-
-void BitmapTexture::Update( Integration::Bitmap* srcBitmap, std::size_t xOffset, std::size_t yOffset )
-{
- if( NULL != srcBitmap )
- {
- Update( srcBitmap->GetBuffer(), srcBitmap->GetImageWidth(), srcBitmap->GetImageHeight(),
- srcBitmap->GetPixelFormat(), xOffset, yOffset);
- }
-}
-
-void BitmapTexture::Update( PixelData* srcPixelData, std::size_t xOffset, std::size_t yOffset )
-{
- if( NULL != srcPixelData )
- {
- Update( srcPixelData->GetBuffer(), srcPixelData->GetWidth(), srcPixelData->GetHeight(),
- srcPixelData->GetPixelFormat(), xOffset, yOffset);
- }
-}
-
-void BitmapTexture::Update( const unsigned char* pixels, std::size_t width, std::size_t height, Pixel::Format pixelFormat, std::size_t xOffset, std::size_t yOffset )
-{
-
- GLenum pixelGLFormat = GL_RGBA;
- GLenum pixelDataType = GL_UNSIGNED_BYTE;
- Integration::ConvertToGlFormat( mPixelFormat, pixelDataType, pixelGLFormat );
-
- if( !mId )
- {
- mContext.GenTextures( 1, &mId );
-
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
- mContext.Bind2dTexture( mId );
- mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-
- mContext.TexImage2D( GL_TEXTURE_2D, 0, pixelGLFormat, mWidth, mHeight, 0, pixelGLFormat, pixelDataType, NULL );
- mContext.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- mContext.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- }
- else
- {
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
- mContext.Bind2dTexture( mId );
- mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- }
-
-#if DALI_GLES_VERSION >= 30
- // For GLES 3.0, uploading sub-image with different format is a valid operation.
- Integration::ConvertToGlFormat( pixelFormat, pixelDataType, pixelGLFormat );
-#else
- // Allows RGB888 source bitmap to be added to RGBA8888 texture, need to convert the bitmap format manually.
- if(pixelFormat == Pixel::RGB888 && mPixelFormat == Pixel::RGBA8888 )
- {
- std::size_t size = width * height;
-
- Vector<PixelBuffer> tempBuffer;
- tempBuffer.Reserve( size*4u );
- PixelBuffer* data = tempBuffer.Begin();
-
- for( std::size_t i=0u; i<size; i++ )
- {
- data[i*4u] = pixels[i*3u];
- data[i*4u+1] = pixels[i*3u+1];
- data[i*4u+2] = pixels[i*3u+2];
- data[i*4u+3] = 0xFF;
- }
-
- mContext.TexSubImage2D( GL_TEXTURE_2D, 0,
- xOffset, yOffset,
- width, height,
- pixelGLFormat, pixelDataType,
- data );
-
- return;
- }
-#endif
-
- mContext.TexSubImage2D( GL_TEXTURE_2D, 0,
- xOffset, yOffset,
- width, height,
- pixelGLFormat, pixelDataType,
- pixels );
-}
-
-void BitmapTexture::UpdateArea( const RectArea& updateArea )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "BitmapTexture::UpdateArea()\n");
-
- if( mBitmap != 0 )
- {
- const unsigned char* pixels = mBitmap->GetBuffer();
-
- // Pixel data could be null if we've uploaded to GL and discarded the data.
-
- if( NULL != pixels )
- {
- if( mId ) // If the texture is already bound
- {
- if( updateArea.IsEmpty() )
- {
- RectArea area;
- area.x = 0;
- area.y = 0;
- area.width = mImageWidth;
- area.height = mImageHeight;
- AreaUpdated( area, pixels );
- }
- else
- {
- AreaUpdated( updateArea, pixels );
- }
- }
- }
- }
-}
-
-bool BitmapTexture::UpdateOnCreate()
-{
- return true;
-}
-
-bool BitmapTexture::CreateGlTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "BitmapTexture::CreateGlTexture() Bitmap: %s\n", DALI_LOG_GET_OBJECT_C_STR(this));
-
- if( mBitmap )
- {
- const unsigned char* pixels = mBitmap->GetBuffer();
-
- // pixel data could be NULL here if we've had a context loss and we previously discarded
- // the pixel data on the previous upload. If it is null, then we shouldn't generate a
- // new GL Texture; leaving mId as zero. Eventually, the bitmap will get reloaded,
- // and pixels will become non-null.
-
- if( NULL != pixels )
- {
- AssignBitmap( true, pixels );
- DiscardBitmapBuffer();
- }
- }
- else
- {
- const unsigned char* pixels = NULL;
- Dali::Vector<unsigned char> pixelData; // Okay to create outside branch as empty vector has no heap allocation.
- if( true == mClearPixels )
- {
- unsigned int size = mWidth * mHeight * Pixel::GetBytesPerPixel( mPixelFormat );
- pixelData.Resize( size, 0 );
- pixels = &pixelData[0];
- }
- AssignBitmap( true, pixels );
- }
-
- return mId != 0;
-}
-
-bool BitmapTexture::Init()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- // mBitmap should be initialized by now
- return (mBitmap != 0);
-}
-
-unsigned int BitmapTexture::GetWidth() const
-{
- unsigned int width = mWidth;
- if( mBitmap )
- {
- width = mBitmap->GetImageWidth();
- }
- return width;
-}
-
-unsigned int BitmapTexture::GetHeight() const
-{
- unsigned int height = mHeight;
- if( mBitmap )
- {
- height = mBitmap->GetImageHeight();
- }
- return height;
-}
-
-void BitmapTexture::DiscardBitmapBuffer()
-{
- DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, "BitmapTexture::DiscardBitmapBuffer() DiscardPolicy: %s\n", mDiscardPolicy == ResourcePolicy::OWNED_DISCARD?"DISCARD":"RETAIN");
-
- if( ResourcePolicy::OWNED_DISCARD == mDiscardPolicy )
- {
- DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, " Discarding bitmap\n");
- if ( mBitmap )
- {
- mBitmap->DiscardBuffer();
- }
- }
-}
-
-
-} //namespace Internal
-
-} //namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_BITMAP_TEXTURE_H__
-#define __DALI_INTERNAL_BITMAP_TEXTURE_H__
-
-/*
- * Copyright (c) 2016 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h> // for uint32_t
-
-// INTERNAL INCLUDES
-#include <dali/internal/common/message.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class BitmapTexture;
-typedef IntrusivePtr<BitmapTexture> BitmapTexturePointer;
-
-/**
- *
- * Texture class.
- * If you want to load a file to a BitmapTexture use
- * TextureManager::GetTexture()
- *
- */
-class BitmapTexture : public Texture
-{
-public:
- /**
- * Constructor
- * Creates a new texture object from a Bitmap
- * @param[in] bitmap The Bitmap
- * @param[in] bitmapPackedPixelsProfile The Bitmap features related to an addressable array of raw pixel data
- * @param context The GL context
- */
- BitmapTexture(Integration::Bitmap* const bitmap, const Integration::Bitmap::PackedPixelsProfile * const bitmapPackedPixelsProfile, Context& context, ResourcePolicy::Discardable discardPolicy);
-
- /**
- * Constructor
- * Creates a new texture object
- * @param[in] width width in pixels
- * @param[in] height height in pixels
- * @param[in] pixelFormat pixel format
- * @param[in] clearPixels True if the pixel data should be cleared before gl texture creation
- * @param[in] context Dali context
- */
- BitmapTexture( unsigned int width, unsigned int height, Pixel::Format pixelFormat,
- bool clearPixels, Context& context, ResourcePolicy::Discardable discardPolicy );
-
- /**
- * Destructor.
- */
- virtual ~BitmapTexture();
-
- /**
- * Retrieve the bitmap
- * @return The bitmap or NULL if already discarded
- */
- Integration::Bitmap* GetBitmap() { return mBitmap.Get(); }
-
-public:
-
- /**
- * @copydoc Texture::Init
- */
- virtual bool Init();
-
- /**
- * @copydoc Texture::GetWidth
- */
- virtual unsigned int GetWidth() const;
-
- /**
- * @copydoc Texture::GetHeight
- */
- virtual unsigned int GetHeight() const;
-
- /**
- * @copydoc Texture::HasAlphaChannel
- */
- virtual bool HasAlphaChannel() const;
-
- /**
- * @copydoc Texture::IsFullyOpaque
- */
- virtual bool IsFullyOpaque() const;
-
- /**
- * Replace current bitmap with a fresh one, for instance after a Bitmap has
- * been reloaded.
- * @param[in] bitmap The new bitmap
- */
- virtual void Update( Integration::Bitmap* bitmap );
-
- /**
- * Update part of the texture with a different bitmap
- * @param[in] srcBitmap The bitmap to copy from
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- virtual void Update( Integration::Bitmap* srcBitmap, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Update part of the texture with a pixel buffer
- * @param[in] srcPixelData The pixel data to copy from
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- virtual void Update( PixelData* srcPixelData, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Bitmap area has been modified - update the texture appropriately.
- * @pre The bitmap hasn't been discarded (should be external type)
- * @param[in] area The updated area
- */
- virtual void UpdateArea( const RectArea& area );
-
- /**
- * @return Return true if the texture should be updated on GL texture creation.
- */
- virtual bool UpdateOnCreate();
-
-protected:
- /**
- * @copydoc Texture::CreateGlTexture
- */
- virtual bool CreateGlTexture();
-
-private:
-
- /**
- * Uploads changes to GPU after Bitmap buffer has changed.
- * @param [in] updateArea area which changed
- * @param[in] pixels The pixel data
- */
- void AreaUpdated( const RectArea& updateArea, const unsigned char* pixels );
-
- /**
- * Assigns the bitmap data to an OpenGL texture
- * Creates a new texture object and copies
- * the image data held in the pixels parameter
- * @pre The texture has to have a width/height that is a power of 2.
- * @param[in] generateTexture True if we should generate a GL texture id
- * @param[in] pixels The pixel data
- */
- void AssignBitmap( bool generateTexture, const unsigned char* pixels );
-
- /**
- * If the discard policy is not RETAIN, then discards the bitmap's pixel buffer
- */
- void DiscardBitmapBuffer();
-
- /**
- * Update part of the texture.
- * @param [in] pixels The pixel buffer.
- * @param [in] width The buffer width in pixels
- * @param [in] height The buffer height in pixels
- * @param [in] pixelFormat The pixel format
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void Update( const unsigned char* pixels, std::size_t width, std::size_t height, Pixel::Format pixelFormat, std::size_t xOffset, std::size_t yOffset );
-
-private:
- Integration::BitmapPtr mBitmap; ///< The Bitmap the Texture was created from (may be NULL)
- Pixel::Format mPixelFormat; ///< Pack pixel format into bitfield
- ResourcePolicy::Discardable mDiscardPolicy; ///< The bitmap discard policy
- bool mClearPixels; ///< true if initial texture should be cleared on creation
-
- // Changes scope, should be at end of class
- DALI_LOG_OBJECT_STRING_DECLARATION;
-};
-
-} //namespace Internal
-
-} //namespace Dali
-
-#endif //__DALI_INTERNAL_BITMAP_TEXTURE_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/render/gl-resources/compressed-bitmap-texture.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/common/performance-monitor.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-CompressedBitmapTexture::CompressedBitmapTexture(Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable /*discardPolicy*/)
-: Texture(context,
- bitmap->GetImageWidth(),
- bitmap->GetImageHeight(),
- bitmap->GetImageWidth(),
- bitmap->GetImageHeight()),
- mBitmap(bitmap),
- mPixelFormat( bitmap->GetPixelFormat() )
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_SET_OBJECT_STRING(this, DALI_LOG_GET_OBJECT_STRING(bitmap));
-}
-
-CompressedBitmapTexture::~CompressedBitmapTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- // GlCleanup() should already have been called by TextureCache ensuring the resource is destroyed
- // on the render thread. (And avoiding a potentially problematic virtual call in the destructor)
-}
-
-bool CompressedBitmapTexture::HasAlphaChannel() const
-{
- return Pixel::HasAlpha(mPixelFormat);
-}
-
-bool CompressedBitmapTexture::IsFullyOpaque() const
-{
- if( mBitmap )
- {
- return mBitmap->IsFullyOpaque();
- }
- else
- {
- return ! HasAlphaChannel(); // Todo: amalgamate updated bitmap's IsFullyOpaque()
- }
-}
-
-
-void CompressedBitmapTexture::AssignBitmap( bool generateTexture, const unsigned char* const pixels, const size_t bufferSize )
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "CompressedBitmapTexture::AssignBitmap()\n");
-
- if( generateTexture )
- {
- mContext.GenTextures(1, &mId);
- }
- DALI_ASSERT_DEBUG( mId != 0 );
-
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD );
- mContext.Bind2dTexture(mId);
-
- GLenum pixelFormat = GL_RGBA;
- GLenum pixelDataType = GL_UNSIGNED_BYTE;
- Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat);
-
- mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1); // We always use tightly packed data
- mContext.CompressedTexImage2D(GL_TEXTURE_2D, 0, pixelFormat, mWidth, mHeight, 0, bufferSize, pixels);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-}
-
-void CompressedBitmapTexture::Update( Integration::Bitmap* bitmap )
-{
- DALI_ASSERT_DEBUG(bitmap);
- DALI_ASSERT_DEBUG(mImageWidth == mWidth && mImageHeight == mHeight);
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "CompressedBitmapTexture::Update(bitmap:%p )\n", bitmap);
-
- if( !bitmap )
- {
- DALI_LOG_ERROR( "Passed a null bitmap to update this compressed bitmap texture.\n" );
- return;
- }
-
- Internal::BitmapCompressed * const compressedBitmap = dynamic_cast<Dali::Internal::BitmapCompressed*>( bitmap );
- if( compressedBitmap == 0 )
- {
- DALI_LOG_ERROR("CompressedBitmapTexture was passed a non-compressed bitmap to update with.\n");
- return;
- }
- mBitmap = compressedBitmap;
-
- const unsigned char * const pixels = mBitmap->GetBuffer();
-
- DALI_ASSERT_DEBUG(pixels != NULL);
-
- if ( NULL == pixels )
- {
- DALI_LOG_ERROR("Bitmap has no data\n");
- }
- else
- {
- mImageWidth = mBitmap->GetImageWidth();
- mImageHeight = mBitmap->GetImageHeight();
- mWidth = mImageWidth;
- mHeight = mImageHeight;
- mPixelFormat = mBitmap->GetPixelFormat();
-
- if ( mId ) // If the texture is already bound
- {
- AssignBitmap( false, pixels, mBitmap->GetBufferSize() );
- }
- }
-}
-
-bool CompressedBitmapTexture::UpdateOnCreate()
-{
- return true;
-}
-
-bool CompressedBitmapTexture::CreateGlTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Bitmap: %s\n", DALI_LOG_GET_OBJECT_C_STR(this));
-
- if( mBitmap )
- {
- const unsigned char* pixels = mBitmap->GetBuffer();
-
- DALI_ASSERT_DEBUG(pixels != NULL);
-
- if( NULL != pixels )
- {
- AssignBitmap( true, pixels, mBitmap->GetBufferSize() );
- mBitmap->DiscardBuffer();
- }
- }
- else
- {
- AssignBitmap( true, NULL, 0 );
- }
-
- return mId != 0;
-}
-
-bool CompressedBitmapTexture::Init()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- // mBitmap should be initialized by now
- return (mBitmap != 0);
-}
-
-unsigned int CompressedBitmapTexture::GetWidth() const
-{
- unsigned int width = mWidth;
- if( mBitmap )
- {
- width = mBitmap->GetImageWidth();
- }
- return width;
-}
-
-unsigned int CompressedBitmapTexture::GetHeight() const
-{
- unsigned int height = mHeight;
- if( mBitmap )
- {
- height = mBitmap->GetImageHeight();
- }
- return height;
-}
-
-} //namespace Internal
-
-} //namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__
-#define __DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <stdint.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/buffer-image.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/internal/event/images/bitmap-compressed.h>
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class CompressedBitmapTexture;
-typedef IntrusivePtr<CompressedBitmapTexture> CompressedBitmapTexturePointer;
-
-/**
- * Compressed Texture class.
- * If you want to load a file to a CompressedBitmapTexture use
- * TextureManager::GetTexture()
- * Compressed textures differ from ordinary ones in that their in-memory
- * representation cannot be inspected at a pixel level by simple pointer
- * arithmetic and in that they cannot be partially updated.
- */
-class CompressedBitmapTexture : public Texture
-{
-public:
- /**
- * Constructor
- * Creates a new texture object from a Bitmap
- * @param[in] bitmap The Bitmap
- * @param[in] context The GL context
- * @param[in] discardPolicy The discard policy
- */
- CompressedBitmapTexture( Internal::BitmapCompressed* const bitmap, Context& context, ResourcePolicy::Discardable discardPolicy );
-
- /**
- * Destructor.
- */
- virtual ~CompressedBitmapTexture();
-
-public:
- /**
- * @copydoc Texture::Init
- */
- virtual bool Init();
-
- /**
- * @copydoc Texture::GetWidth
- */
- virtual unsigned int GetWidth() const;
-
- /**
- * @copydoc Texture::GetHeight
- */
- virtual unsigned int GetHeight() const;
-
- /**
- * @copydoc Texture::HasAlphaChannel
- */
- virtual bool HasAlphaChannel() const;
-
- /**
- * @copydoc Texture::IsFullyOpaque
- * Always returns false as we can't know what is going on inside the encoded pixel data. ///!Todo: Revise this decision: Paul, didn't you want the opposite assumption?
- */
- virtual bool IsFullyOpaque() const;
-
- /**
- * Bitmap has been reloaded - update the texture appropriately.
- * @param[in] bitmap The new bitmap
- */
- virtual void Update( Integration::Bitmap* bitmap );
-
- /**
- * @return Return true if the texture should be updated on GL texture creation.
- */
- virtual bool UpdateOnCreate();
-
-protected:
- /**
- * @copydoc Texture::CreateGlTexture
- */
- virtual bool CreateGlTexture();
-
-private:
-
- /**
- * Assigns the bitmap data to an OpenGL texture
- * Creates a new texture object and copies
- * the image data held in the pixels parameter
- * @param[in] generateTexture True if we should generate a GL texture id
- * @param[in] pixels The pixel data
- */
- void AssignBitmap( bool generateTexture, const unsigned char* pixels, const size_t bufferSize );
-
-private:
- Internal::BitmapCompressedPtr mBitmap; ///< The Bitmap the Texture was created from (may be NULL)
- Pixel::Format mPixelFormat;
-
- // Changes scope, should be at end of class
- DALI_LOG_OBJECT_STRING_DECLARATION;
-};
-} //namespace Internal
-} //namespace Dali
-
-#endif //__DALI_INTERNAL_COMPRESSED_BITMAP_TEXTURE_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/render/gl-resources/frame-buffer-texture.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-#include <dali/integration-api/debug.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-FrameBufferTexture::FrameBufferTexture(unsigned int width, unsigned int height, Context& context)
-: Texture( context,
- width, height ),
- mFrameBufferName(0),
- mRenderBufferName(0),
- mStencilBufferName(0),
- mPixelFormat(Pixel::RGBA8888),
- mBufferFormat(RenderBuffer::COLOR),
- mNativeImage(NULL)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-
-}
-
-FrameBufferTexture::FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, Context& context)
-: Texture( context,
- width, height ),
- mFrameBufferName(0),
- mRenderBufferName(0),
- mStencilBufferName(0),
- mPixelFormat( pixelFormat ),
- mBufferFormat(RenderBuffer::COLOR),
- mNativeImage(NULL)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-
-}
-
-FrameBufferTexture::FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat, Context& context)
-: Texture( context,
- width, height ),
- mFrameBufferName(0),
- mRenderBufferName(0),
- mStencilBufferName(0),
- mPixelFormat( pixelFormat ),
- mBufferFormat( bufferFormat ),
- mNativeImage(NULL)
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-}
-
-FrameBufferTexture::FrameBufferTexture( NativeImageInterfacePtr nativeImage, Context& context )
-: Texture( context,
- nativeImage->GetWidth(), nativeImage->GetHeight() ),
- mFrameBufferName(0),
- mRenderBufferName(0),
- mStencilBufferName(0),
- mPixelFormat( Pixel::RGBA8888 ), // Not really used for nativeImage
- mBufferFormat(RenderBuffer::COLOR_DEPTH),
- mNativeImage( nativeImage )
-{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "NativeFrameBufferTexture created 0x%x\n", &nativeImage );
-}
-
-FrameBufferTexture::~FrameBufferTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- // GlCleanup() should already have been called by TextureCache ensuring the resource is destroyed
- // on the render thread. (And avoiding a potentially problematic virtual call in the destructor)
-}
-
-bool FrameBufferTexture::IsFullyOpaque() const
-{
- return !HasAlphaChannel();
-}
-
-bool FrameBufferTexture::HasAlphaChannel() const
-{
- if( mNativeImage )
- {
- return mNativeImage->RequiresBlending();
- }
-
- return false;
-}
-
-bool FrameBufferTexture::Init()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- return true;
-}
-
-bool FrameBufferTexture::Prepare()
-{
- // bind texture
- Bind( GL_TEXTURE_2D, TEXTURE_UNIT_FRAMEBUFFER );
-
- if( 0 != mId )
- {
- // bind frame buffer
- mContext.BindFramebuffer(GL_FRAMEBUFFER, mFrameBufferName);
-
- return true;
- }
-
- // Texture could not be bound
- return false;
-}
-
-bool FrameBufferTexture::CreateGlTexture()
-{
- DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
-
- if( mNativeImage &&
- !mNativeImage->GlExtensionCreate() )
- {
- DALI_LOG_ERROR( "Error creating native image!\n" );
- return false;
- }
-
- mContext.GenTextures(1, &mId);
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD ); // bind in unused unit so rebind works the first time
- mContext.Bind2dTexture(mId);
-
- // set texture parameters
- mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if( mNativeImage )
- {
- // platform specific implementation decides on what GL extension to use
- mNativeImage->TargetTexture();
- }
- else
- {
- // Assign memory for texture in GL memory space
- GLenum pixelFormat = GL_RGBA;
- GLenum pixelDataType = GL_UNSIGNED_BYTE;
- Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat);
-
- mContext.TexImage2D(GL_TEXTURE_2D, 0, pixelFormat, mWidth, mHeight, 0, pixelFormat, pixelDataType, NULL);
- }
-
- // generate frame and render buffer names
- mContext.GenFramebuffers(1, &mFrameBufferName);
-
- /* WE ALWAYS HAVE COLOR COMPONENT */
-
- // bind frame buffer
- mContext.BindFramebuffer(GL_FRAMEBUFFER, mFrameBufferName);
- // attach texture to the color attachment point
- mContext.FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mId, 0);
-
- if (mBufferFormat == RenderBuffer::COLOR_DEPTH_STENCIL)
- {
- mContext.GenRenderbuffers(1, &mRenderBufferName);
- mContext.GenRenderbuffers(1, &mStencilBufferName);
-
- // Bind render buffer and create 16 depth buffer
- mContext.BindRenderbuffer(GL_RENDERBUFFER, mRenderBufferName);
- mContext.RenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, mWidth, mHeight);
-
- // Bind render buffer and create 8 stencil buffer
- mContext.BindRenderbuffer(GL_RENDERBUFFER, mStencilBufferName);
- mContext.RenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, mWidth, mHeight);
-
- // attach render buffer to the depth buffer attachment point
- mContext.FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mRenderBufferName);
- // attach render buffer to the stencil buffer attachment point
- mContext.FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, mStencilBufferName);
- }
- else if (mBufferFormat == RenderBuffer::COLOR_DEPTH)
- {
- mContext.GenRenderbuffers(1, &mRenderBufferName);
-
- // Bind render buffer and create 8 stencil buffer
- mContext.BindRenderbuffer(GL_RENDERBUFFER, mRenderBufferName);
- mContext.RenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, mWidth, mHeight);
-
- // attach render buffer to the depth buffer attachment point
- mContext.FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mRenderBufferName);
- }
- else if (mBufferFormat == RenderBuffer::COLOR_STENCIL)
- {
- mContext.GenRenderbuffers(1, &mStencilBufferName);
-
- // Bind render buffer and create 8 stencil buffer
- mContext.BindRenderbuffer(GL_RENDERBUFFER, mStencilBufferName);
- mContext.RenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, mWidth, mHeight);
-
- // attach render buffer to the depth buffer attachment point
- mContext.FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, mStencilBufferName);
- }
-
- int status = mContext.CheckFramebufferStatus(GL_FRAMEBUFFER);
- if ( GL_FRAMEBUFFER_COMPLETE != status )
- {
- DALI_LOG_ERROR( "status (0x%x), glError (0x%x)\n", status, mContext.GetError() );
- }
-
- return mId != 0;
-}
-
-void FrameBufferTexture::GlCleanup()
-{
- Texture::GlCleanup();
-
- if (mFrameBufferName != 0)
- {
- mContext.DeleteFramebuffers(1, &mFrameBufferName );
- mFrameBufferName = 0;
- }
-
- if (mRenderBufferName != 0)
- {
- mContext.DeleteRenderbuffers(1, &mRenderBufferName );
- mRenderBufferName = 0;
- }
-
- if (mStencilBufferName != 0)
- {
- mContext.DeleteRenderbuffers(1, &mStencilBufferName );
- mStencilBufferName = 0;
- }
-
- if( mNativeImage )
- {
- mNativeImage->GlExtensionDestroy();
- mNativeImage.Reset();
- }
-}
-
-} //namespace Internal
-
-} //namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
-#define __DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/**
- * Texture class.
- * Used as a frame buffer for RenderTask
- */
-class FrameBufferTexture : public Texture
-{
-public:
-
- /**
- * Creates a new texture object
- * @param[in] width The width (pixels)
- * @param[in] height The height (pixels)
- * @param[in] context The GL context
- */
- FrameBufferTexture(unsigned int width, unsigned int height, Context& context);
-
- /**
- * Creates a new texture object
- * @param[in] width The width (pixels)
- * @param[in] height The height (pixels)
- * @param[in] pixelFormat The pixel format
- * @param[in] context The GL context
- */
- FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, Context& context);
-
- /**
- * Creates a new texture object
- * @param[in] width The width (pixels)
- * @param[in] height The height (pixels)
- * @param[in] pixelFormat The pixel format
- * @param[in] bufferFormat The buffer formats to be attached in the FBO
- * @param[in] context The GL context
- */
- FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat, Context& context);
-
- /**
- * Creates a new texture object
- * @param[in] nativeImage The NativeImage
- * @param context The GL context
- */
- FrameBufferTexture( NativeImageInterfacePtr nativeImage, Context& context );
-
- /**
- * Destructor.
- */
- virtual ~FrameBufferTexture();
-
- /**
- * @copydoc Texture::IsFullyOpaque
- */
- virtual bool IsFullyOpaque() const;
-
- /**
- * @copydoc Texture::HasAlphaChannel
- */
- virtual bool HasAlphaChannel() const;
-
- /**
- * @copydoc Texture::Init
- */
- virtual bool Init();
-
- /**
- * Prepare FBO for rendering.
- * @return true if the FBO is prepared and its status is GL_FRAMEBUFFER_COMPLETE, otherwise false.
- */
- virtual bool Prepare();
-
-protected:
- unsigned int mFrameBufferName;
- unsigned int mRenderBufferName;
- unsigned int mStencilBufferName;
- Pixel::Format mPixelFormat;
- RenderBuffer::Format mBufferFormat;
- NativeImageInterfacePtr mNativeImage; ///< For native FBOs only
-
- /**
- * @copydoc Texture::CreateGlTexture
- */
- virtual bool CreateGlTexture();
-
- /**
- * @copydoc Texture::GlCleanup
- */
- virtual void GlCleanup();
-
-}; // class FrameBufferTexture
-
-} //namespace Internal
-
-} //namespace Dali
-#endif //__DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
-
+++ /dev/null
-/*
- * 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.
- * 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/internal/render/gl-resources/gl-texture.h>
-
-// EXTERNAL INCLUDES
-#include <math.h>
-#include <memory.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/common/image-sampler.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace
-{
-
-// These match the GL specification
-const GLint SYSTEM_MINIFY_DEFAULT = GL_NEAREST_MIPMAP_LINEAR;
-const GLint SYSTEM_MAGNIFY_DEFAULT = GL_LINEAR;
-const GLint SYSTEM_WRAP_DEFAULT = GL_CLAMP_TO_EDGE;
-
-// These are the Dali defaults
-const GLint DALI_MINIFY_DEFAULT = GL_LINEAR;
-const GLint DALI_MAGNIFY_DEFAULT = GL_LINEAR;
-
-} // namespace
-
-/**
- * @brief Convert a FilterMode to it's corresponding GL type.
- *
- * @param[in] filterMode The FilterMode type.
- * @param[in] defaultfilterMode The filter mode to use if filterMode is DEFAULT.
- * @param[in] defaultSystemFilterMode The filter mode to use if filterMode is NONE.
- * @return Return the equivalent GL type.
- */
-GLint FilterModeToGL( FilterMode::Type filterMode, GLint defaultfilterMode, GLint defaultSystemFilterMode )
-{
- switch( filterMode )
- {
- case FilterMode::NEAREST:
- {
- return GL_NEAREST;
- }
- case FilterMode::LINEAR:
- {
- return GL_LINEAR;
- }
- case FilterMode::NONE:
- {
- return defaultSystemFilterMode;
- }
- case FilterMode::NEAREST_MIPMAP_NEAREST:
- {
- return GL_NEAREST_MIPMAP_NEAREST;
- }
- case FilterMode::LINEAR_MIPMAP_NEAREST:
- {
- return GL_LINEAR_MIPMAP_NEAREST;
- }
- case FilterMode::NEAREST_MIPMAP_LINEAR:
- {
- return GL_NEAREST_MIPMAP_LINEAR;
- }
- case FilterMode::LINEAR_MIPMAP_LINEAR:
- {
- return GL_LINEAR_MIPMAP_LINEAR;
- }
- case FilterMode::DEFAULT:
- {
- return defaultfilterMode;
- }
- }
-
- return defaultfilterMode;
-}
-
-GLint WrapModeToGL( WrapMode::Type wrapMode, GLint defaultWrapMode )
-{
- switch( wrapMode )
- {
- case WrapMode::DEFAULT:
- {
- return defaultWrapMode;
- }
- case WrapMode::CLAMP_TO_EDGE:
- {
- return GL_CLAMP_TO_EDGE;
- }
- case WrapMode::REPEAT:
- {
- return GL_REPEAT;
- }
- case WrapMode::MIRRORED_REPEAT:
- {
- return GL_MIRRORED_REPEAT;
- }
- }
-
- return defaultWrapMode;
-}
-
-using Dali::Internal::Vertex2D;
-
-using namespace Dali::Pixel;
-
-Texture::Texture(Context& context,
- unsigned int width,
- unsigned int height,
- unsigned int imageWidth,
- unsigned int imageHeight)
-: mContext(context),
- mId(0),
- mSamplerBitfield( 0 ),
- mWidth(width),
- mHeight(height),
- mImageWidth(imageWidth),
- mImageHeight(imageHeight)
-{
-}
-
-Texture::Texture(Context& context,
- unsigned int width,
- unsigned int height)
-: mContext(context),
- mId(0),
- mSamplerBitfield( 0 ),
- mWidth(width),
- mHeight(height),
- mImageWidth(width),
- mImageHeight(height)
-{
-}
-
-Texture::~Texture()
-{
- // GlCleanup() should already have been called by TextureCache ensuring the resource is destroyed
- // on the render thread. (And avoiding a potentially problematic virtual call in the destructor)
-}
-
-void Texture::SetTextureId(GLuint id)
-{
- mId=id;
-}
-
-void Texture::Update(Integration::Bitmap* bitmap)
-{
- DALI_ASSERT_DEBUG( "Updating incorrect texture type" == NULL );
-}
-
-void Texture::UpdateArea( const RectArea& area )
-{
- DALI_ASSERT_DEBUG( "Updating incorrect texture type" == NULL );
-}
-
-bool Texture::UpdateOnCreate()
-{
- return false;
-}
-
-bool Texture::Bind(GLenum target, TextureUnit textureunit )
-{
- // This is the only supported type at the moment
- DALI_ASSERT_DEBUG( target == GL_TEXTURE_2D );
- bool result = true;
-
- if( mId == 0 )
- {
- result = CreateGlTexture();
- }
-
- // Bind the texture id
- mContext.BindTextureForUnit(textureunit, mId );
-
- return result;
-}
-
-void Texture::GlContextDestroyed()
-{
- // texture is gone
- mId = 0;
- // reset sampler state as well
- mSamplerBitfield = 0;
-}
-
-void Texture::GlCleanup()
-{
- // delete the gl texture
- if (mId != 0)
- {
- mContext.DeleteTextures(1,&mId);
- mId = 0;
- }
-}
-
-unsigned int Texture::GetWidth() const
-{
- return mWidth;
-}
-
-unsigned int Texture::GetHeight() const
-{
- return mHeight;
-}
-
-void Texture::ApplyFilterModeParameter( TextureUnit unit, GLint filterType, FilterMode::Type currentFilterMode, FilterMode::Type newFilterMode, GLint daliDefault, GLint systemDefault )
-{
- GLint newFilterModeGL = FilterModeToGL( newFilterMode, daliDefault, systemDefault );
- GLint currentFilterModeGL = FilterModeToGL( currentFilterMode, daliDefault, systemDefault );
-
- if( newFilterModeGL != currentFilterModeGL )
- {
- mContext.ActiveTexture( unit );
- mContext.TexParameteri( GL_TEXTURE_2D, filterType, newFilterModeGL );
- }
-}
-
-void Texture::ApplyWrapModeParameter( TextureUnit unit, GLint wrapType, WrapMode::Type currentWrapMode, WrapMode::Type newWrapMode )
-{
- GLint newWrapModeGL = WrapModeToGL( newWrapMode, SYSTEM_WRAP_DEFAULT );
- GLint currentWrapModeGL = WrapModeToGL( currentWrapMode, SYSTEM_WRAP_DEFAULT );
-
- if( newWrapModeGL != currentWrapModeGL )
- {
- mContext.ActiveTexture( unit );
- mContext.TexParameteri( GL_TEXTURE_2D, wrapType, newWrapModeGL );
- }
-}
-
-void Texture::ApplySampler( TextureUnit unit, unsigned int samplerBitfield )
-{
- if( mSamplerBitfield != samplerBitfield && mId != 0 )
- {
- ApplyFilterModeParameter( unit,
- GL_TEXTURE_MIN_FILTER,
- ImageSampler::GetMinifyFilterMode( mSamplerBitfield ),
- ImageSampler::GetMinifyFilterMode( samplerBitfield ),
- DALI_MINIFY_DEFAULT,
- SYSTEM_MINIFY_DEFAULT );
-
- ApplyFilterModeParameter( unit,
- GL_TEXTURE_MAG_FILTER,
- ImageSampler::GetMagnifyFilterMode( mSamplerBitfield ),
- ImageSampler::GetMagnifyFilterMode( samplerBitfield ),
- DALI_MAGNIFY_DEFAULT,
- SYSTEM_MAGNIFY_DEFAULT );
-
- ApplyWrapModeParameter( unit,
- GL_TEXTURE_WRAP_S,
- ImageSampler::GetUWrapMode( mSamplerBitfield ),
- ImageSampler::GetUWrapMode( samplerBitfield ));
-
- ApplyWrapModeParameter( unit,
- GL_TEXTURE_WRAP_T,
- ImageSampler::GetVWrapMode( mSamplerBitfield ),
- ImageSampler::GetVWrapMode( samplerBitfield ));
-
-
-
- mSamplerBitfield = samplerBitfield;
- }
-}
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXTURE_H__
-#define __DALI_INTERNAL_TEXTURE_H__
-
-/*
- * 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.
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/actors/sampling.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/pixel.h>
-#include <dali/public-api/images/native-image.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/internal/event/images/pixel-data-impl.h>
-#include <dali/internal/render/gl-resources/gl-resource-owner.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-
-
-namespace Dali
-{
-
-class NativeImage;
-
-namespace Internal
-{
-
-class Context;
-struct Vertex2D;
-
-/**
- * Texture class.
- */
-class Texture: public RefObject,
- public GlResourceOwner
-{
-public:
-
- /**
- * Used to define the area of the texture to display
- */
- typedef Rect<int> PixelArea;
-
- /**
- * Used to define a region of a bitmap.
- */
- typedef Rect<unsigned int> RectArea; ///< rectangular area (x,y,w,h)
-
- /**
- * Initialization method for Texture.
- * Might or might not be needed in specific implementations.
- * @return true if successful, false otherwise
- */
- virtual bool Init() = 0;
-
- /**
- * Update the texture with the bitmap.
- */
- virtual void Update(Integration::Bitmap* bitmap);
-
- /**
- * Update the texture from the modified bitmap.
- * @param area to update
- */
- virtual void UpdateArea( const RectArea& area );
-
- /**
- * Update part of the texture with a different bitmap
- * @param[in] srcBitmap The bitmap to copy from
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- virtual void Update( Integration::Bitmap* srcBitmap, std::size_t xOffset, std::size_t yOffset ) {}
-
- /**
- * Update part of the texture with a pixel buffer
- * @param[in] srcPixelData The pixel data to copy from
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- virtual void Update( PixelData* srcPixelData, std::size_t xOffset, std::size_t yOffset ) {}
-
- /**
- * @return Return true if the texture should be updated on GL texture creation.
- */
- virtual bool UpdateOnCreate();
-
- /**
- * Binds the texture for use.
- * If there is no GL texture yet, it tries to create one.
- *
- * @param target (e.g. GL_TEXTURE_2D)
- * @param textureunit to bind to
- *
- * @return true if the bind succeeded, or false if either the create or bind failed
- */
- virtual bool Bind(GLenum target, TextureUnit textureunit);
-
- /**
- * Returns GL texture ID
- * @return texture id
- */
- unsigned int GetTextureId()
- {
- return mId;
- }
-
- /**
- * Return the width of image in pixels.
- * @return width
- */
- virtual unsigned int GetWidth() const;
-
- /**
- * Return the height of image in pixels.
- * @return height
- */
- virtual unsigned int GetHeight() const;
-
- /**
- * Query whether the texture data has an alpha channel.
- * @return True if the texture data has an alpha channel.
- */
- virtual bool HasAlphaChannel() const = 0;
-
- /**
- * Query whether the texture is completely opaque
- * @return True if all pixels of the texture data are opaque
- */
- virtual bool IsFullyOpaque() const = 0;
-
- /**
- * Sets the texture id.
- * @param id OpenGL texture id
- */
- void SetTextureId(GLuint id);
-
- /**
- * @brief Apply the given sampler to the texture.
- *
- * @param[in] texture unit to use
- * @param[in] samplerBitfield A bitfield with packed sampler options.
- */
- void ApplySampler( TextureUnit unit, unsigned int samplerBitfield );
-
-protected:
-
- /**
- * Constructor.
- * @param[in] context The GL context
- * @param[in] width The buffer width
- * @param[in] height The buffer height
- * @param[in] imageWidth The image width
- * @param[in] imageHeight The image height
- */
- Texture( Context& context,
- unsigned int width,
- unsigned int height,
- unsigned int imageWidth,
- unsigned int imageHeight );
- /**
- * Constructor.
- * @param[in] context The GL context
- * @param[in] width Both the buffer width and the image width (they are equal)
- * @param[in] height Both the buffer height and the image height.
- */
- Texture( Context& context,
- unsigned int width,
- unsigned int height );
-public:
- /**
- * Initialize texture for rendering.
- * @return true on success
- */
- virtual bool CreateGlTexture() = 0;
-
- /**
- * Destructor.
- * Delete the GL texture associated with it.
- */
- virtual ~Texture();
-
-public: // From GlResourceOwner
-
- /**
- * @copydoc Dali::Internal::GlResourceOwner::GlContextDestroyed()
- */
- virtual void GlContextDestroyed();
-
- /**
- * @copydoc Dali::Internal::GlResourceOwner::GlCleanup()
- */
- virtual void GlCleanup();
-
-private:
-
- // Undefined
- Texture(const Texture&);
-
- // Undefined
- Texture& operator=(const Texture& rhs);
-
- /**
- * @brief Apply the given texture filtering parameters.
- *
- * @param[in] texture unit to use
- * @param[in] filterType Minification or magnification.
- * @param[in] currentFilterMode The current filter mode.
- * @param[in] newFilterMode The new filter mode.
- * @param[in] daliDefault The default dali filter mode for the given filterType.
- * @param[in] systemDefault The default system filter mode for the given filterType.
- */
- void ApplyFilterModeParameter( TextureUnit unit, GLint filterType, FilterMode::Type currentFilterMode, FilterMode::Type newFilterMode, GLint daliDefault, GLint systemDefault );
-
- /**
- * @brief Apply the given texture wrap mode.
- *
- * @param[in] texture unit to use
- * @param[in] wrapType UWrap or VWrap
- * @param[in] currentWrapMode The current wrap mode.
- * @param[in] newWrapMode The new wrap mode.
- */
- void ApplyWrapModeParameter( TextureUnit unit, GLint wrapType, WrapMode::Type currentWrapMode, WrapMode::Type newWrapMode );
-
-protected:
-
- Context& mContext; ///< The GL Context
-
- GLuint mId; ///< Texture id
-
- unsigned int mSamplerBitfield; ///< The packed bitfield of the current sampler
-
- unsigned int mWidth; ///< texture width, may be scaled power of 2 (if not in an atlas)
- unsigned int mHeight; ///< texture width, may be scaled power of 2 (if not in an atlas)
-
- unsigned int mImageWidth; ///< width of the original image (may be smaller than texture width)
- unsigned int mImageHeight; ///< height of the original image (may be smaller than texture height)
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXTURE_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/render/gl-resources/native-texture.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-#include <dali/devel-api/images/native-image-interface-extension.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-NativeTexture::NativeTexture(NativeImageInterface* nativeImg, Context& context)
-: Texture(context,
- nativeImg->GetWidth(),
- nativeImg->GetHeight(),
- nativeImg->GetWidth(),
- nativeImg->GetHeight()),
- mNativeImage(nativeImg)
-{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "NativeTexture created 0x%x\n", &nativeImg );
-}
-
-NativeTexture::~NativeTexture()
-{
- DALI_LOG_INFO (Debug::Filter::gImage, Debug::General, "NativeTexture destroyed\n");
-
- // GlCleanup() should already have been called by TextureCache ensuring the resource is destroyed
- // on the render thread. (And avoiding a potentially problematic virtual call in the destructor)
-}
-
-bool NativeTexture::Bind( GLenum target, TextureUnit textureunit )
-{
- bool result = true;
-
- if( mId == 0 )
- {
- result = CreateGlTexture();
- }
-
- if( result )
- {
- // Bind the texture id
- mContext.ActiveTexture( textureunit );
-
- int textureTarget = GL_TEXTURE_2D;
- NativeImageInterface::Extension* extension = mNativeImage->GetExtension();
- if( extension )
- {
- textureTarget = extension->GetEglImageTextureTarget();
- }
-
- mContext.BindTexture( textureTarget, mId );
- mNativeImage->PrepareTexture();
- }
-
- return result;
-}
-
-bool NativeTexture::IsFullyOpaque() const
-{
- return !HasAlphaChannel();
-}
-
-bool NativeTexture::HasAlphaChannel() const
-{
- return mNativeImage->RequiresBlending();
-}
-
-bool NativeTexture::CreateGlTexture()
-{
- if( mId != 0 )
- {
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "GL texture creation duplicate for GL id: %d\n", &mId );
- return true;
- }
-
- if( mNativeImage->GlExtensionCreate() )
- {
- mContext.GenTextures( 1, &mId );
- mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD ); // bind in unused unit so rebind works the first time
-
- int textureTarget = GL_TEXTURE_2D;
- NativeImageInterface::Extension* extension = mNativeImage->GetExtension();
- if( extension )
- {
- textureTarget = extension->GetEglImageTextureTarget();
- }
-
- mContext.BindTexture( textureTarget, mId );
-
- mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); // We always use tightly packed data
-
- mContext.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- mContext.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-
- // platform specific implementation decides on what GL extension to use
- mNativeImage->TargetTexture();
- }
- else
- {
- DALI_LOG_ERROR( "Error creating native image!\n" );
- }
-
- return mId != 0;
-}
-
-void NativeTexture::GlCleanup()
-{
- Texture::GlCleanup();
-
- DALI_ASSERT_DEBUG( mNativeImage );
-
- mNativeImage->GlExtensionDestroy();
- mNativeImage.Reset();
-}
-
-bool NativeTexture::Init()
-{
- return true;
-}
-
-} //namespace Internal
-
-} //namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_NATIVE_TEXTURE_H__
-#define __DALI_INTERNAL_NATIVE_TEXTURE_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/gl-defines.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class Texture;
-
-/**
- *
- * Native texture class.
- * Used for handing already loaded image data to Dali.
- *
- */
-class NativeTexture : public Texture
-{
-public:
- /**
- * Constructor.
- * @pre nativeImg has to be initialized. (GLTexture is already created)
- * @param nativeImg the NativeImage to be used
- * @param context the GL context
- */
- NativeTexture(NativeImageInterface* nativeImg, Context& context);
-
- /**
- * Destructor.
- */
- virtual ~NativeTexture();
-
- /**
- * @copydoc Texture::Bind
- */
- virtual bool Bind( GLenum target, TextureUnit textureunit );
-
- /**
- * @copydoc Texture::IsFullyOpaque
- */
- virtual bool IsFullyOpaque() const;
-
- /**
- * @copydoc Texture::HasAlphaChannel
- */
- virtual bool HasAlphaChannel() const;
-
- /**
- * @copydoc Texture::Init
- */
- virtual bool Init();
-
-protected:
- /**
- * @copydoc Texture::CreateGlTexture
- */
- virtual bool CreateGlTexture();
-
- /**
- * @copydoc Texture::GlCleanup
- */
- virtual void GlCleanup();
-
-
-private:
-
- NativeImageInterfacePtr mNativeImage; ///< reference to NativeImage the Texture was created from
-};
-
-} //namespace Internal
-
-} //namespace Dali
-
-#endif //__DALI_INTERNAL_NATIVE_TEXTURE_H__
+++ /dev/null
-/*
- * Copyright (c) 2016 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/internal/render/gl-resources/texture-cache.h>
-
-// INTERNAL HEADERS
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/internal/render/common/texture-uploaded-dispatcher.h>
-#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture-factory.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/internal/render/gl-resources/texture-observer.h>
-#include <dali/internal/render/gl-resources/bitmap-texture.h>
-#include <dali/internal/render/gl-resources/native-texture.h>
-#include <dali/internal/render/gl-resources/frame-buffer-texture.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-using Dali::Internal::Texture;
-using Dali::Internal::FrameBufferTexture;
-using Dali::Integration::Bitmap;
-
-namespace
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gTextureCacheFilter = Debug::Filter::New(Debug::Concise, false, "LOG_TEXTURE_CACHE");
-#endif
-}
-
-
-namespace Dali
-{
-namespace Internal
-{
-
-
-namespace SceneGraph
-{
-
-namespace
-{
-
-/**
- * @brief Forward to all textures in container the news that the GL Context is down.
- */
-void GlContextDestroyed( TextureContainer& textures )
-{
- TextureIter end = textures.end();
- TextureIter iter = textures.begin();
- for( ; iter != end; ++iter )
- {
- (*iter->second).GlContextDestroyed();
- }
-}
-
-}
-
-TextureCache::TextureCache( RenderQueue& renderQueue,
- TextureUploadedDispatcher& postProcessResourceDispatcher,
- Context& context)
-: mTextureUploadedDispatcher(postProcessResourceDispatcher),
- mContext(context),
- mDiscardBitmapsPolicy(ResourcePolicy::OWNED_DISCARD)
-{
-}
-
-TextureCache::~TextureCache()
-{
-}
-
-void TextureCache::CreateTexture( ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::CreateTexture(id=%i width:%u height:%u)\n", id, width, height);
-
- Texture* texture = TextureFactory::NewBitmapTexture(width, height, pixelFormat, clearPixels, mContext, GetDiscardBitmapsPolicy() );
- mTextures.insert(TexturePair(id, texture));
-}
-
-void TextureCache::AddBitmap(ResourceId id, Integration::BitmapPtr bitmap)
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::AddBitmap(id=%i Bitmap:%p)\n", id, bitmap.Get());
-
- Texture* texture = TextureFactory::NewBitmapTexture(bitmap.Get(), mContext, GetDiscardBitmapsPolicy());
- mTextures.insert(TexturePair(id, texture));
-}
-
-void TextureCache::AddNativeImage(ResourceId id, NativeImageInterfacePtr nativeImage)
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::AddNativeImage(id=%i NativeImg:%p)\n", id, nativeImage.Get());
-
- /// WARNING - currently a new Texture is created even if we reuse the same NativeImage
- Texture* texture = TextureFactory::NewNativeImageTexture(*nativeImage, mContext);
- mTextures.insert(TexturePair(id, texture));
-}
-
-void TextureCache::AddFrameBuffer( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::AddFrameBuffer(id=%i width:%u height:%u)\n", id, width, height);
-
- // Note: Do not throttle framebuffer generation - a request for a framebuffer should always be honoured
- // as soon as possible.
- Texture* texture = TextureFactory::NewFrameBufferTexture( width, height, pixelFormat, bufferFormat, mContext );
- mFramebufferTextures.insert(TexturePair(id, texture));
-}
-
-void TextureCache::AddFrameBuffer( ResourceId id, NativeImageInterfacePtr nativeImage )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::AddFrameBuffer(id=%i width:%u height:%u)\n", id, nativeImage->GetWidth(), nativeImage->GetHeight());
-
- // Note: Do not throttle framebuffer generation - a request for a framebuffer should always be honoured
- // as soon as possible.
- Texture* texture = TextureFactory::NewFrameBufferTexture( nativeImage, mContext );
- mFramebufferTextures.insert(TexturePair(id, texture));
-}
-
-void TextureCache::CreateGlTexture( ResourceId id )
-{
- TextureIter textureIter = mTextures.find(id);
- // If we found a non-null texture object pointer for the resource id, force it
- // to eagerly allocate a backing GL texture:
- if( textureIter != mTextures.end() )
- {
- TexturePointer texturePtr = textureIter->second;
- if( texturePtr )
- {
- texturePtr->CreateGlTexture();
- }
- }
-}
-
-void TextureCache::UpdateTexture( ResourceId id, Integration::BitmapPtr bitmap )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::UpdateTexture(id=%i bitmap:%p )\n", id, bitmap.Get());
-
- TextureIter textureIter = mTextures.find(id);
- if( textureIter != mTextures.end() )
- {
- // we have reloaded the image from file, update texture
- TexturePointer texturePtr = textureIter->second;
- if( texturePtr )
- {
- texturePtr->Update( bitmap.Get() );
-
- ResourceId ppRequest( id );
- mTextureUploadedDispatcher.DispatchTextureUploaded(ppRequest);
- }
- }
-}
-
-void TextureCache::UpdateTexture( ResourceId id, Integration::BitmapPtr bitmap, std::size_t xOffset, std::size_t yOffset )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::UpdateTexture(id=%i bitmap:%p )\n", id, bitmap.Get());
-
- TextureIter textureIter = mTextures.find(id);
- if( textureIter != mTextures.end() )
- {
- TexturePointer texturePtr = textureIter->second;
- if( texturePtr )
- {
- texturePtr->Update( bitmap.Get(), xOffset, yOffset );
-
- ResourceId ppRequest( id );
- mTextureUploadedDispatcher.DispatchTextureUploaded(ppRequest);
- }
- }
-}
-
-void TextureCache::UpdateTexture( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::UpdateTexture(destId=%i srcId=%i )\n", destId, srcId );
-
- BitmapTexture* srcTexture = TextureCache::GetBitmapTexture( srcId );
- Integration::BitmapPtr srcBitmap = ( srcTexture != NULL ) ? srcTexture->GetBitmap() : NULL;
-
- if( srcBitmap )
- {
- UpdateTexture( destId, srcBitmap, xOffset, yOffset );
- }
-}
-
-void TextureCache::UpdateTexture( ResourceId id, PixelDataPtr pixelData, std::size_t xOffset, std::size_t yOffset )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::UpdateTexture(id=%i pixel data:%p )\n", id, pixelData.Get());
-
- TextureIter textureIter = mTextures.find(id);
- if( textureIter != mTextures.end() )
- {
- TexturePointer texturePtr = textureIter->second;
- if( texturePtr )
- {
- texturePtr->Update( pixelData.Get(), xOffset, yOffset );
-
- ResourceId ppRequest( id );
- mTextureUploadedDispatcher.DispatchTextureUploaded(ppRequest);
- }
- }
-}
-
-void TextureCache::UpdateTextureArea( ResourceId id, const RectArea& area )
-{
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::UpdateTextureArea(id=%i)\n", id );
-
- TextureIter textureIter = mTextures.find(id);
- if( textureIter != mTextures.end() )
- {
- TexturePointer texturePtr = textureIter->second;
- if( texturePtr )
- {
- texturePtr->UpdateArea( area );
-
- ResourceId ppRequest( id );
- mTextureUploadedDispatcher.DispatchTextureUploaded(ppRequest);
- }
- }
-}
-
-void TextureCache::DiscardTexture( ResourceId id )
-{
- bool deleted = false;
-
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::DiscardTexture(id:%u)\n", id);
-
- if( mTextures.size() > 0)
- {
- TextureIter iter = mTextures.find(id);
- if( iter != mTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- // if valid texture pointer, cleanup GL resources
- texturePtr->GlCleanup();
- }
- mTextures.erase(iter);
- deleted = true;
- }
- }
-
- if( mFramebufferTextures.size() > 0)
- {
- TextureIter iter = mFramebufferTextures.find(id);
- if( iter != mFramebufferTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- // if valid texture pointer, cleanup GL resources
- texturePtr->GlCleanup();
- }
- mFramebufferTextures.erase(iter);
- deleted = true;
- }
- }
-
- if(deleted)
- {
- if( mObservers.size() > 0 )
- {
- TextureResourceObserversIter observersIter = mObservers.find(id);
- if( observersIter != mObservers.end() )
- {
- TextureObservers observers = observersIter->second;
- for( TextureObserversIter iter = observers.begin(); iter != observers.end(); ++iter )
- {
- TextureObserver* observer = *iter;
- observer->TextureDiscarded( id );
- }
-
- mObservers.erase( observersIter );
- }
- }
- }
-}
-
-bool TextureCache::BindTexture( Texture *texture, ResourceId id, GLenum target, TextureUnit textureunit )
-{
- unsigned int glTextureId = texture->GetTextureId();
-
- bool success = texture->Bind(target, textureunit);
- bool created = ( glTextureId == 0 ) && ( texture->GetTextureId() != 0 );
-
- if( created && texture->UpdateOnCreate() ) // i.e. the pixel data was sent to GL
- {
- ResourceId ppRequest( id );
- mTextureUploadedDispatcher.DispatchTextureUploaded(ppRequest);
- }
- return success;
-}
-
-Texture* TextureCache::GetTexture(ResourceId id)
-{
- Texture* texture = NULL;
- TextureIter iter = mTextures.find(id);
-
- if( iter != mTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- texture = texturePtr.Get();
- }
- }
-
- if( texture == NULL )
- {
- TextureIter iter = mFramebufferTextures.find(id);
- if( iter != mFramebufferTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- texture = texturePtr.Get();
- }
- }
- }
-
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::GetTexture(id:%u) : %p\n", id, texture);
-
- return texture;
-}
-
-BitmapTexture* TextureCache::GetBitmapTexture(ResourceId id)
-{
- BitmapTexture* texture = NULL;
- TextureIter iter = mTextures.find( id );
-
- if( iter != mTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- texture = dynamic_cast< BitmapTexture* >( texturePtr.Get() );
- }
- }
-
- return texture;
-}
-
-FrameBufferTexture* TextureCache::GetFramebuffer(ResourceId id)
-{
- FrameBufferTexture* offscreen = NULL;
- TextureIter iter = mFramebufferTextures.find(id);
-
- DALI_ASSERT_DEBUG( iter != mFramebufferTextures.end() );
-
- if( iter != mFramebufferTextures.end() )
- {
- TexturePointer texturePtr = iter->second;
- if( texturePtr )
- {
- offscreen = dynamic_cast< FrameBufferTexture* >( texturePtr.Get() );
- }
- }
- DALI_ASSERT_DEBUG( offscreen );
-
- DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "TextureCache::GetFramebuffer(id:%u) : %p\n", id, offscreen);
-
- return offscreen;
-}
-
-void TextureCache::AddObserver( ResourceId id, TextureObserver* observer )
-{
- TextureResourceObserversIter observersIter = mObservers.find(id);
- if( observersIter != mObservers.end() )
- {
- TextureObservers& observers = observersIter->second;
- bool foundObserver = false;
- for( TextureObserversIter iter = observers.begin(); iter != observers.end(); ++iter )
- {
- if( *iter == observer )
- {
- foundObserver = true;
- break;
- }
- }
- if( ! foundObserver )
- {
- observers.push_back(observer);
- }
- }
- else
- {
- TextureObservers observers;
- observers.push_back(observer);
- mObservers.insert(std::pair<ResourceId, TextureObservers>(id, observers));
- }
-}
-
-void TextureCache::RemoveObserver( ResourceId id, TextureObserver* observer )
-{
- TextureResourceObserversIter observersIter = mObservers.find(id);
- if( observersIter != mObservers.end() )
- {
- TextureObservers& observers = observersIter->second;
- for( TextureObserversIter iter = observers.begin(); iter != observers.end(); ++iter )
- {
- if(*iter == observer)
- {
- observers.erase(iter);
- break;
- }
- }
- }
-}
-
-void TextureCache::GlContextDestroyed()
-{
- SceneGraph::GlContextDestroyed( mTextures );
- SceneGraph::GlContextDestroyed( mFramebufferTextures );
-}
-
-void TextureCache::SetDiscardBitmapsPolicy( ResourcePolicy::Discardable policy )
-{
- DALI_LOG_INFO( gTextureCacheFilter, Debug::General, "TextureCache::SetDiscardBitmapsPolicy(%s)\n",
- policy==ResourcePolicy::OWNED_DISCARD?"DISCARD":"RETAIN" );
- mDiscardBitmapsPolicy = policy;
-}
-
-ResourcePolicy::Discardable TextureCache::GetDiscardBitmapsPolicy()
-{
- return mDiscardBitmapsPolicy;
-}
-
-} // SceneGraph
-
-} // Internal
-
-} // Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_TEXTURE_CACHE_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_TEXTURE_CACHE_H__
-
-/*
- * Copyright (c) 2016 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/common/map-wrapper.h>
-#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/public-api/images/native-image.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/resource-policies.h>
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/internal/common/owner-pointer.h>
-#include <dali/internal/event/images/pixel-data-impl.h>
-#include <dali/internal/event/resources/resource-client-declarations.h> // For RectArea
-#include <dali/internal/update/common/scene-graph-buffers.h>
-#include <dali/internal/render/gl-resources/texture-declarations.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
-
-namespace Dali
-{
-class NativeImageInterface;
-
-
-namespace Integration
-{
-class Bitmap;
-typedef IntrusivePtr<Bitmap> BitmapPtr;
-}
-
-
-namespace Internal
-{
-class Context;
-class Texture;
-class BitmapTexture;
-class FrameBufferTexture;
-class TextureObserver;
-
-namespace SceneGraph
-{
-class RenderQueue;
-class TextureUploadedDispatcher;
-
-typedef std::map<ResourceId, TexturePointer > TextureContainer;
-typedef std::pair<ResourceId, TexturePointer > TexturePair;
-typedef TextureContainer::iterator TextureIter;
-typedef TextureContainer::const_iterator TextureConstIter;
-
-/**
- * Caches textures. Owned by Render Thread
- */
-class TextureCache
-{
-public:
- /**
- * Constructor
- * @param[in] renderQueue Queue to use for dispatching messages to this object
- * @param[in] postProcessDispatcher Dispatcher for resource post processing requests
- * @param[in] context GL Context
- */
- TextureCache( RenderQueue& renderQueue,
- TextureUploadedDispatcher& postProcessDispatcher,
- Context& context );
-
- /**
- * Destructor
- */
- ~TextureCache();
-
- /**
- * Creates a new empty texture object with the given dimensions.
- * @param[in] width The width (pixels)
- * @param[in] height The height (pixels)
- * @param[in] pixelFormat The pixel format
- * @param[in] clearPixels True if the pixel data should be cleared first
- */
- void CreateTexture( ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels );
-
- /**
- * Add a bitmap to the texture cache
- * @param[in] id Resource Id of the bitmap
- * @param[in] bitmap The bitmap
- */
- void AddBitmap( ResourceId id, Integration::BitmapPtr bitmap );
-
- /**
- * Add a native image to the texture cache
- * @param[in] id Resource Id of the native image
- * @param[in] nativeImage The native image
- */
- void AddNativeImage( ResourceId id, NativeImageInterfacePtr nativeImage );
-
- /**
- * Create a framebuffer texture and add it to the texture cache
- * @param[in] id Resource Id of the native image
- * @param[in] width Width of the framebuffer
- * @param[in] height Height of the framebuffer
- * @param[in] pixelFormat Pixel format of the framebuffer
- * @param[in] bufferFormat Renderbuffer format of the framebuffer
- */
- void AddFrameBuffer( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat );
-
- /**
- * Create a framebuffer texture and add it to the texture cache
- * @param[in] id Resource Id of the native image
- * @param[in] nativeImage The NativeImage
- */
- void AddFrameBuffer( ResourceId id, NativeImageInterfacePtr nativeImage );
-
- /**
- * Create GL texture eagerly right now instead of waiting for first use.
- * @param[in] id The resource id corresponding to the texture.
- */
- void CreateGlTexture( ResourceId id );
-
- /**
- * Update the texture with a newly loaded bitmap
- * @param[in] id Resource Id of the bitmap
- * @param[in] bitmap The bitmap
- */
- void UpdateTexture( ResourceId id, Integration::BitmapPtr bitmap );
-
- /**
- * Update the texture with a newly loaded bitmap
- * @param[in] id Resource Id of the bitmap
- * @param[in] bitmap The bitmap
- * @param[in] xOffset Specifies an offset in the x direction within the texture
- * @param[in] yOffset Specifies an offset in the y direction within the texture
- */
- void UpdateTexture( ResourceId id, Integration::BitmapPtr bitmap, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Update the part of a texture with a newly loaded bitmap
- * May be called from Update thread
- * @param[in] destId The ID of the texture to update
- * @param[in] srcId The resource ID of the source bitmap
- * @param[in] xOffset Specifies an offset in the x direction within the texture
- * @param[in] yOffset Specifies an offset in the y direction within the texture
- */
- void UpdateTexture( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Update the texture with a pixel buffer
- * @param[in] id Resource Id of the bitmap
- * @param[in] pixelData The pixel data
- * @param[in] xOffset Specifies an offset in the x direction within the texture
- * @param[in] yOffset Specifies an offset in the y direction within the texture
- */
- void UpdateTexture( ResourceId id, PixelDataPtr pixelData, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Update the area of the texture from the associated bitmap
- * @param[in] id Resource Id of the bitmap
- * @param[in] area The area of the bitmap that has changed
- */
- void UpdateTextureArea( ResourceId id, const RectArea& area );
-
- /**
- * Discard texture associated with resource ID
- * @param[in] id Resource Id of the texture
- */
- void DiscardTexture( ResourceId id );
-
- /**
- * Bind a texture. On the first call, the texture will copy it's
- * pixel data to an OpenGL texture. If it's a BitmapTexture, then
- * it will also trigger SignalUpdated to be sent on the event thread
- * object.
- *
- * @param[in] texture pointer to the texture
- * @param[in] id Resource id of texture
- * @param[in] target (e.g. GL_TEXTURE_2D)
- * @param[in] textureunit to use
- *
- * @return true if the bind succeeded, false if either the create or bind failed.
- */
- bool BindTexture( Texture* texture, ResourceId id, GLenum target, TextureUnit textureunit );
-
- /**
- * Get the texture associated with the resource ID
- * May be a texture or a framebuffer
- * @param[in] id Resource Id of the texture
- * @return NULL if the GL resource hasn't yet been created,
- * or a valid pointer if it has.
- */
- Texture* GetTexture( ResourceId id );
-
- /**
- * Get the bitmaptexture associated with the resource ID
- * @param[in] id Resource Id of the texture
- * @return The texture or NULL
- */
- BitmapTexture* GetBitmapTexture(ResourceId id);
-
- /**
- * Get the framebuffer texture associated with the resource ID
- * Used for writing to the framebuffer
- * @param[in] id Resource Id of the framebuffer
- * @return the framebuffer
- */
- FrameBufferTexture* GetFramebuffer(ResourceId id);
-
- /**
- * Add a texture observer. Should be called in render thread
- * @param[in] id The resource id to watch
- * @param[in] observer The observer to add
- */
- void AddObserver( ResourceId id, TextureObserver* observer );
-
- /**
- * Remove a texture observer. Should be called in render thread
- * @param[in] id The resource id to stop watching
- * @param[in] observer The observer to remove
- */
- void RemoveObserver( ResourceId id, TextureObserver* observer );
-
- /**
- * Reset all textures.
- * This method is called when context is or has been deleted.
- */
- void GlContextDestroyed();
-
- /**
- * Set whether textures should retain or discard their bitmaps after upload to GL
- * @param[in] policy Whether to retain or discard bitmaps
- */
- void SetDiscardBitmapsPolicy( ResourcePolicy::Discardable policy );
-
- /**
- * Get the discard policy.
- * @return The discard policy.
- */
- ResourcePolicy::Discardable GetDiscardBitmapsPolicy();
-
-private:
-
- TextureUploadedDispatcher& mTextureUploadedDispatcher;
- Context& mContext;
- TextureContainer mTextures;
- TextureContainer mFramebufferTextures;
-
- typedef std::vector< TextureObserver* > TextureObservers;
- typedef TextureObservers::iterator TextureObserversIter;
-
- typedef std::map< ResourceId, TextureObservers > TextureResourceObservers;
- typedef TextureResourceObservers::iterator TextureResourceObserversIter;
-
- TextureResourceObservers mObservers;
- ResourcePolicy::Discardable mDiscardBitmapsPolicy;
-};
-
-
-
-} // SceneGraph
-} // Internal
-} // Dali
-
-#endif //__DALI_INTERNAL_SCENE_GRAPH_TEXTURE_CACHE_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXTURE_DECLARATIONS_H__
-#define __DALI_INTERNAL_TEXTURE_DECLARATIONS_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class Texture;
-typedef IntrusivePtr<Texture> TexturePointer;
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXTURE_DECLARATIONS_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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 "texture-factory.h"
-
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/gl-defines.h>
-#include <dali/internal/render/gl-resources/bitmap-texture.h>
-#include <dali/internal/render/gl-resources/compressed-bitmap-texture.h>
-#include <dali/internal/render/gl-resources/native-texture.h>
-#include <dali/internal/render/gl-resources/frame-buffer-texture.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
-
-
-namespace Dali
-{
-class NativeImageInterface;
-
-namespace Internal
-{
-
-namespace TextureFactory
-{
-
-Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap, Context& context, ResourcePolicy::Discardable discardPolicy )
-{
- DALI_ASSERT_DEBUG( bitmap );
- Texture * texture = 0;
- Integration::Bitmap::PackedPixelsProfile * const packedPixelBitmapView = bitmap->GetPackedPixelsProfile();
- if( packedPixelBitmapView )
- {
- texture = new BitmapTexture( bitmap, packedPixelBitmapView, context, discardPolicy );
- }
- else
- {
- Internal::BitmapCompressed * const compressedBitmap = dynamic_cast<Dali::Internal::BitmapCompressed*>( bitmap );
- if( compressedBitmap != 0 )
- {
- texture = new CompressedBitmapTexture( compressedBitmap, context, discardPolicy );
- }
- }
- if( texture )
- {
- if( !texture->Init() )
- {
- delete texture;
- return NULL;
- }
- }
- return texture;
-}
-
-Internal::Texture* NewBitmapTexture( unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels,
- Context& context,
- ResourcePolicy::Discardable discardPolicy )
-{
- Texture *texture=new BitmapTexture(width, height, pixelFormat, clearPixels, context, discardPolicy);
-
- return texture;
-}
-
-
-Internal::Texture* NewNativeImageTexture( NativeImageInterface& nativeImg, Context& context )
-{
- NativeTexture* texture = new NativeTexture(&nativeImg, context);
- if (!texture->Init())
- {
- delete texture;
- return NULL;
- }
- return texture;
-}
-
-Internal::Texture* NewFrameBufferTexture( unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- RenderBuffer::Format bufferFormat,
- Context& context )
-{
- FrameBufferTexture* texture = new FrameBufferTexture(width, height, pixelFormat, bufferFormat, context);
- if (!texture->Init())
- {
- delete texture;
- return NULL;
- }
- return texture;
-}
-
-Internal::Texture* NewFrameBufferTexture( NativeImageInterfacePtr nativeImage,
- Context& context )
-{
- FrameBufferTexture* texture = new FrameBufferTexture(nativeImage, context);
- if (!texture->Init())
- {
- delete texture;
- return NULL;
- }
- return texture;
-}
-
-
-
-} // TextureFactory
-} // Internal
-} // Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXTURE_FACTORY_H__
-#define __DALI_INTERNAL_TEXTURE_FACTORY_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-
-namespace Dali
-{
-class NativeImageInterface;
-
-namespace Integration
-{
-class Bitmap;
-}
-
-namespace Internal
-{
-class Context;
-class Texture;
-
-namespace TextureFactory
-{
-/**
- * Creates a new texture object from a Bitmap
- * @param[in] bitmap The Bitmap
- * @param[in] context The GL context
- * @return A newly allocated texture
- */
-Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap,
- Context& context,
- ResourcePolicy::Discardable discardPolicy );
-
-/**
- * Creates a new bitmap texture object of the given dimensions.
- * @param[in] width The width (pixels)
- * @param[in] height The height (pixels)
- * @param[in] pixelFormat The pixel format
- * @param[in] clearPixels True if the pixel data should be cleared first
- * @param[in] context The GL context
- */
-Internal::Texture* NewBitmapTexture( unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels,
- Context& context,
- ResourcePolicy::Discardable discardPolicy );
-
-/**
- * Creates a texture object from a native image (eg.: EGLImage).
- * @param[in] nativeImage The native image to load
- * @param[in] context The GL context
- * @return A newly allocated texture
- */
-Internal::Texture* NewNativeImageTexture( NativeImageInterface& nativeImage, Context& context );
-
-/**
- * @copydoc FrameBufferTexture::FrameBufferTexture
- * @return A newly allocated texture
- */
-Internal::Texture* NewFrameBufferTexture( unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- RenderBuffer::Format bufferFormat,
- Context& context );
-
-/**
- * @copydoc FrameBufferTexture::FrameBufferTexture
- * @return A newly allocated texture
- */
-Internal::Texture* NewFrameBufferTexture( NativeImageInterfacePtr nativeImage, Context& context );
-
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXTURE_FACTORY_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXTURE_OBSERVER_H__
-#define __DALI_INTERNAL_TEXTURE_OBSERVER_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-namespace Dali
-{
-namespace Internal
-{
-
-/**
- * The TextureObserver observes texture lifetime
- */
-class TextureObserver
-{
-public:
- /**
- * Called when a texture is discarded. This occurs in the render thread.
- * @param[in] textureId The resource id of the discarded texture
- */
- virtual void TextureDiscarded( unsigned int textureId ) = 0;
-
-protected:
- /**
- * Virtual destructor
- */
- virtual ~TextureObserver(){}
-};
-
-}//Internal
-}//Dali
-
-#endif // __DALI_INTERNAL_TEXTURE_OBSERVER_H__
context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
}
-void FrameBuffer::AttachColorTexture( Context& context, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( Context& context, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
{
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
{
namespace Render
{
-class NewTexture;
+class Texture;
class FrameBuffer
{
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTexture( Context& context, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer );
+ void AttachColorTexture( Context& context, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer );
/**
* @brief Bind the framebuffer
#include <dali/internal/render/shaders/scene-graph-shader.h>
#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/data-providers/node-data-provider.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/internal/render/gl-resources/gl-texture.h>
namespace Dali
{
StencilParameters& stencilParameters )
: mRenderDataProvider( dataProvider ),
mContext( NULL),
- mTextureCache( NULL ),
mGeometry( geometry ),
mUniformIndexMap(),
mAttributesLocation(),
}
}
-void Renderer::Initialize( Context& context, SceneGraph::TextureCache& textureCache )
+void Renderer::Initialize( Context& context )
{
mContext = &context;
- mTextureCache = &textureCache;
}
Renderer::~Renderer()
mUpdateAttributesLocation = true;
//Check that the number of textures match the number of samplers in the shader
- size_t textureCount = dataProvider->GetNewTextures().size();
+ size_t textureCount = dataProvider->GetTextures().size();
Program* program = dataProvider->GetShader().GetProgram();
if( program && program->GetActiveSamplerCount() != textureCount )
{
}
}
-bool Renderer::BindTextures( Context& context, SceneGraph::TextureCache& textureCache, Program& program )
+bool Renderer::BindTextures( Context& context, Program& program )
{
unsigned int textureUnit = 0;
bool result = true;
GLint uniformLocation(-1);
std::vector<Render::Sampler*>& samplers( mRenderDataProvider->GetSamplers() );
- std::vector<Render::NewTexture*>& newTextures( mRenderDataProvider->GetNewTextures() );
- for( size_t i(0); i<newTextures.size() && result; ++i )
+ std::vector<Render::Texture*>& textures( mRenderDataProvider->GetTextures() );
+ for( size_t i(0); i<textures.size() && result; ++i )
{
- if( newTextures[i] )
+ if( textures[i] )
{
- result = newTextures[i]->Bind(context, textureUnit, samplers[i] );
+ result = textures[i]->Bind(context, textureUnit, samplers[i] );
if( result && program.GetSamplerUniformLocation( i, uniformLocation ) )
{
program.SetUniform1i( uniformLocation, textureUnit );
}
void Renderer::Render( Context& context,
- SceneGraph::TextureCache& textureCache,
BufferIndex bufferIndex,
const SceneGraph::NodeDataProvider& node,
SceneGraph::Shader& defaultShader,
// Take the program into use so we can send uniforms to it
program->Use();
- if( DALI_LIKELY( BindTextures( context, textureCache, *program ) ) )
+ if( DALI_LIKELY( BindTextures( context, *program ) ) )
{
// Only set up and draw if we have textures and they are all valid
{
class SceneController;
class Shader;
-class TextureCache;
class NodeDataProvider;
}
* Second-phase construction.
* This is called when the renderer is inside render thread
* @param[in] context Context used by the renderer
- * @param[in] textureCache The texture cache to use
*/
- void Initialize( Context& context, SceneGraph::TextureCache& textureCache );
+ void Initialize( Context& context );
/**
* Destructor
/**
* Called to render during RenderManager::Render().
* @param[in] context The context used for rendering
- * @param[in] textureCache The texture cache used to get textures
* @param[in] bufferIndex The index of the previous update buffer.
* @param[in] node The node using this renderer
* @param[in] defaultShader in case there is no custom shader
* @param[in] blend If true, blending is enabled
*/
void Render( Context& context,
- SceneGraph::TextureCache& textureCache,
BufferIndex bufferIndex,
const SceneGraph::NodeDataProvider& node,
SceneGraph::Shader& defaultShader,
/**
* Bind the textures and setup the samplers
* @param[in] context The GL context
- * @param[in] textureCache The texture cache
* @param[in] program The shader program
* @return False if create or bind failed, true if success.
*/
- bool BindTextures( Context& context, SceneGraph::TextureCache& textureCache, Program& program );
+ bool BindTextures( Context& context, Program& program );
private:
OwnerPointer< SceneGraph::RenderDataProvider > mRenderDataProvider;
Context* mContext;
- SceneGraph::TextureCache* mTextureCache;
Render::Geometry* mGeometry;
struct UniformIndexMap
~Sampler()
{}
-
- union
+ bool operator==(const Sampler& rhs) const
{
- unsigned int mBitfield;
-
- struct
- {
- FilterMode mMinificationFilter : 4; ///< The minify filter
- FilterMode mMagnificationFilter : 4; ///< The magnify filter
- WrapMode mSWrapMode : 4; ///< The horizontal wrap mode
- WrapMode mTWrapMode : 4; ///< The vertical wrap mode
- WrapMode mRWrapMode : 4; ///< The vertical wrap mode
- };
-
- };
+ return ( ( mMinificationFilter == rhs.mMinificationFilter ) &&
+ ( mMagnificationFilter == rhs.mMagnificationFilter ) &&
+ ( mSWrapMode == rhs.mSWrapMode ) &&
+ ( mTWrapMode == rhs.mTWrapMode ) &&
+ ( mRWrapMode == rhs.mRWrapMode ) );
+ }
+
+ bool operator!=(const Sampler& rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ FilterMode mMinificationFilter : 4; ///< The minify filter
+ FilterMode mMagnificationFilter : 4; ///< The magnify filter
+ WrapMode mSWrapMode : 4; ///< The horizontal wrap mode
+ WrapMode mTWrapMode : 4; ///< The vertical wrap mode
+ WrapMode mRWrapMode : 4; ///< The vertical wrap mode
};
} // namespace Render
} //Unnamed namespace
-NewTexture::NewTexture( Type type, Pixel::Format format, unsigned int width, unsigned int height )
+Texture::Texture( Type type, Pixel::Format format, unsigned int width, unsigned int height )
:mId( 0 ),
mTarget( (type == TextureType::TEXTURE_2D)? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP ),
mType( type ),
PixelFormatToGl( format, mPixelDataType, mInternalFormat );
}
-NewTexture::NewTexture( NativeImageInterfacePtr nativeImageInterface )
+Texture::Texture( NativeImageInterfacePtr nativeImageInterface )
:mId( 0 ),
mTarget( GL_TEXTURE_2D ),
mType( TextureType::TEXTURE_2D ),
{
}
-NewTexture::~NewTexture()
+Texture::~Texture()
{}
-void NewTexture::Destroy( Context& context )
+void Texture::Destroy( Context& context )
{
if( mId )
{
}
}
-void NewTexture::GlContextDestroyed()
+void Texture::GlContextDestroyed()
{
mId = 0u;
}
-void NewTexture::Initialize(Context& context)
+void Texture::Initialize(Context& context)
{
if( mNativeImage )
{
}
}
-void NewTexture::Upload( Context& context, PixelDataPtr pixelData, const Internal::NewTexture::UploadParams& params )
+void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal::Texture::UploadParams& params )
{
DALI_ASSERT_ALWAYS( mNativeImage == NULL );
delete[] tempBuffer;
}
-bool NewTexture::Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler )
+bool Texture::Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler )
{
if( mNativeImage && mId == 0 )
{
return false;
}
-void NewTexture::ApplySampler( Context& context, Render::Sampler* sampler )
+void Texture::ApplySampler( Context& context, Render::Sampler* sampler )
{
Render::Sampler oldSampler = mSampler;
mSampler = sampler ? *sampler : Sampler();
- if( mSampler.mBitfield != oldSampler.mBitfield )
+ if( mSampler != oldSampler )
{
GLint mode = FilterModeToGL( mSampler.mMinificationFilter, DALI_MINIFY_DEFAULT, GL_MINIFY_DEFAULT );
if( mode != FilterModeToGL( oldSampler.mMinificationFilter, DALI_MINIFY_DEFAULT, GL_MINIFY_DEFAULT ) )
}
}
-bool NewTexture::HasAlphaChannel()
+bool Texture::HasAlphaChannel()
{
return mHasAlpha;
}
-void NewTexture::GenerateMipmaps( Context& context )
+void Texture::GenerateMipmaps( Context& context )
{
context.BindTexture( mTarget, mId );
context.GenerateMipmap( mTarget );
#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/render/renderers/render-sampler.h>
#include <dali/integration-api/gl-defines.h>
-#include <dali/integration-api/resource-declarations.h>
namespace Dali
{
{
struct Sampler;
-/**
- * This class is the mapping between texture id, sampler and sampler uniform name
- */
class Texture
{
public:
- /**
- * Constructor
- */
- Texture()
- : mSampler( 0 ),
- mTextureId( Integration::InvalidResourceId )
- {}
-
- /**
- * Constructor
- */
- Texture( Integration::ResourceId textureId, Render::Sampler* sampler )
- : mSampler( sampler ),
- mTextureId( textureId)
- {}
-
- /**
- * Destructor
- */
- ~Texture()
- {}
-
- /*
- * Get the Render::Sampler used by the texture
- * @Return The Render::Sampler being used or 0 if using the default
- */
- inline const Render::Sampler* GetSampler() const
- {
- return mSampler;
- }
-
-public: // called from RenderThread
-
- /**
- * Get the texture ID
- * @return the id of the associated texture
- */
- inline Integration::ResourceId GetTextureId() const
- {
- return mTextureId;
- }
-
-private:
-
- Render::Sampler* mSampler;
- Integration::ResourceId mTextureId;
-};
-
-
-//TODO : Remove the old Render::Texture class (see above) once it is no longer needed by Image
-class NewTexture
-{
-public:
-
typedef Dali::TextureType::Type Type;
/**
* @param[in] width The width of the texture
* @param[in] height The height of the texture
*/
- NewTexture( Type type, Pixel::Format format, unsigned int width, unsigned int height );
+ Texture( Type type, Pixel::Format format, unsigned int width, unsigned int height );
/**
* Constructor from native image
* @param[in] nativeImageInterface The native image
*/
- NewTexture( NativeImageInterfacePtr nativeImageInterface );
+ Texture( NativeImageInterfacePtr nativeImageInterface );
/**
* Destructor
*/
- ~NewTexture();
+ ~Texture();
/**
* Creates the texture in the GPU.
* @param[in] pixelData A pixel data object
* @param[in] params Upload parameters. See UploadParams
*/
- void Upload( Context& context, PixelDataPtr pixelData, const Internal::NewTexture::UploadParams& params );
+ void Upload( Context& context, PixelDataPtr pixelData, const Internal::Texture::UploadParams& params );
/**
* Bind the texture to the given texture unit and applies the given sampler
// INTERNAL INCLUDES
#include <dali/integration-api/gl-defines.h>
#include <dali/internal/common/shader-saver.h>
-#include <dali/internal/render/common/texture-uploaded-dispatcher.h>
#include <dali/internal/render/gl-resources/gl-call-debug.h>
#include <dali/internal/render/shaders/program.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
namespace Dali
{
RenderQueue& mRenderQueue; ///< Used to send GL clean-up messages for the next Render.
// Messages are queued here following the current update buffer number
- NodeOwnerContainer mNodeQueue[2];
+ OwnerContainer< Node* > mNodeQueue[2];
ShaderQueue mShaderQueue[2];
RendererQueue mRendererQueue[2];
CameraQueue mCameraQueue[2];
+++ /dev/null
-/*
- * Copyright (c) 2016 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/internal/update/common/texture-cache-dispatcher.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-// value types used by messages
-template <> struct ParameterType< Pixel::Format > : public BasicType< Pixel::Format > {};
-template <> struct ParameterType< RenderBuffer::Format > : public BasicType< RenderBuffer::Format > {};
-
-namespace SceneGraph
-{
-
-TextureCacheDispatcher::TextureCacheDispatcher( RenderQueue& renderQueue, TextureCache& textureCache )
-: mRenderQueue( renderQueue ),
- mTextureCache( textureCache ),
- mSceneGraphBuffers(NULL)
-{
-}
-
-TextureCacheDispatcher::~TextureCacheDispatcher()
-{
-}
-
-void TextureCacheDispatcher::SetBufferIndices( const SceneGraphBuffers* bufferIndices )
-{
- mSceneGraphBuffers = bufferIndices;
-}
-
-/********************************************************************************
- ********************** Implements TextureCacheDispatcher *********************
- ********************************************************************************/
-
-void TextureCacheDispatcher::DispatchCreateTexture( ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue5< TextureCache, ResourceId, unsigned int, unsigned int, Pixel::Format, bool > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::CreateTexture, id, width, height, pixelFormat, clearPixels );
- }
-}
-
-void TextureCacheDispatcher::DispatchCreateTextureForBitmap( ResourceId id, Integration::Bitmap* bitmap )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue2< TextureCache, ResourceId, Integration::BitmapPtr > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::AddBitmap, id, bitmap );
- }
-}
-
-void TextureCacheDispatcher::DispatchCreateTextureForNativeImage( ResourceId id, NativeImageInterfacePtr nativeImage )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue2< TextureCache, ResourceId, NativeImageInterfacePtr > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::AddNativeImage, id, nativeImage );
- }
-}
-
-void TextureCacheDispatcher::DispatchCreateGlTexture( ResourceId id )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue1< TextureCache, ResourceId > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::CreateGlTexture, id );
- }
-}
-
-void TextureCacheDispatcher::DispatchCreateTextureForFrameBuffer( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue5< TextureCache, ResourceId, unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::AddFrameBuffer, id, width, height, pixelFormat, bufferFormat );
- }
-}
-
-void TextureCacheDispatcher::DispatchCreateTextureForFrameBuffer( ResourceId id, NativeImageInterfacePtr nativeImage )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue2< TextureCache, ResourceId, NativeImageInterfacePtr > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::AddFrameBuffer, id, nativeImage );
- }
-}
-
-void TextureCacheDispatcher::DispatchUpdateTexture( ResourceId id, Integration::Bitmap* bitmap )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue2< TextureCache, ResourceId, Integration::BitmapPtr > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::UpdateTexture, id, bitmap );
- }
-}
-
-void TextureCacheDispatcher::DispatchUpdateTexture( ResourceId id, Integration::BitmapPtr bitmap , std::size_t xOffset, std::size_t yOffset)
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue4< TextureCache, ResourceId, Integration::BitmapPtr, std::size_t, std::size_t > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::UpdateTexture, id, bitmap, xOffset, yOffset );
- }
-}
-
-void TextureCacheDispatcher::DispatchUpdateTexture( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue4< TextureCache, ResourceId, ResourceId, std::size_t, std::size_t > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::UpdateTexture, destId, srcId, xOffset, yOffset );
- }
-}
-
-void TextureCacheDispatcher::DispatchUpdateTexture( ResourceId id, PixelDataPtr pixelData , std::size_t xOffset, std::size_t yOffset)
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue4< TextureCache, ResourceId, PixelDataPtr, std::size_t, std::size_t > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::UpdateTexture, id, pixelData, xOffset, yOffset );
- }
-}
-
-void TextureCacheDispatcher::DispatchUpdateTextureArea( ResourceId id, const Dali::RectArea& area )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue2< TextureCache, ResourceId, Dali::RectArea > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::UpdateTextureArea, id, area );
- }
-}
-
-void TextureCacheDispatcher::DispatchDiscardTexture( ResourceId id )
-{
- // NULL, means being shutdown, so ignore msgs
- if( mSceneGraphBuffers != NULL )
- {
- typedef MessageValue1< TextureCache, ResourceId > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mRenderQueue.ReserveMessageSlot( mSceneGraphBuffers->GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mTextureCache, &TextureCache::DiscardTexture, id );
- }
-}
-
-} // SceneGraph
-
-} // Internal
-
-} // Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_TEXTURE_CACHE_DISPATCHER_H__
-#define __DALI_INTERNAL_TEXTURE_CACHE_DISPATCHER_H__
-
-/*
- * Copyright (c) 2016 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/buffer-image.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/pixel.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/event/images/pixel-data-impl.h>
-#include <dali/internal/update/common/scene-graph-buffers.h>
-#include <dali/integration-api/resource-declarations.h>
-#include <dali/integration-api/bitmap.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-typedef Integration::ResourceId ResourceId;
-
-namespace SceneGraph
-{
-
-class RenderQueue;
-class TextureCache;
-
-class TextureCacheDispatcher
-{
-public:
-
- /**
- * Constructor
- * @param[in] renderQueue The queue on which to send messages
- * @param[in] textureCache The Texture Cache object to which to send messages
- */
- TextureCacheDispatcher( RenderQueue& renderQueue, TextureCache& textureCache );
-
- /**
- * Destructor.
- */
- ~TextureCacheDispatcher();
-
- /**
- * mRenderQueue needs the update buffer index when any of the dispatch methods are
- * called. Should really store a functor to get this index, but existing functors
- * use references. Could heap allocate the functor, but that seems overly wasteful.
- * Instead, store a pointer to the SceneGraphBuffers object, and call the relevant
- * function when required. (increases coupling, requires object lifetime management :/ )
- *
- * @param[in] bufferIndices Pointer to SceneGraphBuffers object that can query
- * the current RenderQueue buffer index.
- */
- void SetBufferIndices( const SceneGraphBuffers* bufferIndices );
-
- /**
- * Dispatch a message to create an empty texture and add it to the texture cache.
- * May be called from Update thread
- * @param[in] id Resource Id of the texture
- * @param[in] width Width of the texture
- * @param[in] height Height of the texture
- * @param[in] pixelFormat Pixel format of the texture
- * @param[in] clearPixels True if the data should be cleared to 0 on creation
- */
- void DispatchCreateTexture( ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- bool clearPixels );
-
- /**
- * Dispatch a message to add a texture for bitmap.
- * May be called from Update thread
- * @param[in] id Resource Id of the bitmap
- * @param[in] bitmap The bitmap
- */
- void DispatchCreateTextureForBitmap( ResourceId id, Integration::Bitmap* bitmap );
-
- /**
- * Dispatch a message to add a native image to the texture cache
- * May be called from Update thread
- * @param[in] id Resource Id of the native image
- * @param[in] nativeImage The native image
- */
- void DispatchCreateTextureForNativeImage( ResourceId id, NativeImageInterfacePtr nativeImage );
-
- /**
- * Dispatch a message to create a framebuffer texture and add it to the texture cache
- * May be called from Update thread
- * @param[in] id Resource Id of the framebuffer
- * @param[in] width Width of the framebuffer
- * @param[in] height Height of the framebuffer
- * @param[in] pixelFormat Pixel format of the framebuffer
- */
- void DispatchCreateTextureForFrameBuffer( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat );
-
- /**
- * Dispatch a message to create a framebuffer texture and add it to the texture cache
- * May be called from Update thread
- * @param[in] id Resource Id of the framebuffer
- * @param[in] nativeImage The NativeImage
- */
- void DispatchCreateTextureForFrameBuffer( ResourceId id, NativeImageInterfacePtr nativeImage );
-
- /**
- * @brief Create GL texture for native image resource.
- * @param[in] id The resource id.
- */
- void DispatchCreateGlTexture( ResourceId id );
-
- /**
- * Dispatch a message to update the texture.
- * May be called from Update thread
- * @param[in] id Resource Id of the texture
- * @param[in] bitmap The updated bitmap
- */
- void DispatchUpdateTexture( ResourceId id, Integration::Bitmap* bitmap );
-
- /**
- * Dispatch a message to update the part of a texture with the bitmap data.
- * May be called from Update thread
- * @param[in] destId The ID of the texture to update
- * @param[in] bitmap The pointer pointing to the source bitmap data.
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void DispatchUpdateTexture( ResourceId id, Integration::BitmapPtr bitmap, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Dispatch a message to update the part of a texture with a newly loaded bitmap
- * May be called from Update thread
- * @param[in] destId The ID of the texture to update
- * @param[in] srcId The resource ID of the source bitmap
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void DispatchUpdateTexture( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Dispatch a message to update the part of a texture with the pixel data.
- * May be called from Update thread
- * @param[in] destId The ID of the texture to update
- * @param[in] pixelData The pointer pointing to the pixel data to upload.
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void DispatchUpdateTexture( ResourceId id, PixelDataPtr pixelData, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Dispatch a message to update the texture area
- * May be called from the Update thread
- * @param[in] id Resource Id of the texture
- * @param[in] area The area of the bitmap that has changed
- */
- void DispatchUpdateTextureArea( ResourceId id, const RectArea& area );
-
- /**
- * Dispatch a message to discard a texture
- * May be called from Update thread
- * @param[in] id Resource Id of the texture
- */
- void DispatchDiscardTexture( ResourceId id );
-
-protected:
-
- RenderQueue& mRenderQueue;
- TextureCache& mTextureCache;
- const SceneGraphBuffers* mSceneGraphBuffers;
-};
-
-} // SceneGraph
-
-} // Internal
-
-} // Dali
-
-#endif // __DALI_INTERNAL_TEXTURE_CACHE_DISPATCHER_H__
// INTERNAL INCLUDES
#include <dali/internal/render/common/render-manager.h>
#include <dali/internal/render/queue/render-queue.h>
+#include <dali/internal/render/renderers/render-renderer.h>
#include <dali/internal/common/message.h>
namespace Dali
void RenderMessageDispatcher::AddRenderer( Render::Renderer& renderer )
{
- typedef MessageValue1< RenderManager, Render::Renderer* > DerivedType;
+ // Message has ownership of renderer while in transit from update -> render
+ typedef MessageValue1< RenderManager, OwnerPointer< Render::Renderer > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
#include <dali/internal/update/manager/sorted-layers.h>
#include <dali/internal/update/render-tasks/scene-graph-render-task.h>
#include <dali/internal/update/rendering/scene-graph-texture-set.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
#include <dali/internal/render/common/render-item.h>
#include <dali/internal/render/common/render-tracker.h>
#include <dali/internal/render/common/render-instruction.h>
* Whilst iterating through each layer, update the RenderItems ModelView matrices
*
* The opaque and transparent render lists are sorted first by depth
- * index, then by Z (for transparent only), then by shader, texture
+ * index, then by Z (for transparent only), then by shader
* and geometry. The render algorithm should then work through both
* lists simultaneously, working through opaque then transparent
* items at each depth index, resetting the flags appropriately.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 const float gDefaultTransformComponentAnimatableData[] = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
//Default values for anchor point (CENTER) and parent origin (TOP_LEFT)
-static const float gDefaultTransformComponentStaticData[] = { 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f };
+static const float gDefaultTransformComponentStaticData[] = { 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f, true };
DALI_COMPILE_TIME_ASSERT( sizeof(gDefaultTransformComponentAnimatableData) == sizeof(TransformComponentAnimatable) );
DALI_COMPILE_TIME_ASSERT( sizeof(gDefaultTransformComponentStaticData) == sizeof(TransformComponentStatic) );
+
+/**
+ * @brief Calculates the center position for the transform component
+ * @param[out] centerPosition The calculated center-position of the transform component
+ * @param[in] transformComponentStatic A const reference to the static component transform struct
+ * @param[in] transformComponentAnimatable A const reference to the animatable component transform struct
+ * @param[in] size The size of the current transform component
+ * @param[in] half Halfway point of the transform
+ * @param[in] topLeft The top-left coords of the transform
+ */
+inline void CalculateCenterPosition(
+ Vector3& centerPosition,
+ const TransformComponentStatic& transformComponentStatic,
+ const TransformComponentAnimatable& transformComponentAnimatable,
+ const Vector3& size,
+ const Vector3& half,
+ const Vector3& topLeft )
+{
+ // Calculate the center-point by applying the scale and rotation on the anchor point.
+ centerPosition = ( half - transformComponentStatic.mAnchorPoint ) * size * transformComponentAnimatable.mScale;
+ centerPosition *= transformComponentAnimatable.mOrientation;
+
+ // If the position is ignoring the anchor-point, then remove the anchor-point shift from the position.
+ if( ! transformComponentStatic.mPositionUsesAnchorPoint )
+ {
+ centerPosition -= ( topLeft - transformComponentStatic.mAnchorPoint ) * size;
+ }
}
+} // unnamed namespace
+
TransformManager::TransformManager()
:mComponentCount(0),
mReorder(false)
}
//Iterate through all components to compute its world matrix
- Vector3 anchorPosition;
+ Vector3 centerPosition;
Vector3 localPosition;
- Vector3 half( 0.5f,0.5f,0.5f );
+ const Vector3 half( 0.5f,0.5f,0.5f );
+ const Vector3 topLeft( 0.0f, 0.0f, 0.5f );
for( unsigned int i(0); i<mComponentCount; ++i )
{
if( DALI_LIKELY( mInheritanceMode[i] != DONT_INHERIT_TRANSFORM && mParent[i] != INVALID_TRANSFORM_ID ) )
{
//Full transform inherited
mLocalMatrixDirty[i] = true;
-
- anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
- anchorPosition *= mTxComponentAnimatable[i].mOrientation;
- localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
- mLocal[i].SetTransformComponents( mTxComponentAnimatable[i].mScale,mTxComponentAnimatable[i].mOrientation, localPosition );
+ CalculateCenterPosition( centerPosition, mTxComponentStatic[ i ], mTxComponentAnimatable[ i ], mSize[ i ], half, topLeft );
+ localPosition = mTxComponentAnimatable[i].mPosition + centerPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
+ mLocal[i].SetTransformComponents( mTxComponentAnimatable[i].mScale, mTxComponentAnimatable[i].mOrientation, localPosition );
}
//Update the world matrix
}
else
{
- anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
- anchorPosition *= mTxComponentAnimatable[i].mOrientation;
- localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
+ CalculateCenterPosition( centerPosition, mTxComponentStatic[ i ], mTxComponentAnimatable[ i ], mSize[ i ], half, topLeft );
+ localPosition = mTxComponentAnimatable[i].mPosition + centerPosition + ( mTxComponentStatic[i].mParentOrigin - half ) * mSize[parentIndex];
mLocal[i].SetTransformComponents( localScale, localOrientation, localPosition );
Matrix::Multiply( mWorld[i], mLocal[i], parentMatrix );
}
}
else //Component has no parent or doesn't inherit transform
{
- anchorPosition = ( half - mTxComponentStatic[i].mAnchorPoint ) * mSize[i] * mTxComponentAnimatable[i].mScale;
- anchorPosition *= mTxComponentAnimatable[i].mOrientation;
- localPosition = mTxComponentAnimatable[i].mPosition + anchorPosition;
+ CalculateCenterPosition( centerPosition, mTxComponentStatic[ i ], mTxComponentAnimatable[ i ], mSize[ i ], half, topLeft );
+ localPosition = mTxComponentAnimatable[i].mPosition + centerPosition;
mLocal[i].SetTransformComponents( mTxComponentAnimatable[i].mScale, mTxComponentAnimatable[i].mOrientation, localPosition );
mWorld[i] = mLocal[i];
mLocalMatrixDirty[i] = true;
size = mSize[index];
}
+void TransformManager::SetPositionUsesAnchorPoint( TransformId id, bool value )
+{
+ unsigned int index( mIds[ id ] );
+ mComponentDirty[ index ] = true;
+ mTxComponentStatic[ index ].mPositionUsesAnchorPoint = value;
+}
+
} //namespace SceneGraph
} //namespace Internal
} //namespace Dali
-
-#ifndef TRANSFORM_MANAGER_H_
-#define TRANSFORM_MANAGER_H_
+#ifndef DALI_INTERNAL_TRANSFORM_MANAGER_H
+#define DALI_INTERNAL_TRANSFORM_MANAGER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/common/constants.h>
#include <dali/internal/update/manager/free-list.h>
namespace Dali
struct TransformComponentAnimatable
{
TransformComponentAnimatable()
- :mScale(1.0f,1.0f,1.0f),
- mOrientation(1.0f,0.0f,0.0f,0.0f),
- mPosition(0.0f,0.0f,0.0f)
- {}
+ : mScale( Vector3::ONE ),
+ mOrientation( Quaternion::IDENTITY ),
+ mPosition( Vector3::ZERO )
+ {
+ }
Vector3 mScale;
Quaternion mOrientation;
struct TransformComponentStatic
{
TransformComponentStatic()
- :mAnchorPoint(0.5f,0.5f,0.5f),
- mParentOrigin(0.0f,0.0f,0.5f)
- {}
+ : mAnchorPoint( AnchorPoint::DEFAULT ),
+ mParentOrigin( ParentOrigin::DEFAULT ),
+ mPositionUsesAnchorPoint( true )
+ {
+ }
Vector3 mAnchorPoint;
Vector3 mParentOrigin;
+ bool mPositionUsesAnchorPoint;
};
enum InheritanceMode
*/
void GetWorldMatrixAndSize( TransformId id, Matrix& worldMatrix, Vector3& size ) const;
+ /**
+ * @brief Sets the boolean which states whether the position should use the anchor-point on the given transform component.
+ * @param[in] id Id of the transform component
+ * @param[in] value True if the position should use the anchor-point
+ */
+ void SetPositionUsesAnchorPoint( TransformId id, bool value );
+
private:
//Helper struct to order components
*/
void ReorderComponents();
- unsigned int mComponentCount; ///< Total number of components
- FreeList mIds; ///< FreeList of Ids
- Vector<TransformComponentAnimatable> mTxComponentAnimatable; ///< Animatable part of the components
- Vector<TransformComponentStatic> mTxComponentStatic; ///< Static part of the components
- Vector<unsigned int> mInheritanceMode; ///< Inheritance mode of the components
- Vector<TransformId> mComponentId; ///< Ids of the components
- Vector<Vector3> mSize; ///< Size of the components
- Vector<TransformId> mParent; ///< Parent of the components
- Vector<Matrix> mWorld; ///< Local to world transform of the components
- Vector<Matrix> mLocal; ///< Local to parent space transform of the components
- Vector<Vector4> mBoundingSpheres; ///< Bounding spheres. xyz is the center and w is the radius
- Vector<TransformComponentAnimatable> mTxComponentAnimatableBaseValue; ///< Base values for the animatable part of the components
- Vector<Vector3> mSizeBase; ///< Base value for the size of the components
- Vector<bool> mComponentDirty; ///< 1u if some of the parts of the component has changed in this frame, 0 otherwise
- Vector<bool> mLocalMatrixDirty; ///< 1u if the local matrix has been updated in this frame, 0 otherwise
- Vector<SOrderItem> mOrderedComponents; ///< Used to reorder components when hierarchy changes
- bool mReorder; ///< Flag to determine if the components have to reordered in the next Update
+ unsigned int mComponentCount; ///< Total number of components
+ FreeList mIds; ///< FreeList of Ids
+ Vector< TransformComponentAnimatable > mTxComponentAnimatable; ///< Animatable part of the components
+ Vector< TransformComponentStatic > mTxComponentStatic; ///< Static part of the components
+ Vector< unsigned int > mInheritanceMode; ///< Inheritance mode of the components
+ Vector< TransformId > mComponentId; ///< Ids of the components
+ Vector< Vector3 > mSize; ///< Size of the components
+ Vector< TransformId > mParent; ///< Parent of the components
+ Vector< Matrix > mWorld; ///< Local to world transform of the components
+ Vector< Matrix > mLocal; ///< Local to parent space transform of the components
+ Vector< Vector4 > mBoundingSpheres; ///< Bounding spheres. xyz is the center and w is the radius
+ Vector< TransformComponentAnimatable > mTxComponentAnimatableBaseValue; ///< Base values for the animatable part of the components
+ Vector< Vector3 > mSizeBase; ///< Base value for the size of the components
+ Vector< bool > mComponentDirty; ///< 1u if some of the parts of the component has changed in this frame, 0 otherwise
+ Vector< bool > mLocalMatrixDirty; ///< 1u if the local matrix has been updated in this frame, 0 otherwise
+ Vector< SOrderItem > mOrderedComponents; ///< Used to reorder components when hierarchy changes
+ bool mReorder; ///< Flag to determine if the components have to reordered in the next Update
};
} //namespace SceneGraph
} //namespace Dali
-#endif /* TRANSFORM_MANAGER_H_ */
+#endif // DALI_INTERNAL_TRANSFORM_MANAGER_H
#include <dali/public-api/actors/draw-mode.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/vector3.h>
-#include <dali/internal/update/resources/resource-manager.h>
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/animation/scene-graph-constraint-base.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
inline int UpdateNodes( Node& node,
int parentFlags,
BufferIndex updateBufferIndex,
- ResourceManager& resourceManager,
RenderQueue& renderQueue,
Layer& currentLayer,
int inheritedDrawMode )
cumulativeDirtyFlags |=UpdateNodes( child,
nodeDirtyFlags,
updateBufferIndex,
- resourceManager,
renderQueue,
*layer,
inheritedDrawMode );
*/
int UpdateNodeTree( Layer& rootNode,
BufferIndex updateBufferIndex,
- ResourceManager& resourceManager,
RenderQueue& renderQueue )
{
DALI_ASSERT_DEBUG( rootNode.IsRoot() );
cumulativeDirtyFlags |= UpdateNodes( child,
nodeDirtyFlags,
updateBufferIndex,
- resourceManager,
renderQueue,
rootNode,
drawMode );
namespace Internal
{
-class ResourceManager;
-
namespace SceneGraph
{
* The inherited properties of each node are recalculated if necessary.
* @param[in] rootNode The root of a tree of nodes.
* @param[in] updateBufferIndex The current update buffer index.
- * @param[in] resourceManager The resource manager.
* @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,
- ResourceManager& resourceManager,
RenderQueue& renderQueue );
} // namespace SceneGraph
#include <dali/internal/update/animation/scene-graph-animation.h>
#include <dali/internal/update/common/discard-queue.h>
#include <dali/internal/update/common/scene-graph-buffers.h>
-#include <dali/internal/update/common/texture-cache-dispatcher.h>
#include <dali/internal/update/controllers/render-message-dispatcher.h>
#include <dali/internal/update/controllers/scene-controller-impl.h>
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/update/render-tasks/scene-graph-render-task.h>
#include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
#include <dali/internal/update/rendering/scene-graph-texture-set.h>
-#include <dali/internal/update/resources/resource-manager.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
#include <dali/internal/render/common/render-instruction-container.h>
#include <dali/internal/render/common/render-manager.h>
#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
// Un-comment to enable node tree debug logging
Impl( NotificationManager& notificationManager,
CompleteNotificationInterface& animationFinishedNotifier,
PropertyNotifier& propertyNotifier,
- ResourceManager& resourceManager,
DiscardQueue& discardQueue,
RenderController& renderController,
RenderManager& renderManager,
animationFinishedNotifier( animationFinishedNotifier ),
propertyNotifier( propertyNotifier ),
shaderSaver( NULL ),
- resourceManager( resourceManager ),
discardQueue( discardQueue ),
renderController( renderController ),
sceneController( NULL ),
renderInstructions( renderManager.GetRenderInstructionContainer() ),
renderTaskProcessor( renderTaskProcessor ),
backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
- taskList( renderMessageDispatcher, resourceManager ),
- systemLevelTaskList( renderMessageDispatcher, resourceManager ),
+ taskList( renderMessageDispatcher ),
+ systemLevelTaskList( renderMessageDispatcher ),
root( NULL ),
systemLevelRoot( NULL ),
renderers( sceneGraphBuffers, discardQueue ),
for(;iter!=endIter;++iter)
{
(*iter)->OnDestroy();
- delete(*iter);
+ Node::Delete(*iter);
}
// If there is root, reset it, otherwise do nothing as rendering was never started
{
root->OnDestroy();
- delete root;
+ Node::Delete( root );
root = NULL;
}
{
systemLevelRoot->OnDestroy();
- delete systemLevelRoot;
+ Node::Delete( systemLevelRoot );
systemLevelRoot = NULL;
}
CompleteNotificationInterface& animationFinishedNotifier; ///< Provides notification to applications when animations are finished.
PropertyNotifier& propertyNotifier; ///< Provides notification to applications when properties are modified.
ShaderSaver* shaderSaver; ///< Saves shader binaries.
- ResourceManager& resourceManager; ///< resource manager
DiscardQueue& discardQueue; ///< Nodes are added here when disconnected from the scene-graph.
RenderController& renderController; ///< render controller
SceneControllerImpl* sceneController; ///< scene controller
UpdateManager::UpdateManager( NotificationManager& notificationManager,
CompleteNotificationInterface& animationFinishedNotifier,
PropertyNotifier& propertyNotifier,
- ResourceManager& resourceManager,
DiscardQueue& discardQueue,
RenderController& controller,
RenderManager& renderManager,
RenderQueue& renderQueue,
- TextureCacheDispatcher& textureCacheDispatcher,
RenderTaskProcessor& renderTaskProcessor )
: mImpl(NULL)
{
mImpl = new Impl( notificationManager,
animationFinishedNotifier,
propertyNotifier,
- resourceManager,
discardQueue,
controller,
renderManager,
mSceneGraphBuffers,
renderTaskProcessor );
- textureCacheDispatcher.SetBufferIndices( &mSceneGraphBuffers );
}
UpdateManager::~UpdateManager()
// And add the renderers to the sorted layers. Start from root, which is also a layer
mImpl->nodeDirtyFlags = UpdateNodeTree( *( mImpl->root ),
bufferIndex,
- mImpl->resourceManager,
mImpl->renderQueue );
if ( mImpl->systemLevelRoot )
{
mImpl->nodeDirtyFlags |= UpdateNodeTree( *( mImpl->systemLevelRoot ),
bufferIndex,
- mImpl->resourceManager,
mImpl->renderQueue );
}
}
//Clear nodes/resources which were previously discarded
mImpl->discardQueue.Clear( bufferIndex );
- //Grab any loaded resources
- bool resourceChanged = mImpl->resourceManager.UpdateCache( bufferIndex );
-
//Process Touches & Gestures
const bool gestureUpdated = ProcessGestures( bufferIndex, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds );
(mImpl->nodeDirtyFlags & RenderableUpdateFlags) || // ..nodes were dirty in previous frame OR
IsAnimationRunning() || // ..at least one animation is running OR
mImpl->messageQueue.IsSceneUpdateRequired() || // ..a message that modifies the scene graph node tree is queued OR
- resourceChanged || // ..one or more resources were updated/changed OR
gestureUpdated; // ..a gesture property was updated
void UpdateManager::AddSampler( Render::Sampler* sampler )
{
- typedef MessageValue1< RenderManager, Render::Sampler* > DerivedType;
+ // Message has ownership of Sampler while in transit from update to render
+ typedef MessageValue1< RenderManager, OwnerPointer< Render::Sampler > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
void UpdateManager::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer )
{
- typedef MessageValue1< RenderManager, Render::PropertyBuffer* > DerivedType;
+ // Message has ownership of format while in transit from update -> render
+ typedef MessageValue1< RenderManager, OwnerPointer< Render::PropertyBuffer > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
void UpdateManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format )
{
- typedef MessageValue2< RenderManager, Render::PropertyBuffer*, Render::PropertyBuffer::Format* > DerivedType;
+ // Message has ownership of format while in transit from update -> render
+ typedef MessageValue2< RenderManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size )
{
- typedef MessageValue3< RenderManager, Render::PropertyBuffer*, Dali::Vector<char>*, size_t > DerivedType;
+ // Message has ownership of format while in transit from update -> render
+ typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector<char> >, size_t > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
void UpdateManager::AddGeometry( Render::Geometry* geometry )
{
- typedef MessageValue1< RenderManager, Render::Geometry* > DerivedType;
+ // Message has ownership of format while in transit from update -> render
+ typedef MessageValue1< RenderManager, OwnerPointer< Render::Geometry > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddVertexBuffer, geometry, propertyBuffer );
}
-void UpdateManager::AddTexture( Render::NewTexture* texture )
+void UpdateManager::AddTexture( Render::Texture* texture )
{
- typedef MessageValue1< RenderManager, Render::NewTexture* > DerivedType;
+ // Message has ownership of Texture while in transit from update -> render
+ typedef MessageValue1< RenderManager, OwnerPointer< Render::Texture > > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddTexture, texture );
}
-void UpdateManager::RemoveTexture( Render::NewTexture* texture)
+void UpdateManager::RemoveTexture( Render::Texture* texture)
{
- typedef MessageValue1< RenderManager, Render::NewTexture* > DerivedType;
+ typedef MessageValue1< RenderManager, Render::Texture* > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveTexture, texture );
}
-void UpdateManager::UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params )
+void UpdateManager::UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
{
- typedef MessageValue3< RenderManager, Render::NewTexture*, PixelDataPtr, NewTexture::UploadParams > DerivedType;
+ typedef MessageValue3< RenderManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > DerivedType;
// Reserve some memory inside the message queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::UploadTexture, texture, pixelData, params );
}
-void UpdateManager::GenerateMipmaps( Render::NewTexture* texture )
+void UpdateManager::GenerateMipmaps( Render::Texture* texture )
{
- typedef MessageValue1< RenderManager, Render::NewTexture* > DerivedType;
+ typedef MessageValue1< RenderManager, Render::Texture* > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveFrameBuffer, frameBuffer );
}
-void UpdateManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
+void UpdateManager::AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
{
- typedef MessageValue4< RenderManager, Render::FrameBuffer*, Render::NewTexture*, unsigned int, unsigned int > DerivedType;
+ typedef MessageValue4< RenderManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
+#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/update/render-tasks/scene-graph-camera.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
#include <dali/internal/render/renderers/render-property-buffer.h>
#include <dali/internal/event/rendering/texture-impl.h>
class PropertyNotifier;
class NotificationManager;
class CompleteNotificationInterface;
-class ResourceManager;
class TouchResampler;
namespace Render
class Animation;
class DiscardQueue;
-class PanGesture;
class RenderManager;
class RenderTaskList;
class RenderTaskProcessor;
class RenderQueue;
-class TextureCacheDispatcher;
class PropertyBuffer;
class TextureSet;
-class Camera;
/**
* UpdateManager maintains a scene graph i.e. a tree of nodes as well as
* @param[in] notificationManager This should be notified when animations have finished.
* @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
* @param[in] propertyNotifier The PropertyNotifier
- * @param[in] resourceManager The resource manager used to load textures etc.
* @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
* @param[in] controller After messages are flushed, we request a render from the RenderController.
* @param[in] renderManager This is responsible for rendering the results of each "update".
* @param[in] renderQueue Used to queue messages for the next render.
- * @param[in] textureCacheDispatcher Used for sending messages to texture cache.
* @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
*/
UpdateManager( NotificationManager& notificationManager,
CompleteNotificationInterface& animationFinishedNotifier,
PropertyNotifier& propertyNotifier,
- ResourceManager& resourceManager,
DiscardQueue& discardQueue,
Integration::RenderController& controller,
RenderManager& renderManager,
RenderQueue& renderQueue,
- TextureCacheDispatcher& textureCacheDispatcher,
RenderTaskProcessor& renderTaskProcessor );
/**
* @param[in] texture The texture to add
* The texture will be owned by RenderManager
*/
- void AddTexture( Render::NewTexture* texture );
+ void AddTexture( Render::Texture* texture );
/**
* Removes a texture from the render manager
* @param[in] texture The texture to remove
* @post The texture will be destroyed in the render thread
*/
- void RemoveTexture( Render::NewTexture* texture );
+ void RemoveTexture( Render::Texture* texture );
/**
* Uploads data to a texture owned by the RenderManager
* @param[in] pixelData The pixel data object
* @param[in] params The parameters for the upload
*/
- void UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params );
+ void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
/**
* Generates mipmaps for a texture owned by the RenderManager
* @param[in] texture The texture
*/
- void GenerateMipmaps( Render::NewTexture* texture );
+ void GenerateMipmaps( Render::Texture* texture );
/**
* Adds a framebuffer to the render manager
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int face );
+ void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int face );
public:
inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
{
- typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
+ // Message has ownership of Layer while in transit from event -> update
+ typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void AddNodeMessage( UpdateManager& manager, Node& node )
{
+ // Message has ownership of Node while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
// Reserve some memory inside the message queue
inline void AddCameraMessage( UpdateManager& manager, const Camera* constCamera )
{
- typedef MessageValue1< UpdateManager, Camera* > LocalType;
+ // Message has ownership of Camera while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
Camera* camera = const_cast<Camera*>( constCamera );
// Reserve some memory inside the message queue
inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
{
+ // Message has ownership of object while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
// Reserve some memory inside the message queue
inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
{
- typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
+ // Message has ownership of PropertyNotification while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
{
- typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
+ // Message has ownership of PanGesture while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< PanGesture > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void AddSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
{
- typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
+ // Message has ownership of Sampler while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void AddPropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
{
- typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType;
+ // Message has ownership of propertyBuffer while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Render::PropertyBuffer::Format* format )
{
- typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, Render::PropertyBuffer::Format* > LocalType;
+ // Message has ownership of PropertyBuffer::Format while in transit from event -> update
+ typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data, size_t size )
{
- typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, Vector<char>*, size_t > LocalType;
+ // Message has ownership of PropertyBuffer data while in transit from event -> update
+ typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<char> >, size_t > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
inline void AddGeometry( UpdateManager& manager, Render::Geometry& geometry )
{
- typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType;
+ // Message has ownership of Geometry while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
}
-inline void AddTexture( UpdateManager& manager, Render::NewTexture& texture )
+inline void AddTexture( UpdateManager& manager, Render::Texture& texture )
{
- typedef MessageValue1< UpdateManager, Render::NewTexture* > LocalType;
+ // Message has ownership of Texture while in transit from event -> update
+ typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::AddTexture, &texture );
}
-inline void RemoveTexture( UpdateManager& manager, Render::NewTexture& texture )
+inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
{
- typedef MessageValue1< UpdateManager, Render::NewTexture* > LocalType;
+ typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
}
-inline void UploadTextureMessage( UpdateManager& manager, Render::NewTexture& texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params )
+inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
{
- typedef MessageValue3< UpdateManager, Render::NewTexture*, PixelDataPtr, NewTexture::UploadParams > LocalType;
+ typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
}
-inline void GenerateMipmapsMessage( UpdateManager& manager, Render::NewTexture& texture )
+inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
{
- typedef MessageValue1< UpdateManager, Render::NewTexture* > LocalType;
+ typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
}
-inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
+inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
{
- typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::NewTexture*, unsigned int, unsigned int > LocalType;
+ typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
class Node;
-typedef OwnerContainer< Node* > NodeOwnerContainer;
-
typedef Dali::Vector< Node* > NodeContainer;
typedef NodeContainer::Iterator NodeIter;
typedef NodeContainer::ConstIterator NodeConstIter;
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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 //Unnamed namespace
{
-//Memory pool used to allocate new nodes. Memory used by this pool will be released when shutting down DALi
+//Memory pool used to allocate new nodes. Memory used by this pool will be released when process dies
+// or DALI library is unloaded
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;
+
+// Called when the process is about to exit, Node count should be zero at this point.
+void __attribute__ ((destructor)) ShutDown(void)
+{
+DALI_ASSERT_DEBUG( (gNodeCount == 0) && "Node memory leak");
+}
+#endif
}
namespace Dali
const PositionInheritanceMode Node::DEFAULT_POSITION_INHERITANCE_MODE( INHERIT_PARENT_POSITION );
const ColorMode Node::DEFAULT_COLOR_MODE( USE_OWN_MULTIPLY_PARENT_ALPHA );
+
Node* Node::New()
{
return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node();
}
+void Node::Delete( Node* node )
+{
+ // check we have a node not a layer
+ if( !node->mIsLayer )
+ {
+ // Manually call the destructor
+ node->~Node();
+
+ // Mark the memory it used as free in the memory pool
+ gNodeMemoryPool.FreeThreadSafe( node );
+ }
+ else
+ {
+ // not in the pool, just delete it.
+ delete node;
+ }
+}
+
Node::Node()
: mTransformManager( NULL ),
mTransformId( INVALID_TRANSFORM_ID ),
mDrawMode( DrawMode::NORMAL ),
mColorMode( DEFAULT_COLOR_MODE ),
mClippingMode( ClippingMode::DISABLED ),
- mIsRoot( false )
+ mIsRoot( false ),
+ mIsLayer( false ),
+ mPositionUsesAnchorPoint( true )
{
mUniformMapChanged[0] = 0u;
mUniformMapChanged[1] = 0u;
+
+#ifdef DEBUG_ENABLED
+ gNodeCount++;
+#endif
+
}
Node::~Node()
{
mTransformManager->RemoveTransform(mTransformId);
}
-}
-void Node::operator delete( void* ptr )
-{
- gNodeMemoryPool.FreeThreadSafe( static_cast<Node*>( ptr ) );
+#ifdef DEBUG_ENABLED
+ gNodeCount--;
+#endif
}
void Node::OnDestroy()
mWorldScale.Initialize( transformManager, mTransformId );
mWorldOrientation.Initialize( transformManager, mTransformId );
mWorldMatrix.Initialize( transformManager, mTransformId );
+
+ //Set whether the position should use the anchor point
+ transformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
}
void Node::SetRoot(bool isRoot)
} // namespace SceneGraph
+template <>
+void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
+{
+ if( mObject != NULL )
+ {
+ Dali::Internal::SceneGraph::Node::Delete( mObject );
+ mObject = NULL;
+ }
+}
+
} // namespace Internal
+template <>
+void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete(Dali::Internal::SceneGraph::Node* pointer)
+{
+ Dali::Internal::SceneGraph::Node::Delete( pointer );
+}
+
} // namespace Dali
static Node* New();
/**
- * Virtual destructor
+ * Deletes a Node.
*/
- virtual ~Node();
-
- /**
- * Overriden delete operator
- * Deletes the node from its global memory pool
- */
- void operator delete( void* ptr );
+ static void Delete( Node* node );
/**
* Called during UpdateManager::DestroyNode shortly before Node is destroyed.
*/
bool IsLayer()
{
- return (GetLayer() != NULL);
+ return mIsLayer;
}
/**
int GetDirtyFlags() const;
/**
- * Query whether a node is clean.
- * @return True if the node is clean.
- */
- bool IsClean() const
- {
- return ( NothingFlag == GetDirtyFlags() );
- }
-
- /**
* Retrieve the parent-origin of the node.
* @return The parent-origin.
*/
*/
unsigned int GetDepthIndex(){ return mDepthIndex; }
+ /**
+ * @brief Sets the boolean which states whether the position should use the anchor-point.
+ * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
+ */
+ void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
+ {
+ if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
+ {
+ mPositionUsesAnchorPoint = positionUsesAnchorPoint;
+ mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
+ }
+ }
+
public:
/**
* @copydoc UniformMap::Add
*/
Node();
+ /**
+ * Protected virtual destructor; See also Node::Delete( Node* )
+ * Kept protected to allow destructor chaining from layer
+ */
+ virtual ~Node();
+
private: // from NodeDataProvider
/**
ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node
bool mIsRoot:1; ///< True if the node cannot have a parent
-
+ bool mIsLayer:1; ///< True if the node is a layer
+ bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
// Changes scope, should be at end of class
DALI_LOG_OBJECT_STRING_DECLARATION;
};
new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
}
+inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
+{
+ typedef MessageValue1< Node, bool > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* 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 );
+}
} // namespace SceneGraph
+// Template specialisation for OwnerPointer<Node>, because delete is protected
+template <>
+void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset();
+
} // namespace Internal
+// Template specialisations for OwnerContainer<Node*>, because delete is protected
+template <>
+void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer );
+
} // namespace Dali
#endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H
SceneGraph::Layer* Layer::New()
{
+ // Layers are currently heap allocated, unlike Nodes which are in a memory pool
+ // However Node::Delete( layer ) will correctly delete a layer / node depending on type
return new Layer();
}
mDepthTestDisabled( true ),
mIsDefaultSortFunction( true )
{
+ // set a flag the node to say this is a layer
+ mIsLayer = true;
+
// layer starts off dirty
mAllChildTransformsClean[ 0 ] = false;
mAllChildTransformsClean[ 1 ] = false;
} // namespace SceneGraph
+template <>
+void OwnerPointer<Dali::Internal::SceneGraph::Layer>::Reset()
+{
+ if( mObject != NULL )
+ {
+ Dali::Internal::SceneGraph::Node::Delete( mObject );
+ mObject = NULL;
+ }
+}
} // namespace Internal
} // namespace Dali
static SceneGraph::Layer* New();
/**
- * Virtual destructor
- */
- virtual ~Layer();
-
- /**
* From Node, to convert a node to a layer.
* @return The layer.
*/
// Undefined
Layer(const Layer&);
+ /**
+ * Virtual destructor
+ */
+ virtual ~Layer();
+
// Undefined
Layer& operator=(const Layer& rhs);
} // namespace SceneGraph
+// Template specialisation for OwnerPointer<Layer>, because delete is protected
+template <>
+void OwnerPointer<Dali::Internal::SceneGraph::Layer>::Reset();
+
} // namespace Internal
} // namespace Dali
~Impl()
{
// Delete the current buffer
- delete currentMessageBuffer;
+ if( currentMessageBuffer )
+ {
+ DeleteBufferContents( currentMessageBuffer );
+ delete currentMessageBuffer;
+ }
// Delete the unprocessed buffers
const MessageBufferIter processQueueEndIter = processQueue.end();
namespace SceneGraph
{
-RenderTaskList::RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager )
+RenderTaskList::RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher )
: mNotificationObject( NULL ),
- mRenderMessageDispatcher( renderMessageDispatcher ),
- mResourceManager( resourceManager )
+ mRenderMessageDispatcher( renderMessageDispatcher )
{
}
// mRenderTasks container takes ownership
mRenderTasks.PushBack( newTask );
- newTask->Initialize( mRenderMessageDispatcher, mResourceManager );
+ newTask->Initialize( mRenderMessageDispatcher );
}
void RenderTaskList::RemoveTask( RenderTask* task )
namespace Internal
{
-class ResourceManager;
+
class CompleteNotificationInterface;
namespace SceneGraph
/**
* Constructor
* @param renderMessageDispatcher to send messages
- * @param resourceManager to pass to render tasks
*/
- RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager );
+ RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher );
/**
* Destructor
CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
RenderMessageDispatcher& mRenderMessageDispatcher; ///< for sending messages to render thread
- ResourceManager& mResourceManager; ///< The resource manager (render tasks need this)
RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
};
inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, RenderTask& task )
{
- typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
+ // Message has ownership of the RenderTask while in transit from event -> update
+ typedef MessageValue1< RenderTaskList, OwnerPointer< RenderTask > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// INTERNAL INCLUDES
#include <dali/public-api/math/matrix.h>
#include <dali/internal/update/controllers/render-message-dispatcher.h>
-#include <dali/internal/update/resources/resource-manager.h>
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/render/common/render-instruction.h>
#include <dali/internal/render/common/render-tracker.h>
}
}
-void RenderTask::Initialize( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager )
+void RenderTask::Initialize( RenderMessageDispatcher& renderMessageDispatcher )
{
mRenderMessageDispatcher = &renderMessageDispatcher;
- mResourceManager = &resourceManager;
}
void RenderTask::SetSourceNode( Node* node )
mViewportSize( Vector2::ZERO),
mClearColor( Dali::RenderTask::DEFAULT_CLEAR_COLOR ),
mRenderMessageDispatcher( NULL ),
- mResourceManager( NULL ),
mRenderSyncTracker( NULL ),
mSourceNode( NULL ),
mCameraNode( NULL ),
namespace Internal
{
class FrameBufferTexture;
-class ResourceManager;
namespace Render
{
/**
* Initialize the render task. Called in update thread
* @param[in] renderMessageDispatcher to send messages to render thread
- * @param[in] resourceManager to check and update status of FBOs
*/
- void Initialize( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager );
+ void Initialize( RenderMessageDispatcher& renderMessageDispatcher );
/**
* Set the nodes to be rendered.
private:
RenderMessageDispatcher* mRenderMessageDispatcher;
- ResourceManager* mResourceManager;
Render::RenderTracker* mRenderSyncTracker;
Node* mSourceNode;
Node* mCameraNode;
if( mTextureSet )
{
- size_t textureCount = mTextureSet->GetNewTextureCount();
- dataProvider->mNewTextures.resize( textureCount );
+ size_t textureCount = mTextureSet->GetTextureCount();
+ dataProvider->mTextures.resize( textureCount );
dataProvider->mSamplers.resize( textureCount );
for( unsigned int i(0); i<textureCount; ++i )
{
- dataProvider->mNewTextures[i] = mTextureSet->GetNewTexture(i);
+ dataProvider->mTextures[i] = mTextureSet->GetTexture(i);
dataProvider->mSamplers[i] = mTextureSet->GetTextureSampler(i);
}
}
NotifyChangeToRenderers();
}
-void TextureSet::SetTexture( size_t index, Render::NewTexture* texture )
+void TextureSet::SetTexture( size_t index, Render::Texture* texture )
{
const size_t textureCount( mTextures.Size() );
if( textureCount < index + 1 )
{
namespace Internal
{
-class ResourceManager;
namespace Render
{
struct Sampler;
-class NewTexture;
+class Texture;
}
namespace SceneGraph
{
* @param[in] index The index of the texture
* @param[in] texture The texture
*/
- void SetTexture( size_t index, Render::NewTexture* texture );
+ void SetTexture( size_t index, Render::Texture* texture );
/**
* Return whether any texture in the texture set has an alpha channel
}
/**
- * Get the number of NewTextures in the texture set
- * @return The number of NewTextures
+ * Get the number of Textures in the texture set
+ * @return The number of Textures
*/
- size_t GetNewTextureCount()
+ size_t GetTextureCount()
{
return mTextures.Size();
}
/**
- * Get the pointer to a NewTexture in the TextureSet
+ * Get the pointer to a Texture in the TextureSet
* @param[in] index The index of the texture in the textures array
- * @return the pointer to the NewTexture in that position
+ * @return the pointer to the Texture in that position
*/
- Render::NewTexture* GetNewTexture( size_t index )
+ Render::Texture* GetTexture( size_t index )
{
return mTextures[index];
}
private: // Data
Vector< Render::Sampler* > mSamplers; ///< List of samplers used by each texture. Not owned
- Vector< Render::NewTexture* > mTextures; ///< List of NewTextures. Not owned
+ Vector< Render::Texture* > mTextures; ///< List of Textures. Not owned
Vector<Renderer*> mRenderers; ///< List of renderers using the TextureSet
bool mHasAlpha; ///< if any of the textures has an alpha channel
};
-inline void SetTextureMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::NewTexture* texture )
+inline void SetTextureMessage( EventThreadServices& eventThreadServices, const TextureSet& textureSet, size_t index, Render::Texture* texture )
{
- typedef MessageValue2< TextureSet, size_t, Render::NewTexture* > LocalType;
+ typedef MessageValue2< TextureSet, size_t, Render::Texture* > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_MANAGER_DECLARATIONS_H__
-#define __DALI_INTERNAL_RESOURCE_MANAGER_DECLARATIONS_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/threading/mutex.h>
-#include <dali/integration-api/resource-cache.h>
-#include <dali/internal/update/common/double-buffered.h>
-#include <dali/public-api/common/dali-vector.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-typedef Integration::ResourceId ResourceId;
-
-/**
- * Post processing required on the resource after the resource has been modified by the render thread
- * Should only be handled by update thread
- */
-
-typedef Dali::Vector< ResourceId > TextureUploadedQueue;
-
-class LockedResourceQueue
-{
-
-public:
- void PushBack( ResourceId request )
- {
- Dali::Mutex::ScopedLock lock( mMutex );
- mQueue.PushBack( request );
- }
-
- bool IsEmpty() const
- {
- Dali::Mutex::ScopedLock lock( mMutex );
- return mQueue.Empty();
- }
-
- void SwapQueue( TextureUploadedQueue& list )
- {
- Dali::Mutex::ScopedLock lock( mMutex );
- list.Clear();
- mQueue.Swap( list );
- }
-
-private:
-
- TextureUploadedQueue mQueue;
- mutable Dali::Mutex mMutex;
-};
-
-
-} // Internal
-} // Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_MANAGER_DECLARATIONS_H__
+++ /dev/null
-/*
- * 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.
- * 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/internal/update/resources/resource-manager.h>
-
-// EXTERNAL INCLUDES
-#include <stdio.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/common/map-wrapper.h>
-#include <dali/devel-api/common/set-wrapper.h>
-
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/common/dali-vector.h>
-
-#include <dali/integration-api/debug.h>
-
-#include <dali/internal/common/message.h>
-#include <dali/internal/common/image-attributes.h>
-
-#include <dali/internal/event/common/notification-manager.h>
-#include <dali/internal/event/resources/resource-type-path.h>
-
-#include <dali/internal/update/common/discard-queue.h>
-#include <dali/internal/update/common/texture-cache-dispatcher.h>
-#include <dali/internal/update/resources/texture-metadata.h>
-
-#include <dali/internal/render/queue/render-queue.h>
-
-using namespace Dali::Integration;
-
-using Dali::Internal::SceneGraph::DiscardQueue;
-using Dali::Internal::SceneGraph::RenderQueue;
-using Dali::Internal::SceneGraph::TextureCacheDispatcher;
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-typedef std::set<ResourceId> LiveRequestContainer;
-typedef LiveRequestContainer::iterator LiveRequestIter;
-typedef LiveRequestContainer::size_type LiveRequestSize;
-
-typedef std::map<ResourceId, ResourceTypeId> DeadRequestContainer;
-typedef DeadRequestContainer::iterator DeadRequestIter;
-typedef std::pair<ResourceId, ResourceTypeId> DeadRequestPair;
-
-typedef std::vector<ResourceId> NotifyQueue;
-typedef NotifyQueue::iterator NotifyQueueIter;
-
-typedef Dali::Vector<TextureMetadata> TextureMetadataCache;
-typedef TextureMetadataCache::Iterator TextureMetadataIter;
-
-static inline bool RemoveId( LiveRequestContainer& container, ResourceId id )
-{
- return container.erase(id) != 0;
-}
-
-struct ResourceManager::ResourceManagerImpl
-{
- ResourceManagerImpl( PlatformAbstraction& platformAbstraction,
- NotificationManager& notificationManager,
- SceneGraph::TextureCacheDispatcher& textureCacheDispatcher,
- LockedResourceQueue& textureUploadedQueue,
- DiscardQueue& discardQueue,
- RenderQueue& renderQueue )
- : mPlatformAbstraction(platformAbstraction),
- mNotificationManager(notificationManager),
- mTextureCacheDispatcher(textureCacheDispatcher),
- mTextureUploadedQueue(textureUploadedQueue),
- mTextureUploadedProcessingQueue(),
- mDiscardQueue(discardQueue),
- mRenderQueue(renderQueue),
- mNotificationCount(0),
- cacheUpdated(false)
- {
- mTextureMetadata.Reserve( 256 ); // reserve size for metadata to avoid early re-allocs in application startup
- }
-
- ~ResourceManagerImpl()
- {
- }
-
- PlatformAbstraction& mPlatformAbstraction;
- NotificationManager& mNotificationManager;
- TextureCacheDispatcher& mTextureCacheDispatcher;
- LockedResourceQueue& mTextureUploadedQueue;
- TextureUploadedQueue mTextureUploadedProcessingQueue;
- DiscardQueue& mDiscardQueue; ///< Unwanted resources are added here during UpdateCache()
- RenderQueue& mRenderQueue;
- unsigned int mNotificationCount;
- bool cacheUpdated; ///< returned by UpdateCache(). Set true in NotifyTickets to indicate a change in a resource
-
- /**
- * These containers are used to processs requests, and ResourceCache callbacks.
- * The live request containers are simply sets of integer resource ids.
- * The ID of a new request will be placed in the loading container.
- * If the Ticket is destroyed during the load, the ID will be removed.
- * If the load fails, the ID will be moved to the failed container.
- * When the Ticket is notified of the failure, the ID will be removed.
- * If the load succeeds, the ID will be moved to the new-completed container.
- * When the Ticket is notified of the completion, the ID will be moved to the old-completed container.
- * If a Ticket is destroyed after a successful load, the ID will be moved to the dead container.
- * When the resources are eventually deleted, the ID will be removed from the dead container.
- */
- LiveRequestContainer loadingRequests;
- LiveRequestContainer newCompleteRequests;
- LiveRequestContainer oldCompleteRequests;
- LiveRequestContainer newFailedRequests;
- LiveRequestContainer oldFailedRequests;
- DeadRequestContainer deadRequests;
-
- /**
- * This is the resource cache; metadata of the textures
- */
- TextureMetadataCache mTextureMetadata;
-};
-
-ResourceManager::ResourceManager( PlatformAbstraction& platformAbstraction,
- NotificationManager& notificationManager,
- TextureCacheDispatcher& textureCacheDispatcher,
- LockedResourceQueue& resourcePostProcessQueue,
- DiscardQueue& discardQueue,
- RenderQueue& renderQueue )
-{
- mImpl = new ResourceManagerImpl( platformAbstraction,
- notificationManager,
- textureCacheDispatcher,
- resourcePostProcessQueue,
- discardQueue,
- renderQueue );
-}
-
-ResourceManager::~ResourceManager()
-{
- delete mImpl;
-}
-
-/********************************************************************************
- ************************ UpdateManager direct interface ***********************
- ********************************************************************************/
-
-bool ResourceManager::UpdateCache( BufferIndex updateBufferIndex )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::Verbose, "ResourceManager: UpdateCache(bufferIndex:%u)\n", updateBufferIndex);
-
- // 1) Move unwanted resources to the DiscardQueue
-
- DiscardDeadResources( updateBufferIndex );
-
- // 2) Fill the resource cache
- mImpl->cacheUpdated = false;
-
- mImpl->mPlatformAbstraction.GetResources(*this);
-
- return mImpl->cacheUpdated;
-}
-
-/********************************************************************************
- *************************** CoreImpl direct interface *************************
- ********************************************************************************/
-
-bool ResourceManager::ResourcesToProcess()
-{
- bool workTodo = false;
-
- // need to make sure we have passed all the notifications to the event handling side
- workTodo |= !mImpl->newCompleteRequests.empty();
- workTodo |= !mImpl->newFailedRequests.empty();
- // check if there's something still loading
- workTodo |= !mImpl->loadingRequests.empty();
-
- return workTodo;
-}
-
-
-/********************************************************************************
- ********************************* Message handlers *****************************
- ********************************************************************************/
-
-void ResourceManager::HandleLoadResourceRequest( ResourceId id, const ResourceTypePath& typePath, LoadResourcePriority priority )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleLoadResourceRequest(id:%u, path:%s, type.id:%d)\n", id, typePath.path.c_str(), typePath.type->id);
-
- // Add ID to the loading set
- mImpl->loadingRequests.insert(id);
-
- // Make the load request last
- mImpl->mPlatformAbstraction.LoadResource(ResourceRequest(id, *typePath.type, typePath.path, priority));
-}
-
-void ResourceManager::HandleDecodeResourceRequest(
- ResourceId id,
- const ResourceTypePath& typePath,
- RequestBufferPtr buffer,
- Integration::LoadResourcePriority priority )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleDecodeResourceRequest(id:%u, buffer.size:%u, type.id:%u)\n", id, buffer->GetVector().Size(), typePath.type->id);
-
- // Add ID to the loading set
- mImpl->loadingRequests.insert(id);
-
- // Make the load request, stuffing the buffer of encoded bytes into the same field used when saving resources:
- mImpl->mPlatformAbstraction.LoadResource(ResourceRequest(id, *typePath.type, "", buffer, priority));
-}
-
-void ResourceManager::HandleAddBitmapImageRequest( ResourceId id, BitmapPtr bitmap )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleAddBitmapImageRequest(id:%u)\n", id);
-
- mImpl->oldCompleteRequests.insert(id);
- mImpl->mTextureMetadata.PushBack( TextureMetadata::New( id, bitmap.Get() ) );
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForBitmap( id, bitmap.Get() );
-}
-
-void ResourceManager::HandleAddNativeImageRequest(ResourceId id, NativeImageInterfacePtr nativeImage)
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleAddNativeImageRequest(id:%u)\n", id);
-
- mImpl->oldCompleteRequests.insert(id);
-
- mImpl->mTextureMetadata.PushBack( TextureMetadata::New( id, nativeImage ) );
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForNativeImage( id, nativeImage );
-}
-
-void ResourceManager::HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleAddFrameBufferImageRequest(id:%u)\n", id);
-
- mImpl->oldCompleteRequests.insert(id);
-
- TextureMetadata bitmapMetadata = TextureMetadata::New( id, width, height, Pixel::HasAlpha(pixelFormat) );
- bitmapMetadata.SetIsFramebuffer(true);
- mImpl->mTextureMetadata.PushBack( bitmapMetadata );
-
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForFrameBuffer( id, width, height, pixelFormat, bufferFormat );
-}
-
-void ResourceManager::HandleAddFrameBufferImageRequest( ResourceId id, NativeImageInterfacePtr nativeImage )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleAddFrameBufferImageRequest(id:%u)\n", id);
-
- mImpl->oldCompleteRequests.insert(id);
-
- TextureMetadata bitmapMetadata = TextureMetadata::New(id, nativeImage);
- bitmapMetadata.SetIsNativeImage(true);
- bitmapMetadata.SetIsFramebuffer(true);
- mImpl->mTextureMetadata.PushBack( bitmapMetadata );
-
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForFrameBuffer( id, nativeImage );
-}
-
-void ResourceManager::HandleAllocateTextureRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleAllocateTextureRequest(id:%u)\n", id);
-
- mImpl->oldCompleteRequests.insert(id);
- // atlas needs metadata as well
- TextureMetadata bitmapMetadata = TextureMetadata::New( id, width, height, Pixel::HasAlpha(pixelFormat) );
- mImpl->mTextureMetadata.PushBack( bitmapMetadata );
-
- mImpl->mTextureCacheDispatcher.DispatchCreateTexture( id, width, height, pixelFormat, true /* true = clear the texture */ );
-}
-
-void ResourceManager::HandleUpdateBitmapAreaRequest( ResourceId textureId, const RectArea& area )
-{
- if( textureId )
- {
- mImpl->mTextureCacheDispatcher.DispatchUpdateTextureArea( textureId, area );
- }
-}
-
-void ResourceManager::HandleUploadBitmapRequest( ResourceId destId, Integration::BitmapPtr bitmap, std::size_t xOffset, std::size_t yOffset )
-{
- if( destId && bitmap )
- {
- mImpl->mTextureCacheDispatcher.DispatchUpdateTexture( destId, bitmap, xOffset, yOffset );
- }
-}
-
-void ResourceManager::HandleUploadBitmapRequest( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset )
-{
- if( destId && srcId )
- {
- mImpl->mTextureCacheDispatcher.DispatchUpdateTexture( destId, srcId, xOffset, yOffset );
- }
-}
-
-void ResourceManager::HandleUploadBitmapRequest( ResourceId destId, PixelDataPtr pixelData, std::size_t xOffset, std::size_t yOffset )
-{
- if( destId && pixelData )
- {
- mImpl->mTextureCacheDispatcher.DispatchUpdateTexture( destId, pixelData, xOffset, yOffset );
- }
-}
-
-void ResourceManager::HandleReloadResourceRequest( ResourceId id, const ResourceTypePath& typePath, LoadResourcePriority priority, bool resetFinishedStatus )
-{
- DALI_LOG_INFO( Debug::Filter::gResource, Debug::General, "ResourceManager: HandleReloadRequest(id:%u, path:%s)\n", id, typePath.path.c_str() );
-
- if( resetFinishedStatus )
- {
- if( ! RemoveId( mImpl->newCompleteRequests, id ) )
- {
- RemoveId( mImpl->oldCompleteRequests, id );
- }
- }
-
- // ID might be in the loading set
- LiveRequestIter iter = mImpl->loadingRequests.find( id );
- if ( iter == mImpl->loadingRequests.end() )
- {
- // Add ID to the loading set
- mImpl->loadingRequests.insert(id);
- }
-}
-
-void ResourceManager::HandleDiscardResourceRequest( ResourceId deadId, ResourceTypeId typeId )
-{
- bool wasComplete = false;
- bool wasLoading = false;
-
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: HandleDiscardResourceRequest(id:%u)\n", deadId);
-
- // Search for the ID in one of the live containers
- // IDs are only briefly held in the new-completed or failed containers; check those last
- // Try removing from the old-completed requests
- bool foundLiveRequest = wasComplete = RemoveId(mImpl->oldCompleteRequests, deadId);
-
- // Try removing from the loading requests
- if (!foundLiveRequest)
- {
- foundLiveRequest = wasLoading = RemoveId(mImpl->loadingRequests, deadId);
- }
-
- // Try removing from the new completed requests
- if (!foundLiveRequest)
- {
- foundLiveRequest = wasComplete = RemoveId(mImpl->newCompleteRequests, deadId);
- }
-
- // Try removing from the new failed requests
- if (!foundLiveRequest)
- {
- foundLiveRequest = RemoveId(mImpl->newFailedRequests, deadId);
- }
-
- // Try removing from the old failed requests
- if (!foundLiveRequest)
- {
- foundLiveRequest = RemoveId(mImpl->oldFailedRequests, deadId);
- }
-
- // ID should be in one of the live sets
- if (!foundLiveRequest)
- {
- DALI_LOG_WARNING("HandleDiscardResourceRequest: ID should be in one of the live sets!\n");
- }
- DALI_ASSERT_DEBUG(foundLiveRequest);
-
- if (wasComplete)
- {
- if(typeId == ResourceBitmap ||
- typeId == ResourceNativeImage ||
- typeId == ResourceTargetImage )
- {
- // remove the meta data
-
- TextureMetadataCache::Iterator iter = mImpl->mTextureMetadata.Begin();
- const TextureMetadataCache::Iterator end = mImpl->mTextureMetadata.End();
- for( ; iter != end; ++iter )
- {
- if( (*iter).GetId() == deadId )
- {
- break;
- }
- }
- if( iter != end )
- {
- mImpl->mTextureMetadata.Erase( iter );
- }
-
- // destroy the texture
- mImpl->mTextureCacheDispatcher.DispatchDiscardTexture( deadId );
- }
- else
- {
- // Move ID from completed to dead set
- mImpl->deadRequests.insert(DeadRequestPair(deadId, typeId));
- }
- }
-
- if (wasLoading)
- {
- mImpl->mPlatformAbstraction.CancelLoad(deadId, typeId);
- }
-}
-
-void ResourceManager::HandleCreateGlTextureRequest(ResourceId id)
-{
- mImpl->mTextureCacheDispatcher.DispatchCreateGlTexture( id );
-}
-
-/********************************************************************************
- ******************** Update thread object direct interface ********************
- ********************************************************************************/
-
-bool ResourceManager::IsResourceLoaded( ResourceId id ) const
-{
- bool loaded = false;
-
- if( id > 0 )
- {
- LiveRequestIter iter = mImpl->newCompleteRequests.find(id);
- if( iter != mImpl->newCompleteRequests.end() )
- {
- loaded = true;
- }
- else
- {
- iter = mImpl->oldCompleteRequests.find(id);
- if( iter != mImpl->oldCompleteRequests.end() )
- {
- loaded = true;
- }
- }
- }
-
- return loaded;
-}
-
-bool ResourceManager::HasResourceLoadFailed( ResourceId id ) const
-{
- bool loadFailed = false;
-
- if( id > 0 )
- {
- LiveRequestIter iter = mImpl->newFailedRequests.find(id);
- if( iter != mImpl->newFailedRequests.end() )
- {
- loadFailed = true;
- }
- else
- {
- iter = mImpl->oldFailedRequests.find(id);
- if( iter != mImpl->oldFailedRequests.end() )
- {
- loadFailed = true;
- }
- }
- }
-
- return loadFailed;
-}
-
-void ResourceManager::SetFrameBufferBeenRenderedTo( ResourceId id, bool value )
-{
- TextureMetadata* metadata = NULL;
- if( GetTextureMetadata( id, metadata ) )
- {
- metadata->SetFrameBufferBeenRenderedTo( value );
- }
-}
-
-bool ResourceManager::HasFrameBufferBeenRenderedTo( ResourceId id ) const
-{
- bool retval( false );
- TextureMetadata* metadata = NULL;
- if( GetTextureMetadata( id, metadata ) )
- {
- retval = metadata->HasFrameBufferBeenRenderedTo();
- }
- return retval;
-}
-
-bool ResourceManager::GetTextureMetadata( ResourceId id, TextureMetadata*& metadata ) const
-{
- if( id > 0 )
- {
- const size_t count = mImpl->mTextureMetadata.Count();
- for( size_t index = 0; index < count; ++index )
- {
- if( id == mImpl->mTextureMetadata[ index ].GetId() )
- {
- metadata = &mImpl->mTextureMetadata[ index ];
- return true;
- }
- }
- }
-
- return false;
-}
-
-/********************************************************************************
- ************************* ResourceCache Implementation ************************
- ********************************************************************************/
-
-void ResourceManager::LoadResponse( ResourceId id, ResourceTypeId type, ResourcePointer resource, LoadStatus loadStatus )
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: LoadResponse(id:%u, status=%s)\n", id, loadStatus==RESOURCE_LOADING?"LOADING":loadStatus==RESOURCE_PARTIALLY_LOADED?"PARTIAL":"COMPLETE");
-
- // ID might be in the loading set
- LiveRequestIter iter = mImpl->loadingRequests.find(id);
-
- if ( iter != mImpl->loadingRequests.end() )
- {
- if( loadStatus == RESOURCE_COMPLETELY_LOADED )
- {
- // Remove from the loading set
- mImpl->loadingRequests.erase(iter);
-
- // Add the ID to the new-completed set, and store the resource
- mImpl->newCompleteRequests.insert(id);
- }
-
- switch ( type )
- {
- case ResourceBitmap:
- {
- DALI_ASSERT_DEBUG( loadStatus == RESOURCE_COMPLETELY_LOADED && "Partial results not handled for image loading.\n" );
- Bitmap* const bitmap = static_cast<Bitmap*>( resource.Get() );
- if( !bitmap )
- {
- DALI_LOG_ERROR( "Missing bitmap in loaded resource with id %u.\n", id );
- break;
- }
- unsigned int bitmapWidth = bitmap->GetImageWidth();
- unsigned int bitmapHeight = bitmap->GetImageHeight();
-
- if( Bitmap::PackedPixelsProfile * packedBitmap = bitmap->GetPackedPixelsProfile() )
- {
- bitmapWidth = packedBitmap->GetBufferWidth();
- bitmapHeight = packedBitmap->GetBufferHeight();
- }
- ImageAttributes attrs = ImageAttributes::New( bitmapWidth, bitmapHeight ); ///!< Issue #AHC01
-
- // Check for reloaded bitmap
- TextureMetadataCache::Iterator iter = mImpl->mTextureMetadata.Begin();
- const TextureMetadataCache::Iterator end = mImpl->mTextureMetadata.End();
- for( ; iter != end; ++iter )
- {
- if( (*iter).GetId() == id )
- {
- break;
- }
- }
- if( iter != end )
- {
- iter->Update( bitmap );
- mImpl->mTextureCacheDispatcher.DispatchUpdateTexture( id, bitmap );
- }
- else
- {
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForBitmap( id, bitmap );
- mImpl->mTextureMetadata.PushBack( TextureMetadata::New( id, bitmap ) );
- }
-
- break;
- }
-
- case ResourceNativeImage:
- {
- NativeImageInterfacePtr nativeImg( static_cast<NativeImageInterface*>(resource.Get()) );
-
- ImageAttributes attrs = ImageAttributes::New(nativeImg->GetWidth(), nativeImg->GetHeight());
-
- mImpl->mTextureMetadata.PushBack( TextureMetadata::New( id, nativeImg ) );
- mImpl->mTextureCacheDispatcher.DispatchCreateTextureForNativeImage( id, nativeImg );
-
- break;
- }
-
- case ResourceTargetImage:
- {
- break;
- }
- }
-
- // flag that a load has completed and the cache updated
- mImpl->cacheUpdated = true;
- }
- else
- {
- // This warning can fire if a cancelled load is forgotten here while already complete on a resource thread:
- DALI_LOG_WARNING( "Received a notification for an untracked resource: (id:%u, status=%s)\n", id, loadStatus==RESOURCE_LOADING?"LOADING":loadStatus==RESOURCE_PARTIALLY_LOADED?"PARTIAL":"COMPLETE");
- }
-}
-
-void ResourceManager::LoadFailed(ResourceId id, ResourceFailure failure)
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "ResourceManager: LoadFailed(id:%u)\n", id);
-
- // ID might be in the loading set
- LiveRequestIter iter = mImpl->loadingRequests.find(id);
-
- if (iter != mImpl->loadingRequests.end())
- {
- // Remove from the loading set
- mImpl->loadingRequests.erase(iter);
-
- // Add the ID to the failed set, this will trigger a notification during UpdateTickets
- mImpl->newFailedRequests.insert(id);
-
- mImpl->cacheUpdated = true;
- }
-}
-
-/********************************************************************************
- ********************************* Private Methods *****************************
- ********************************************************************************/
-
-void ResourceManager::DiscardDeadResources( BufferIndex updateBufferIndex )
-{
- for (DeadRequestIter iter = mImpl->deadRequests.begin(); iter != mImpl->deadRequests.end(); )
- {
- // Erase the item and increment the iterator
- mImpl->deadRequests.erase(iter++);
- }
-}
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_RESOURCE_MANAGER_H__
-#define __DALI_INTERNAL_RESOURCE_MANAGER_H__
-
-/*
- * 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.
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/buffer-image.h>
-#include <dali/devel-api/common/ref-counted-dali-vector.h>
-
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/resource-cache.h>
-
-#include <dali/internal/common/message.h>
-#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/images/pixel-data-impl.h>
-#include <dali/internal/event/resources/resource-type-path.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
-
-namespace Dali
-{
-
-class NativeImageInterface;
-
-namespace Integration
-{
-struct ResourceType;
-}
-
-namespace Internal
-{
-class TextureMetadata;
-class ImageAttributes;
-
-// value types used by messages
-template <> struct ParameterType< Integration::LoadResourcePriority >
-: public BasicType< Integration::LoadResourcePriority > {};
-template <> struct ParameterType< Pixel::Format >
-: public BasicType< Pixel::Format > {};
-template <> struct ParameterType< RenderBuffer::Format >
-: public BasicType< RenderBuffer::Format > {};
-template <> struct ParameterType< Integration::ResourceTypeId >
-: public BasicType< Integration::ResourceTypeId > {};
-
-namespace SceneGraph
-{
-class DiscardQueue;
-class RenderQueue;
-class TextureCacheDispatcher;
-}
-
-class NotificationManager;
-
-/** Raw bytes of a resource laid out exactly as it wouldbe in a file, but in memory. */
-typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
-/** Counting smart pointer for managing a buffer of raw bytes. */
-typedef IntrusivePtr<RequestBuffer> RequestBufferPtr;
-
-/**
- * ResourceManager keeps track of resource loading requests, and caches resources that are loaded.
- * It uses ResourceTicket objects, to keep track of the lifetime of each request.
- * If the same resource is required by two client objects, they will share the same ResourceTicket
- * i.e. only one load will occur using the native filesystem.
- *
- * Multi-threading notes:
- * Resources are received from the PlatformAbstraction API during the Core::Render() method, which
- * may be called from a dedicated rendering thread.
- * Loading requests must be made from the application's main thread e.g. when Dali::Image is created.
- */
-class ResourceManager : public Integration::ResourceCache
-{
-public:
-
- /**
- * Create a resource manager.
- * There should exactly one of these objects per Dali Core.
- * @param[in] platformAbstraction Used to request resources from the native filesystem.
- * @param[in] notificationManager Used to send NotifyTickets message.
- * @param[in] textureUploadedProcessResourcesQueue Used for performing post processing on resources
- * @param[in] discardQueue Used to cleanup nodes & resources when no longer in use.
- * @param[in] renderQueue Used to queue resource updates until the next Render.
- */
- ResourceManager( Integration::PlatformAbstraction& platformAbstraction,
- NotificationManager& notificationManager,
- SceneGraph::TextureCacheDispatcher& textureCacheDispatcher,
- LockedResourceQueue& textureUploadedProcessResourcesQueue,
- SceneGraph::DiscardQueue& discardQueue,
- SceneGraph::RenderQueue& renderQueue );
-
- /**
- * Virtual destructor.
- */
- virtual ~ResourceManager();
-
-public:
-
- /********************************************************************************
- ************************ UpdateManager direct interface ***********************
- ********************************************************************************/
-
- /**
- * Called to update the resource cache before rendering.
- * New resources will be added to the cache using PlatformAbstraction::FillResourceCache().
- * Unwanted resources will be added to the DiscardQueue.
- * @param[in] updateBufferIndex The current update buffer index.
- * @return true, if a resource load was completed or failed
- */
- bool UpdateCache( BufferIndex updateBufferIndex );
-
- /********************************************************************************
- *************************** CoreImpl direct interface *************************
- ********************************************************************************/
-
- /**
- * Returns whether the Resource Manager is still processing any resource requests.
- * @return true if still processing, false otherwise.
- */
- bool ResourcesToProcess();
-
- /********************************************************************************
- ********************************* Message handlers *****************************
- ********************************************************************************/
-
- /**
- * Request a resource from the native filesystem.
- * @param[in] id The Id of the requested resource
- * @param[in] typePath The type & path of requested resource.
- * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
- */
- void HandleLoadResourceRequest( ResourceId id,
- const ResourceTypePath& typePath,
- Integration::LoadResourcePriority priority );
-
- /**
- * Decode a resource from a memory buffer with the semantics of loading.
- * Notifications of partial completion, success, and failure will happen via
- * the same loading notification path used for loading from files: Update()
- * will retrieve loading events in its main loop and notify listeners to its
- * own loading events, and forward them, still as loading events, to the event
- * thread via its update queue.
- * Resource manager and lower levels make no attempt to detect resource
- * aliases as is done for multiple requests to load the same resource
- * file, so the caller is responsible for ensuring that it only requests
- * the decoding of an in-memory resource once and for doing the sharing of the
- * resulting object itself. Ultimately this responsibility resides with the
- * application.
- * @note ! Only Bitmap resources are supported for decoding from memory !
- * @param[in] id The Id of the requested resource.
- * @param[in] typePath The type of the requested resource and a path that is ignored.
- * @param[in] buffer The raw encoded bytes of the resource as they would appear in a file.
- * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
- */
- void HandleDecodeResourceRequest( ResourceId id,
- const ResourceTypePath& typePath,
- RequestBufferPtr buffer,
- Integration::LoadResourcePriority priority );
-
- /**
- * Injects a bitmap resource (does not require loading).
- * @pre bitmap has to be initialized
- * @param[in] id The resource id
- * @param[in] bitmap an initialized bitmap
- */
- void HandleAddBitmapImageRequest(ResourceId id, Integration::BitmapPtr bitmap);
-
- /**
- * Add an existing resource to the resource manager.
- * @param[in] id The resource id
- * @param [in] resourceData the NativeImageInterface object
- * @return A ref-counted request object. Keep a copy until the resource is no longer required.
- */
- void HandleAddNativeImageRequest( ResourceId id, NativeImageInterfacePtr resourceData );
-
- /**
- * Add an existing resource to the resource manager.
- * @param[in] id The resource id
- * @param[in] width width in pixels
- * @param[in] height height in pixels
- * @param[in] pixelFormat Pixel format
- */
- void HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferFormat );
-
- /**
- * Add an existing resource to the resource manager.
- * @param[in] id The resource id
- * @param[in] nativeImage The NativeImage
- */
- void HandleAddFrameBufferImageRequest( ResourceId id, NativeImageInterfacePtr nativeImage );
-
- /**
- * Allocate a new empty texture.
- * @param[in] id The resource id
- * @param[in] width width in pixels
- * @param[in] height height in pixels
- * @param[in] pixelFormat Pixel format
- */
- void HandleAllocateTextureRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
-
- /**
- * Update bitmap area request
- * @param[in] textureId The resource ID of a bitmap-texture to remove.
- * @param[in] area The updated area. Zero width/height indicates the whole bitmap has been updated
- */
- void HandleUpdateBitmapAreaRequest( ResourceId textureId, const RectArea& area );
-
- /**
- * Upload a bitmap to a position within a specified texture
- * @param[in] destId The destination texture ID
- * @param[in] bitmap The pointer pointing to the bitmap data to upload
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void HandleUploadBitmapRequest( ResourceId destId, Integration::BitmapPtr bitmap, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Upload a bitmap to a position within a specified texture
- * @param[in] destId The destination texture ID
- * @param[in] srcId The resource ID of the bitmap to upload
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void HandleUploadBitmapRequest( ResourceId destId, ResourceId srcId, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Upload a pixel buffer to a position within a specified texture
- * @param[in] destId The destination texture ID
- * @param[in] pixelData pointer pointing to the pixel data to upload
- * @param [in] xOffset Specifies an offset in the x direction within the texture
- * @param [in] yOffset Specifies an offset in the y direction within the texture
- */
- void HandleUploadBitmapRequest( ResourceId destId, PixelDataPtr pixelData, std::size_t xOffset, std::size_t yOffset );
-
- /**
- * Request reloading a resource from the native filesystem.
- * @param[in] id The resource id
- * @param[in] typePath The type & path of the resource
- * @param[in] priority The priority of the request. This is ignored if the resource is already being refreshed.
- * @param[in] resetFinishedStatus True if the finished status of the resource id should be reset
- */
- void HandleReloadResourceRequest( ResourceId id, const ResourceTypePath& typePath, Integration::LoadResourcePriority priority, bool resetFinishedStatus );
-
- /**
- * Resource ticket has been discarded, throw away the actual resource
- */
- void HandleDiscardResourceRequest( ResourceId id, Integration::ResourceTypeId typeId );
-
- /**
- * @brief Create GL texture for resource.
- * @param[in] id The resource id.
- */
- void HandleCreateGlTextureRequest( ResourceId id );
-
- /********************************************************************************
- ******************** Update thread object direct interface ********************
- ********************************************************************************/
-
- /**
- * Check if a resource has completed loading.
- * @param[in] id The ID of a bitmap/texture resource.
- * @return true if the bitmap or texture has finished loading
- */
- bool IsResourceLoaded( ResourceId id ) const;
-
- /**
- * Check if a resource has failed to load, e.g. file not found, etc.
- * @param[in] id The ID of a bitmap/texture resource.
- * @return true if the bitmap or texture has failed to load
- */
- bool HasResourceLoadFailed( ResourceId id ) const;
-
- /**
- * @param[in] id The ID of a texture resource.
- * @param[in] value if the FBO has been rendered to
- */
- void SetFrameBufferBeenRenderedTo( ResourceId id, bool value );
-
- /**
- * @param[in] id The ID of a texture resource.
- * @return true if the FBO has been rendered to
- */
- bool HasFrameBufferBeenRenderedTo( ResourceId id ) const;
-
- /**
- * Get texture metadata. This stores meta data about the resource, but
- * doesn't keep track of the resource
- * @param id of the texture
- * @param metadata reference
- * @return false if metadata does not exist
- */
- bool GetTextureMetadata( ResourceId id, TextureMetadata*& metadata ) const;
-
- /********************************************************************************
- ************************* ResourceCache Implementation ************************
- ********************************************************************************/
-public:
-
- /**
- * @copydoc Integration::ResourceCache::LoadResponse
- */
- virtual void LoadResponse(ResourceId id, Integration::ResourceTypeId type, Integration::ResourcePointer resource, Integration::LoadStatus loadStatus);
-
- /**
- * @copydoc Integration::ResourceCache::LoadFailed
- */
- virtual void LoadFailed(ResourceId id, Integration::ResourceFailure failure);
-
- /********************************************************************************
- ********************************* Private Methods *****************************
- ********************************************************************************/
-
- /**
- * Discard all dead resources.
- * @param[in] updateBufferIndex The current update buffer index.
- */
- void DiscardDeadResources( BufferIndex updateBufferIndex );
-
-private:
-
- // Undefined
- ResourceManager( const ResourceManager& resourceManager );
-
- // Undefined
- ResourceManager& operator=( const ResourceManager& rhs );
-
-private:
- struct ResourceManagerImpl;
- ResourceManagerImpl* mImpl;
-};
-
-// Messages sent to resource manager from other threads:
-// These functions are run on other threads and insert messages to be
-// picked-up by the update thread in its main loop and executed on that in
-// submission order.
-
-inline void RequestLoadResourceMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- const ResourceTypePath& typePath,
- Integration::LoadResourcePriority priority )
-{
- typedef MessageValue3< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleLoadResourceRequest, id, typePath, priority );
-}
-
-inline void RequestDecodeResourceMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- const ResourceId id,
- /// We use typePath instead of the raw type for ownership and to enable copying of a concrete type.
- const ResourceTypePath& typePath,
- RequestBufferPtr buffer,
- Integration::LoadResourcePriority priority )
-{
- typedef MessageValue4< ResourceManager, ResourceId, ResourceTypePath, RequestBufferPtr, Integration::LoadResourcePriority > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleDecodeResourceRequest, id, typePath, buffer, priority );
-}
-
-inline void RequestAddBitmapImageMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- Integration::Bitmap* resourceData )
-{
- typedef MessageValue2< ResourceManager, ResourceId, Integration::BitmapPtr > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleAddBitmapImageRequest, id, resourceData );
-}
-
-inline void RequestAddNativeImageMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- NativeImageInterfacePtr resourceData )
-{
- typedef MessageValue2< ResourceManager, ResourceId, NativeImageInterfacePtr > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleAddNativeImageRequest, id, resourceData );
-}
-
-inline void RequestAddFrameBufferImageMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- RenderBuffer::Format bufferFormat
- )
-{
- typedef MessageValue5< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, width, height, pixelFormat, bufferFormat );
-}
-
-inline void RequestAddFrameBufferImageMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- NativeImageInterfacePtr resourceData )
-{
- typedef MessageValue2< ResourceManager, ResourceId, NativeImageInterfacePtr > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, resourceData );
-}
-
-inline void RequestAllocateTextureMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat)
-{
- typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleAllocateTextureRequest, id, width, height, pixelFormat );
-}
-
-inline void RequestUpdateBitmapAreaMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- const Dali::RectArea& area )
-{
- typedef MessageValue2< ResourceManager, ResourceId, Dali::RectArea > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleUpdateBitmapAreaRequest, id, area );
-}
-
-inline void RequestUploadBitmapMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId destId,
- Integration::BitmapPtr bitmap,
- std::size_t xOffset,
- std::size_t yOffset )
-{
- typedef MessageValue4< ResourceManager, ResourceId, Integration::BitmapPtr , std::size_t, std::size_t > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleUploadBitmapRequest, destId, bitmap, xOffset, yOffset );
-}
-
-inline void RequestUploadBitmapMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId destId,
- ResourceId srcId,
- std::size_t xOffset,
- std::size_t yOffset )
-{
- typedef MessageValue4< ResourceManager, ResourceId, ResourceId, std::size_t, std::size_t > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleUploadBitmapRequest, destId, srcId, xOffset, yOffset );
-}
-
-inline void RequestUploadBitmapMessage(EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId destId,
- PixelDataPtr pixelData,
- std::size_t xOffset,
- std::size_t yOffset)
-{
- typedef MessageValue4< ResourceManager, ResourceId, PixelDataPtr , std::size_t, std::size_t > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleUploadBitmapRequest, destId, pixelData, xOffset, yOffset );
-}
-
-inline void RequestReloadResourceMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- const ResourceTypePath& typePath,
- Integration::LoadResourcePriority priority,
- bool resetFinishedStatus )
-{
- typedef MessageValue4< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority, bool > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ), false );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &ResourceManager::HandleReloadResourceRequest, id, typePath, priority, resetFinishedStatus );
-}
-
-inline void RequestDiscardResourceMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id,
- Integration::ResourceTypeId typeId )
-{
- typedef MessageValue2< ResourceManager, ResourceId, Integration::ResourceTypeId > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleDiscardResourceRequest, id, typeId );
-}
-
-inline void RequestCreateGlTextureMessage( EventThreadServices& eventThreadServices,
- ResourceManager& manager,
- ResourceId id )
-{
- typedef MessageValue1< ResourceManager, ResourceId > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* 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( &manager, &ResourceManager::HandleCreateGlTextureRequest, id );
-}
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_RESOURCE_MANAGER_H__
+++ /dev/null
-#ifndef __DALI_TEXTURE_METADATA_H__
-#define __DALI_TEXTURE_METADATA_H__
-
-/*
- * 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.
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/type-traits.h>
-#include <dali/public-api/images/image-operations.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/**
- * Texture metadata.
- */
-class TextureMetadata
-{
-public:
- /**
- * Creates a BitmapMetadata object from a native image (eg.: EGLImage).
- * @param[in] nativeImage The native image to load
- * @return A newly allocated BitmapMetadata
- */
- static TextureMetadata New( ResourceId id, NativeImageInterfacePtr nativeImage )
- {
- return TextureMetadata( id, nativeImage->GetWidth(), nativeImage->GetHeight(), nativeImage->RequiresBlending(), ! nativeImage->RequiresBlending() );
- }
-
- /**
- * Creates a new BitmapMetadata object from a Bitmap
- * @param[in] bitmap The bitmap
- * @return A newly allocated BitmapMetadata
- */
- static TextureMetadata New( ResourceId id, Integration::Bitmap* const bitmap )
- {
- return TextureMetadata( id, bitmap->GetImageWidth(), bitmap->GetImageHeight(), Pixel::HasAlpha(bitmap->GetPixelFormat()), bitmap->IsFullyOpaque() );
- }
-
- /**
- * Creates a new BitmapMetadata object
- * @return A newly allocated BitmapMetadata
- */
- static TextureMetadata New( ResourceId id, unsigned int width, unsigned int height, bool hasAlphaChannel )
- {
- return TextureMetadata( id, width, height, hasAlphaChannel, !hasAlphaChannel );
- }
-
- /**
- * Default Constructor
- */
- TextureMetadata()
- : mSize( 0, 0 ),
- mId( 0 ),
- mHasAlphaChannel( true ),
- mOpaqueness( false ),
- mIsNativeImage( false ),
- mIsFramebuffer( false ),
- mHasFrameBufferBeenRenderedTo( false )
- {
- }
-
- /**
- * Constructor
- */
- TextureMetadata( ResourceId id, unsigned int width, unsigned int height, bool hasAlphaChannel, bool opaqueness )
- : mSize( width, height ),
- mId( id ),
- mHasAlphaChannel( hasAlphaChannel ),
- mOpaqueness( opaqueness ),
- mIsNativeImage( false ),
- mIsFramebuffer( false ),
- mHasFrameBufferBeenRenderedTo( false )
- {
- }
-
- /**
- * As this class is POD, compiler generated copy constructor and assignment operator are ok (bitwise copy)
- */
-
- /**
- * @return the id
- */
- ResourceId GetId() const
- {
- return mId;
- }
-
- /**
- * Updates the metadata with information from the native image
- * @param[in] nativeImage The native image that was updated
- */
- void Update( NativeImageInterfacePtr nativeImage )
- {
- mSize = ImageDimensions( nativeImage->GetWidth(), nativeImage->GetHeight() );
- mHasAlphaChannel = nativeImage->RequiresBlending();
- mOpaqueness = ! mHasAlphaChannel;
- mIsNativeImage = true;
- }
-
- /**
- * Updates the metadata with information from the bitmap
- * @param[in] bitmap The bitmap that was updated
- */
- void Update( Integration::Bitmap* const bitmap )
- {
- mSize = ImageDimensions( bitmap->GetImageWidth(), bitmap->GetImageHeight() );
- mHasAlphaChannel = Pixel::HasAlpha(bitmap->GetPixelFormat());
- mOpaqueness = bitmap->IsFullyOpaque();
- mIsNativeImage = false;
- }
-
- /**
- * Set the width of image
- * @param[in] width The width of the image
- */
- void SetWidth( unsigned int width )
- {
- mSize.SetWidth( width );
- }
-
- /**
- * Return the width of image in pixels.
- * @return width
- */
- unsigned int GetWidth() const
- {
- return mSize.GetWidth();
- }
-
- /**
- * Set the height of image
- * @param[in] height The height of the image in pixels
- */
- void SetHeight(unsigned int height)
- {
- mSize.SetHeight( height );
- }
-
- /**
- * Return the height of image in pixels.
- * @return height
- */
- unsigned int GetHeight() const
- {
- return mSize.GetHeight();
- }
-
- /**
- * Query whether the texture data has an alpha channel.
- * @return True if the texture data has an alpha channel.
- */
- bool HasAlphaChannel() const
- {
- return mHasAlphaChannel;
- }
-
- /**
- * Set whether the texture is completely opaque, i.e.
- * true if all pixels of the texture data are opaque.
- * @param[in] opaqueness If the alpha channel is set to fully opaque.
- */
- void SetOpaqueness( bool opaqueness )
- {
- mOpaqueness = opaqueness;
- }
-
- /**
- * Query whether the texture is completely opaque
- * @return True if all pixels of the texture data are opaque
- */
- bool IsFullyOpaque() const
- {
- return mOpaqueness;
- }
-
- /**
- * @param isNativeImage flag
- */
- void SetIsNativeImage( bool isNativeImage )
- {
- mIsNativeImage = isNativeImage;
- }
-
- /**
- * @return isNativeImage flag
- */
- bool IsNativeImage() const
- {
- return mIsNativeImage;
- }
-
- /**
- * @param isFramebuffer flag
- */
- void SetIsFramebuffer( bool isFramebuffer )
- {
- mIsFramebuffer = isFramebuffer;
- }
-
- /**
- * @return isFramebuffer flag
- */
- bool IsFramebuffer() const
- {
- return mIsFramebuffer;
- }
-
- /**
- * @param value if the framebuffer has been rendered to
- */
- void SetFrameBufferBeenRenderedTo( bool value )
- {
- mHasFrameBufferBeenRenderedTo = value;
- }
-
- /**
- * @return true if the framebuffer has been rendered to
- */
- bool HasFrameBufferBeenRenderedTo() const
- {
- return mHasFrameBufferBeenRenderedTo;
- }
-
-private: // Data
-
- ImageDimensions mSize; ///< size compressed into 32 bits
- ResourceId mId; ///< Unique resource/texture ID
- bool mHasAlphaChannel:1; ///< Pixel format of the contained image data.
- bool mOpaqueness:1; ///< Whether the bitmap was fully opaque when loaded / updated
- bool mIsNativeImage:1; ///< Whether the image is native or not
- bool mIsFramebuffer:1; ///< Whether the image is an FBO
- bool mHasFrameBufferBeenRenderedTo:1; /// If the FBO has been rendered to
-
-};
-
-} // namespace Internal
-
-// Allow BitmapMetadataEntry to be treated as a POD type (need to do this in Dali namespace)
-template <> struct TypeTraits< Internal::TextureMetadata > : public BasicTypes< Internal::TextureMetadata > { enum { IS_TRIVIAL_TYPE = true }; };
-
-} // namespace Dali
-
-#endif // __DALI_TEXTURE_METADATA_H__
const unsigned int CORE_MAJOR_VERSION = 1;
const unsigned int CORE_MINOR_VERSION = 2;
-const unsigned int CORE_MICRO_VERSION = 28;
+const unsigned int CORE_MICRO_VERSION = 30;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifndef EMSCRIPTEN
{
if( texture )
{
- Internal::NewTexturePtr texturePtr( &GetImplementation( texture ) );
+ Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
GetImplementation(*this).AttachColorTexture( texturePtr, mipmapLevel, layer );
}
}
Texture FrameBuffer::GetColorTexture()
{
- Internal::NewTexture* texturePtr = GetImplementation(*this).GetColorTexture();
+ Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture();
return Dali::Texture( texturePtr );
}
{
if( texture )
{
- Internal::NewTexturePtr texturePtr( &GetImplementation( texture ) );
+ Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
GetImplementation(*this).SetTexture( index, texturePtr );
}
else
Texture TextureSet::GetTexture( size_t index ) const
{
- Internal::NewTexture* texturePtr = GetImplementation(*this).GetTexture( index );
+ Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( index );
return Dali::Texture( texturePtr );
}
Texture Texture::New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int height )
{
- Internal::NewTexturePtr texture = Internal::NewTexture::New(type, format, width, height );
+ Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height );
return Texture( texture.Get() );
}
Texture Texture::New( NativeImageInterface& nativeImageInterface )
{
- Internal::NewTexturePtr texture = Internal::NewTexture::New( nativeImageInterface );
+ Internal::TexturePtr texture = Internal::Texture::New( nativeImageInterface );
return Texture( texture.Get() );
}
Texture Texture::DownCast( BaseHandle handle )
{
- return Texture( dynamic_cast<Dali::Internal::NewTexture*>(handle.GetObjectPtr()));
+ return Texture( dynamic_cast<Dali::Internal::Texture*>(handle.GetObjectPtr()));
}
Texture& Texture::operator=( const Texture& handle )
return GetImplementation(*this).GetHeight();
}
-Texture::Texture( Internal::NewTexture* pointer )
+Texture::Texture( Internal::Texture* pointer )
: BaseHandle( pointer )
{
}
namespace Internal DALI_INTERNAL
{
-class NewTexture;
+class Texture;
}
namespace TextureType
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated Texture
*/
- explicit DALI_INTERNAL Texture( Internal::NewTexture* pointer );
+ explicit DALI_INTERNAL Texture( Internal::Texture* pointer );
};
} //namespace Dali
Name: dali
Summary: The OpenGLES Canvas Core Library
-Version: 1.2.28
+Version: 1.2.30
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT