From: Yoonsang Lee Date: Fri, 17 Jul 2015 07:15:50 +0000 (+0900) Subject: [DALi][DOC-213] Update Thread Architecture X-Git-Tag: tizen_3.0/TD_SYNC/20161201~691^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa9f05b3292cc5f402d98ac99c5c941c8222aa84;p=sdk%2Fonline-doc.git [DALi][DOC-213] Update Thread Architecture Signed-off-by: Yoonsang Lee Change-Id: I80b3f896e92a8c515e9538c5d1a28f193e08afe5 --- diff --git a/org.tizen.ui.guides/html/images/dali_threads.png b/org.tizen.ui.guides/html/images/dali_threads.png new file mode 100644 index 0000000..997d238 Binary files /dev/null and b/org.tizen.ui.guides/html/images/dali_threads.png differ diff --git a/org.tizen.ui.guides/html/native/dali/threads_n.htm b/org.tizen.ui.guides/html/native/dali/threads_n.htm index e90ea6d..c78457a 100755 --- a/org.tizen.ui.guides/html/native/dali/threads_n.htm +++ b/org.tizen.ui.guides/html/native/dali/threads_n.htm @@ -11,7 +11,7 @@ - Properties: Accessing to Properties of DALi Objects + Thread Architecture: High-Performance Multi-Threaded Architecture of DALi @@ -35,125 +35,21 @@
-

Properties: Accessing to Properties of DALi Objects

+

Thread Architecture: High-Performance Multi-Threaded Architecture of DALi

-

GetCurrentPosition()

- -

A property is a value used by an object that can be modified or read via Dali::Handle::GetProperty() / SetProperty() API.

- -

The difference between properties and ordinary C++ member variables is that a property can be dynamically added to or removed from an existing object in runtime, which enables more flexible, script-like programming with DALi.

- -

Dali::Handle (in mobile and wearable) provides methods to manage properties, thus the DALi classes that inherit from Dali::Handle (most of classes that users would use) have a number of predefined properties and can have any number of user-defined custom properties. -

- -

Accessing to Properties

- -

Properties of an object usually can be accessed via two ways: by its class member functions or by property getters/setters (Dali::Handle::GetProperty() / SetProperty()).

-

For example, Dali::Actor has following predefined properties:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Table: Properties of Dali::Actor -
Property Index (enumeration)Member Functions
Dali::Actor::POSITIONDali::Actor::GetCurrentPosition() / SetPosition()
Dali::Actor::ORIENTATIONDali::Actor::GetCurrentOrientation() / SetOrientation()
Dali::Actor::SIZEDali::Actor::GetCurrentSize() / SetSize()
Dali::Actor::COLORDali::Actor::GetCurrentColor() / SetColor()
Dali::Actor::NAMEDali::Actor::GetName() / SetName()
......
- - You can access them in both ways: - -
-Actor actor = Actor::New();
-actor.SetName("test actor");
-std::cout << actor.GetName() << std::endl;  // "test actor"
-
- -
-Actor actor = Actor::New();
-actor.SetProperty( Actor::Property::NAME, "test actor" );
-std::cout << actor.GetProperty( Actor::Property::NAME ) << std::endl;  // "test actor"
-std::cout << actor.GetProperty<std::string>( Actor::Property::NAME ) << std::endl;  // "test actor"
-std::cout << actor.GetProperty( Actor::Property::NAME ).Get<std::string>() << std::endl;  // "test actor"
-
- -

Usages of Properties

- -

Registering User-Defined Custom Properties to an Object

- -

Properties can be registered / unregistered in runtime, which enables script-like programming of DALi application, for example, adding custom member data to an instance of a DALi class without subclassing the class or maintaining another pool of custom data.

-

For example, you can set your own custom data to PushButton objects and use them later when the buttons are clicked like:

-
-  void Create( Application& application )
-  {
-    for( int i=0; i<5; ++i )
-    {
-      Toolkit::PushButton button = Toolkit::PushButton::New();
-      button.SetSize( 100, 100 );
-      button.SetPosition( 100*i+50, 50 );
-      button.ClickedSignal().Connect( this, OnButtonClicked );
-
-      // Register a custom property having button index.
-      // Store the property index so you can look it up later.
-      // Note: This is much faster than looking the property up by property name and should always be used if possible.
-      // As all control types are the same (PushButtons) the indices to the unique custom property are all same.
-      Property::Value data( i );
-      mCustomDataIndex = button.RegisterProperty( "custom-data", data );
-
-      Stage::GetCurrent().Add(button);
-    }
-  }
-
-  bool OnButtonClicked(Toolkit::Button button)
-  {
-    // Look up the custom property by the stored property index.
-    // Note: If the property belongs to a control in another library, or we do not know the index, we can look the index up first with:
-    // Property::Index index = button.GetPropertyIndex( "custom-data" );
-    cout << button.GetProperty( mCustomDataIndex ) << endl;
-    return true;
-  }
-
- -

Animation

- -

Constraint

- - - -types - -set/get add/remove - -constraint animation +

DALi uses a multithreaded architecture in order to provide the best performance and scalability.

+
    +
  • Event Thread: The main thread in which application code and event handling runs.
  • +
  • Update Thread: Updates the nodes on the scene as well as running animations and constraints.
  • +
  • Render Thread: OpenGL drawing, texture and geometry uploading etc.
  • +
  • Resource Thread: Loads images and decodes into bitmaps etc.
  • +
+

Figure: DALi Thread Architecture

+

Thread Architecture

+