Merge branch 'devel/master' into tizen accepted/tizen/unified/20221128.015004
authorChihun Jeong <chihun.jeong@samsung.com>
Wed, 23 Nov 2022 05:56:56 +0000 (14:56 +0900)
committerChihun Jeong <chihun.jeong@samsung.com>
Wed, 23 Nov 2022 05:56:56 +0000 (14:56 +0900)
39 files changed:
automated-tests/src/dali-scene3d/utc-Dali-CameraParameters.cpp
automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp
automated-tests/src/dali-toolkit-styling/utc-Dali-StyleManager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h
automated-tests/src/dali-toolkit/utc-Dali-GlViewDirectRendering.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.h
dali-scene3d/public-api/loader/camera-parameters.cpp
dali-scene3d/public-api/loader/camera-parameters.h
dali-scene3d/public-api/loader/dli-loader.cpp
dali-scene3d/public-api/loader/gltf2-loader.cpp
dali-toolkit/internal/controls/gl-view/drawable-view-impl.cpp
dali-toolkit/internal/controls/gl-view/drawable-view-impl.h
dali-toolkit/internal/controls/gl-view/gl-view-impl.cpp
dali-toolkit/internal/controls/gl-view/gl-view-impl.h
dali-toolkit/internal/controls/gl-view/gl-view-interface-impl.h
dali-toolkit/internal/controls/scene3d-view/gltf-loader.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/controller/text-controller-relayouter.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/public-api/controls/gl-view/gl-view.cpp
dali-toolkit/public-api/controls/gl-view/gl-view.h
dali-toolkit/public-api/controls/text-controls/text-editor.cpp
dali-toolkit/public-api/controls/text-controls/text-editor.h
dali-toolkit/public-api/controls/text-controls/text-field.cpp
dali-toolkit/public-api/controls/text-controls/text-field.h
dali-toolkit/public-api/controls/text-controls/text-label.h
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 15e575b..5fec8f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 // Enable debug log for test coverage
 #define DEBUG_ENABLED 1
 
-#include "dali-scene3d/public-api/loader/camera-parameters.h"
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/actors/camera-actor-devel.h>
 #include <string_view>
+#include "dali-scene3d/public-api/loader/camera-parameters.h"
 
 using namespace Dali;
 using namespace Dali::Scene3D::Loader;
 
 int UtcDaliCameraParameters(void)
 {
-  Quaternion qView = Quaternion(Radian(Degree(180.f)), Vector3::YAXIS);
+  Quaternion       qView = Quaternion(Radian(Degree(180.f)), Vector3::YAXIS);
   CameraParameters camParams;
   camParams.matrix.SetTransformComponents(Vector3::ONE * 2.f,
-    qView,
-    Vector3::ZAXIS * -100.f);
-  camParams.orthographicSize = Vector4{ -1.f, 1.f, -1.f, 1.f };
-  camParams.yFov = Radian(M_PI * .5).radian;
-  camParams.zNear = 1.f;
-  camParams.zFar = 1000.f;
+                                          qView,
+                                          Vector3::ZAXIS * -100.f);
+  camParams.orthographicSize = 3.0f;
+  camParams.aspectRatio      = 1.0f;
+  camParams.yFov             = Degree(Radian(M_PI * .5)).degree;
+  camParams.zNear            = 1.f;
+  camParams.zFar             = 1000.f;
 
-  Vector3 scale;
+  Vector3    scale;
   Quaternion orientation;
-  Vector3 position;
+  Vector3    position;
   camParams.CalculateTransformComponents(position, orientation, scale);
   DALI_TEST_EQUAL(scale, Vector3::ONE * 2.f);
   DALI_TEST_EQUAL(orientation, Quaternion::IDENTITY); // 2 180 degrees rotations along y
   DALI_TEST_EQUAL(position, Vector3::ZAXIS * -100.f);
 
   TestApplication app;
-  CameraActor camera = CameraActor::New();
-  for (auto i : { false, true })
+  CameraActor     camera = CameraActor::New();
+  for(auto i : {false, true})
   {
     camParams.isPerspective = i;
 
-    auto viewProjection = camParams.GetViewProjection();
-    Matrix view{ false };
+    auto   viewProjection = camParams.GetViewProjection();
+    Matrix view{false};
     Matrix::Multiply(view, Matrix(qView), camParams.matrix);
     view.Invert();
     DALI_TEST_EQUAL(viewProjection.GetView(), view);
@@ -65,6 +67,15 @@ int UtcDaliCameraParameters(void)
     DALI_TEST_EQUAL(camera.GetProperty(Actor::Property::POSITION).Get<Vector3>(), position);
     DALI_TEST_EQUAL(camera.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>(), orientation);
     DALI_TEST_EQUAL(camera.GetProperty(Actor::Property::SCALE).Get<Vector3>(), scale);
+
+    if(camParams.isPerspective)
+    {
+      DALI_TEST_EQUAL(camera.GetProperty(Dali::CameraActor::Property::FIELD_OF_VIEW).Get<float>(), Radian(Degree(camParams.yFov)).radian);
+    }
+    else
+    {
+      DALI_TEST_EQUAL(camera.GetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE).Get<float>(), camParams.orthographicSize);
+    }
   }
 
   END_TEST;
index ca9f0eb..08728df 100644 (file)
@@ -302,16 +302,20 @@ int UtcDaliSceneViewOnScene02(void)
   Scene3D::SceneView view = Scene3D::SceneView::New();
 
   renderTaskCount = application.GetScene().GetRenderTaskList().GetTaskCount();
-  DALI_TEST_EQUALS(2u, renderTaskCount, TEST_LOCATION);
-
-  RenderTask  renderTask = application.GetScene().GetRenderTaskList().GetTask(1u);
-  CameraActor camera     = renderTask.GetCameraActor();
+  DALI_TEST_EQUALS(1u, renderTaskCount, TEST_LOCATION);
 
   application.GetScene().Add(view);
 
   application.SendNotification();
   application.Render();
 
+
+  renderTaskCount = application.GetScene().GetRenderTaskList().GetTaskCount();
+  DALI_TEST_EQUALS(2u, renderTaskCount, TEST_LOCATION);
+
+  RenderTask  renderTask = application.GetScene().GetRenderTaskList().GetTask(1u);
+  CameraActor camera     = renderTask.GetCameraActor();
+
   CameraActor defaultCamera = renderTask.GetCameraActor();
   DALI_TEST_CHECK(defaultCamera);
   DALI_TEST_EQUALS(camera, defaultCamera, TEST_LOCATION);
@@ -724,3 +728,26 @@ int UtcDaliSceneViewSetSkyboxOrientation(void)
 
   END_TEST;
 }
+
+int UtcDaliSceneViewCreateAndRemoveRenderTask(void)
+{
+  ToolkitTestApplication application;
+  RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+
+  uint32_t renderTaskCount = taskList.GetTaskCount();
+
+  Scene3D::SceneView view = Scene3D::SceneView::New();
+  view.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+
+  DALI_TEST_EQUALS(renderTaskCount, application.GetScene().GetRenderTaskList().GetTaskCount(), TEST_LOCATION);
+
+  application.GetScene().Add(view);
+
+  DALI_TEST_EQUALS(renderTaskCount + 1, application.GetScene().GetRenderTaskList().GetTaskCount(), TEST_LOCATION);
+
+  view.Unparent();
+
+  DALI_TEST_EQUALS(renderTaskCount, application.GetScene().GetRenderTaskList().GetTaskCount(), TEST_LOCATION);
+
+  END_TEST;
+}
index 3d9e206..0d6c4ae 100644 (file)
@@ -1371,6 +1371,7 @@ int UtcDaliStyleManagerNewWithAdditionalBehavior(void)
   };
 
   // Default New
+  // Note: TextField and TextEditor have TextSelectionPopup
   tet_infoline( "Check whether ControlStyleChangeSignal connected in default New\n");
   checkup(1, Control::New());
   checkup(1, ImageView::New());
@@ -1378,6 +1379,8 @@ int UtcDaliStyleManagerNewWithAdditionalBehavior(void)
   checkup(1, ImageView::New("url", Dali::ImageDimensions(32u, 32u)));
   checkup(1, TextLabel::New());
   checkup(1, TextLabel::New("text"));
+  checkup(2, TextField::New());
+  checkup(2, TextEditor::New());
 
   // New with additional behaviour, but enable style change signals
   tet_infoline( "Check whether ControlStyleChangeSignal connected in non-disable style change signals\n");
@@ -1394,6 +1397,10 @@ int UtcDaliStyleManagerNewWithAdditionalBehavior(void)
   checkup(1, TextLabel::New(Toolkit::Control::ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT, "text"));
   checkup(1, TextLabel::New(Toolkit::Control::ControlBehaviour::DISABLE_SIZE_NEGOTIATION));
   checkup(1, TextLabel::New(Toolkit::Control::ControlBehaviour::DISABLE_SIZE_NEGOTIATION, "text"));
+  checkup(2, TextField::New(Toolkit::Control::ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT));
+  checkup(2, TextField::New(Toolkit::Control::ControlBehaviour::DISABLE_SIZE_NEGOTIATION));
+  checkup(2, TextEditor::New(Toolkit::Control::ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT));
+  checkup(2, TextEditor::New(Toolkit::Control::ControlBehaviour::DISABLE_SIZE_NEGOTIATION));
 
   // New with additional behaviour, so disable style change signals
   tet_infoline( "Check whether ControlStyleChangeSignal did not connected\n");
@@ -1404,6 +1411,8 @@ int UtcDaliStyleManagerNewWithAdditionalBehavior(void)
   checkup(0, ImageView::New(Toolkit::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS, "url", Dali::ImageDimensions(32u, 32u)));
   checkup(0, TextLabel::New(Toolkit::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS));
   checkup(0, TextLabel::New(Toolkit::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS, "text"));
+  checkup(1, TextField::New(Toolkit::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS));
+  checkup(1, TextEditor::New(Toolkit::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS));
 
   END_TEST;
 }
index fc176e5..04d193c 100644 (file)
@@ -1302,7 +1302,7 @@ Graphics::MemoryRequirements TestGraphicsController::GetBufferMemoryRequirements
   return Graphics::MemoryRequirements{};
 }
 
-const Graphics::TextureProperties& TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture)
+Graphics::TextureProperties TestGraphicsController::GetTextureProperties(const Graphics::Texture& texture)
 {
   static Graphics::TextureProperties textureProperties{};
   mCallStack.PushCall("GetTextureProperties", "");
index cabc414..81b93d2 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_GRAPHICS_CONTROLLER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -354,7 +354,7 @@ public:
    *
    * @return Returns the TextureProperties object
    */
-  const Graphics::TextureProperties& GetTextureProperties(const Graphics::Texture& texture) override;
+  Graphics::TextureProperties GetTextureProperties(const Graphics::Texture& texture) override;
 
   /**
    * @brief Returns the reflection of the given program
index 8bcb3c0..132ce79 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <toolkit-adaptor-impl.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
 
 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
 
@@ -130,6 +131,11 @@ Dali::RenderSurfaceInterface& SceneHolder::GetRenderSurface()
   return mRenderSurface;
 }
 
+Dali::RenderTaskList SceneHolder::GetRenderTaskList()
+{
+  return mScene.GetRenderTaskList();
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index b74a8c0..4902904 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/object/base-object.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
 
 #define DALI_WINDOW_H
 #include <dali/integration-api/adaptor-framework/adaptor.h>
@@ -220,6 +221,11 @@ Window::TouchEventSignalType& Window::TouchedSignal()
   return GetImplementation(*this).TouchedSignal();
 }
 
+Dali::RenderTaskList Window::GetRenderTaskList()
+{
+  return GetImplementation(*this).GetRenderTaskList();
+}
+
 namespace DevelWindow
 {
 Window Get(Actor actor)
index e9edae0..038812c 100644 (file)
@@ -85,6 +85,7 @@ public:
   KeyEventSignalType&           KeyEventSignal();
   TouchEventSignalType&         TouchedSignal();
   ResizeSignalType&             ResizeSignal();
+  Dali::RenderTaskList          GetRenderTaskList();
 
 public:
   explicit Window(Internal::Adaptor::Window* window);
index 75eb570..e018c49 100644 (file)
 #include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/public-api/signals/render-callback.h>
 
-
 using namespace Dali;
 using namespace Dali::Toolkit;
 
-
 // Positive test case for a method
 int UtcDaliGlViewDirectRenderingNew(void)
 {
@@ -189,22 +187,28 @@ int UtcDaliGlViewDirectRenderingOnSizeSet(void)
 
 namespace DirectRenderingCode
 {
-
 // Internal callback function
-void glInit(void)
+void glInit(Dali::RenderCallbackInput& input)
 {
 }
 
-int glRenderFrame(void)
+int glRenderFrame(Dali::RenderCallbackInput& input)
 {
   static unsigned int retFlag = 0;
   return retFlag++;
 }
 
-void glTerminate(void)
+int gBoundTextureCount = 0;
+
+int glRenderFrameWithTextures(Dali::RenderCallbackInput& input)
 {
+  gBoundTextureCount = input.textureBindings.size();
+  return 1;
 }
 
+void glTerminate(Dali::RenderCallbackInput& input)
+{
+}
 
 // Internal callback function
 void glInitMT(Dali::RenderCallbackInput& input)
@@ -227,7 +231,7 @@ void resizeCB(Vector2 size)
 {
 }
 
-}
+} // namespace DirectRenderingCode
 
 int UtcDaliGlViewDirectRenderingRegisterGlCallbacksN(void)
 {
@@ -396,8 +400,6 @@ int UtcDaliGlViewDirectRenderingTerminateCallback(void)
   application.SendNotification();
   application.Render();
 
-
-
   //To GlViewRenderThread can recognize Resize signal the main thread have to sleep.
   std::this_thread::sleep_for(std::chrono::milliseconds(100));
 
@@ -408,6 +410,52 @@ int UtcDaliGlViewDirectRenderingTerminateCallback(void)
   END_TEST;
 }
 
+int UtcDaliGlViewDirectRenderingTextureBinding(void)
+{
+  ToolkitTestApplication application;
+
+  GlView view = Toolkit::GlView::New(GlView::BackendMode::DIRECT_RENDERING, GlView::ColorFormat::RGB888);
+
+  view.SetRenderingMode(GlView::RenderingMode::CONTINUOUS);
+  view.SetGraphicsConfig(true, true, 0, GlView::GraphicsApiVersion::GLES_VERSION_2_0);
+  view.RegisterGlCallbacks(Dali::MakeCallback(DirectRenderingCode::glInit), Dali::MakeCallback(DirectRenderingCode::glRenderFrameWithTextures), Dali::MakeCallback(DirectRenderingCode::glTerminate));
+  view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  view.SetProperty(Actor::Property::SIZE, Vector2(360.0f, 360.0f));
+
+  // Set size on the actor (half the window size to show that glClear() and scissor test work together)
+  view.SetProperty(Actor::Property::SIZE, Size(100, 100));
+  view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+
+  application.GetScene().Add(view);
+
+  // Prepare texture 1
+  Texture   texture1   = Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 512, 512);
+  auto*     data1      = reinterpret_cast<uint8_t*>(malloc(512 * 512 * 4));
+  PixelData pixelData1 = PixelData::New(data1, 512 * 512 * 4, 512, 512, Pixel::Format::RGBA8888, PixelData::ReleaseFunction::FREE);
+  texture1.Upload(pixelData1);
+
+  // Prepare texture 2
+  Texture   texture2   = Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 512, 512);
+  auto*     data2      = reinterpret_cast<uint8_t*>(malloc(512 * 512 * 4));
+  PixelData pixelData2 = PixelData::New(data2, 512 * 512 * 4, 512, 512, Pixel::Format::RGBA8888, PixelData::ReleaseFunction::FREE);
+  texture2.Upload(pixelData2);
+
+  std::vector<Texture> texturesToBind;
+  texturesToBind.push_back(texture1);
+  texturesToBind.push_back(texture2);
+
+  view.BindTextureResources(texturesToBind);
+
+  DirectRenderingCode::gBoundTextureCount = 0;
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS(DirectRenderingCode::gBoundTextureCount, texturesToBind.size(), TEST_LOCATION);
+
+  END_TEST;
+}
+
 // Positive test case for a method
 int UtcDaliGlViewDirectRenderingThreadedNew(void)
 {
@@ -439,9 +487,9 @@ int UtcDaliGlViewDirectRenderingThreadedOnScene(void)
 
   // Set size on the actor (half the window size to show that glClear() and scissor test work together)
   view.SetProperty(Actor::Property::SIZE, Size(100, 100));
-  view.SetProperty(Actor::Property::POSITION, Vector2(0,0));
+  view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
 
-  while( DirectRenderingCode::gDRFramesRendered < 1 )
+  while(DirectRenderingCode::gDRFramesRendered < 1)
   {
     application.SendNotification();
     application.Render();
@@ -453,7 +501,6 @@ int UtcDaliGlViewDirectRenderingThreadedOnScene(void)
 extern "C" bool gDirectRenderingFailCreateShader;
 extern "C" bool gDirectRenderingFailCreateProgram;
 
-
 int UtcDaliGlViewDirectRenderingThreadedOnScene1(void)
 {
   ToolkitTestApplication application;
@@ -473,9 +520,9 @@ int UtcDaliGlViewDirectRenderingThreadedOnScene1(void)
 
   // Set size on the actor (half the window size to show that glClear() and scissor test work together)
   view.SetProperty(Actor::Property::SIZE, Size(100, 100));
-  view.SetProperty(Actor::Property::POSITION, Vector2(0,0));
+  view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
 
-  while( DirectRenderingCode::gDRFramesRendered < 1 )
+  while(DirectRenderingCode::gDRFramesRendered < 1)
   {
     application.SendNotification();
     application.Render();
@@ -503,9 +550,9 @@ int UtcDaliGlViewDirectRenderingThreadedOnScene2(void)
 
   // Set size on the actor (half the window size to show that glClear() and scissor test work together)
   view.SetProperty(Actor::Property::SIZE, Size(100, 100));
-  view.SetProperty(Actor::Property::POSITION, Vector2(0,0));
+  view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
 
-  while( DirectRenderingCode::gDRFramesRendered < 1 )
+  while(DirectRenderingCode::gDRFramesRendered < 1)
   {
     application.SendNotification();
     application.Render();
index 27a14a9..41783dc 100644 (file)
@@ -1508,7 +1508,6 @@ int UtcDaliToolkitTextlabelScrollingN(void)
   const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get<bool>();
   DALI_TEST_CHECK(!enabled);
 
-
   label.SetProperty(TextLabel::Property::MULTI_LINE, false);
   label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 1);
   label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 9999.0f);
@@ -2038,6 +2037,47 @@ int UtcDaliToolkitTextlabelTextFit(void)
   END_TEST;
 }
 
+int UtcDaliToolkitTextlabelTextFitStressTest(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelTextFitStressTest");
+  TextLabel label = TextLabel::New();
+  Vector2   size(460.0f, 100.0f);
+  label.SetProperty(Actor::Property::SIZE, size);
+  label.SetProperty(TextLabel::Property::TEXT, "Hello world");
+
+  // connect to the text git changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  DevelTextLabel::TextFitChangedSignal(label).Connect(&TestTextFitChangedCallback);
+  bool textFitChangedSignal = false;
+  label.ConnectSignal(testTracker, "textFitChanged", CallbackFunctor(&textFitChangedSignal));
+  gTextFitChangedCallBackCalled = false;
+
+  // check point size with veryvery big range
+  Property::Map textFitMapSet;
+  textFitMapSet["enable"]       = true;
+  textFitMapSet["minSize"]      = 10.f;
+  textFitMapSet["maxSize"]      = 10000.f;
+  textFitMapSet["stepSize"]     = -1.0f;
+  textFitMapSet["fontSizeType"] = "pointSize";
+
+  label.SetProperty(Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMapSet);
+  label.SetProperty(TextLabel::Property::POINT_SIZE, 120.f);
+
+  application.GetScene().Add(label);
+
+  application.SendNotification();
+  application.Render();
+
+  const Vector3 EXPECTED_NATURAL_SIZE(450.0f, 96.0f, 0.0f);
+  DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION);
+
+  DALI_TEST_CHECK(gTextFitChangedCallBackCalled);
+  DALI_TEST_CHECK(textFitChangedSignal);
+
+  END_TEST;
+}
+
 int UtcDaliToolkitTextlabelMaxTextureSet(void)
 {
   ToolkitTestApplication application;
@@ -2138,7 +2178,6 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void)
   application.SendNotification();
   application.Render();
 
-
   END_TEST;
 }
 
@@ -2687,7 +2726,6 @@ int utcDaliTextLabelGeometryOneGlyph(void)
   END_TEST;
 }
 
-
 int utcDaliTextLabelGeometryNullPtr(void)
 {
   ToolkitTestApplication application;
index 917842d..1457e19 100644 (file)
@@ -118,15 +118,15 @@ Dali::Actor CreateSkybox(const std::string& skyboxUrl)
     {Vector3(-1.0f, -1.0f, 1.0f)},
     {Vector3(1.0f, -1.0f, 1.0f)}};
 
-  Dali::Shader       shaderSkybox  = Shader::New(SHADER_SKYBOX_SHADER_VERT.data(), SHADER_SKYBOX_SHADER_FRAG.data());
-  Dali::VertexBuffer vertexBuffer  = Dali::VertexBuffer::New(Property::Map().Add("aPosition", Property::VECTOR3));
+  Dali::Shader       shaderSkybox = Shader::New(SHADER_SKYBOX_SHADER_VERT.data(), SHADER_SKYBOX_SHADER_FRAG.data());
+  Dali::VertexBuffer vertexBuffer = Dali::VertexBuffer::New(Property::Map().Add("aPosition", Property::VECTOR3));
   vertexBuffer.SetData(skyboxVertices, sizeof(skyboxVertices) / sizeof(Vertex));
 
   Dali::Geometry skyboxGeometry = Geometry::New();
   skyboxGeometry.AddVertexBuffer(vertexBuffer);
   skyboxGeometry.SetType(Geometry::TRIANGLES);
 
-  Dali::Texture    skyboxTexture   = Dali::Scene3D::Loader::LoadCubeMap(skyboxUrl);
+  Dali::Texture    skyboxTexture  = Dali::Scene3D::Loader::LoadCubeMap(skyboxUrl);
   Dali::TextureSet skyboxTextures = TextureSet::New();
   skyboxTextures.SetTexture(0, skyboxTexture);
 
@@ -399,12 +399,20 @@ Quaternion SceneView::GetSkyboxOrientation() const
 
 void SceneView::OnSceneConnection(int depth)
 {
-  UpdateRenderTask();
-
   Window window = DevelWindow::Get(Self());
   if(window)
   {
     window.ResizeSignal().Connect(this, &SceneView::OnWindowResized);
+    RenderTaskList taskList = window.GetRenderTaskList();
+    mRenderTask             = taskList.CreateTask();
+    mRenderTask.SetSourceActor(mRootLayer);
+    mRenderTask.SetExclusive(true);
+    mRenderTask.SetInputEnabled(true);
+    mRenderTask.SetCullMode(false);
+    mRenderTask.SetScreenToFrameBufferMappingActor(Self());
+
+    UpdateRenderTask();
+    mWindow = window;
   }
 
   Control::OnSceneConnection(depth);
@@ -414,11 +422,18 @@ void SceneView::OnSceneDisconnection()
 {
   mItems.clear();
 
-  Window window = DevelWindow::Get(Self());
+  Window window = mWindow.GetHandle();
   if(window)
   {
     window.ResizeSignal().Disconnect(this, &SceneView::OnWindowResized);
+    RenderTaskList taskList = window.GetRenderTaskList();
+    if(mRenderTask)
+    {
+      taskList.RemoveTask(mRenderTask);
+      mRenderTarget.Reset();
+    }
   }
+  mWindow.Reset();
 
   Control::OnSceneDisconnection();
 }
@@ -435,14 +450,6 @@ void SceneView::OnInitialize()
   mRootLayer.SetProperty(Dali::Actor::Property::INHERIT_SCALE, false);
   self.Add(mRootLayer);
 
-  RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
-  mRenderTask             = taskList.CreateTask();
-  mRenderTask.SetSourceActor(mRootLayer);
-  mRenderTask.SetExclusive(true);
-  mRenderTask.SetInputEnabled(true);
-  mRenderTask.SetCullMode(false);
-  mRenderTask.SetScreenToFrameBufferMappingActor(Self());
-
   mDefaultCamera = Dali::CameraActor::New();
   mDefaultCamera.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
   mDefaultCamera.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
@@ -519,18 +526,6 @@ void SceneView::UpdateRenderTask()
     Vector3     size        = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
     const float aspectRatio = size.width / size.height;
     mSelectedCamera.SetAspectRatio(aspectRatio);
-    const bool projectionVertical = mSelectedCamera.GetProperty<int>(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION) == Dali::DevelCameraActor::VERTICAL;
-
-    // if projectionVertical, Top / Bottom is +-ve to keep consistency with orthographic values
-    // else, Left / Right is +-ve to keep consistency with orthographic values
-    const float orthographicSize = DALI_LIKELY(projectionVertical) ? mSelectedCamera[Dali::CameraActor::Property::TOP_PLANE_DISTANCE] : mSelectedCamera[Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE];
-    const float halfHeight       = DALI_LIKELY(projectionVertical) ? orthographicSize : orthographicSize / aspectRatio;
-    const float halfWidth        = DALI_LIKELY(projectionVertical) ? orthographicSize * aspectRatio : orthographicSize;
-
-    mSelectedCamera[Dali::CameraActor::Property::LEFT_PLANE_DISTANCE]   = -halfWidth;
-    mSelectedCamera[Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE]  = halfWidth;
-    mSelectedCamera[Dali::CameraActor::Property::TOP_PLANE_DISTANCE]    = halfHeight;
-    mSelectedCamera[Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE] = -halfHeight;
 
     if(mUseFrameBuffer)
     {
index db3c33e..7632d80 100644 (file)
@@ -237,7 +237,7 @@ private:
   void OnWindowResized(Window window, Window::WindowSize size);
 
   /**
-   * @brief Update camera's projection orientation according to the screen orientation.
+   * @brief Updates camera's projection orientation according to the screen orientation.
    */
   void RotateCamera();
 
@@ -246,6 +246,7 @@ private:
 
   /////////////////////////////////////////////////////////////
   // FrameBuffer and Rendertask to render child objects as a 3D Scene
+  Dali::WeakHandle<Dali::Window>                           mWindow;
   CameraActor                                              mDefaultCamera;
   CameraActor                                              mSelectedCamera;
   std::vector<CameraActor>                                 mCameras;
index 5207a27..270f84b 100644 (file)
@@ -16,6 +16,7 @@
  */
 #include "dali-scene3d/public-api/loader/camera-parameters.h"
 #include "dali-scene3d/public-api/loader/utils.h"
+#include "dali/devel-api/actors/camera-actor-devel.h"
 #include "dali/integration-api/debug.h"
 #include "dali/public-api/actors/camera-actor.h"
 #include "dali/public-api/math/quaternion.h"
@@ -155,10 +156,10 @@ ViewProjection CameraParameters::GetViewProjection() const
   else
   {
     Orthographic(viewProjection.GetProjection(),
-                 orthographicSize.x,
-                 orthographicSize.y,
-                 orthographicSize.z,
-                 orthographicSize.w,
+                 -orthographicSize * aspectRatio,
+                 orthographicSize * aspectRatio,
+                 orthographicSize,
+                 -orthographicSize,
                  zNear,
                  zFar,
                  true);
@@ -204,12 +205,10 @@ void CameraParameters::ConfigureCamera(CameraActor& camera) const
   else
   {
     camera.SetProjectionMode(Camera::ORTHOGRAPHIC_PROJECTION);
-    camera.SetOrthographicProjection(orthographicSize.x,
-                                     orthographicSize.y,
-                                     orthographicSize.z,
-                                     orthographicSize.w,
-                                     zNear,
-                                     zFar);
+    camera.SetNearClippingPlane(zNear);
+    camera.SetFarClippingPlane(zFar);
+    camera.SetAspectRatio(aspectRatio);
+    camera.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, orthographicSize);
   }
 
   // model
index 74d6eec..70060e5 100644 (file)
@@ -35,12 +35,13 @@ namespace Loader
 {
 struct DALI_SCENE3D_API CameraParameters
 {
-  Matrix  matrix           = Matrix::IDENTITY;
-  Vector4 orthographicSize = Vector4{-1.f, 1.f, 1.f, -1.f};
-  float   yFov             = 60.f;
-  float   zNear            = 0.1f;
-  float   zFar             = 1000.f;
-  bool    isPerspective    = true;
+  Matrix matrix           = Matrix::IDENTITY;
+  float  orthographicSize = 1.f;
+  float  aspectRatio      = 1.f;
+  float  yFov             = 60.f;
+  float  zNear            = 0.1f;
+  float  zFar             = 1000.f;
+  bool   isPerspective    = true;
 
   /**
    * @return The view-projection matrix of the camera.
index 8eb596d..133e62c 100644 (file)
@@ -485,8 +485,7 @@ void DliLoader::Impl::ParseScene(LoadParams& params)
 
 void DliLoader::Impl::ParseSceneInternal(Index iScene, const Toolkit::TreeNode* tnScenes, const Toolkit::TreeNode* tnNodes, LoadParams& params)
 {
-  auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene)
-  {
+  auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene) {
     auto tn = GetNthChild(tnScenes, iScene); // now a "scene" object
     if(!tn)
     {
@@ -1728,6 +1727,8 @@ void DliLoader::Impl::GetCameraParameters(std::vector<CameraParameters>& cameras
   {
     if(const TreeNode* jsonCameras = mParser.GetRoot()->GetChild("cameras"))
     {
+      float dummyFloatArray[4];
+
       cameras.resize(jsonCameras->Size());
       auto iCamera = cameras.begin();
       for(auto i0 = jsonCameras->CBegin(), i1 = jsonCameras->CEnd(); i0 != i1; ++i0)
@@ -1737,9 +1738,12 @@ void DliLoader::Impl::GetCameraParameters(std::vector<CameraParameters>& cameras
         ReadFloat(jsonCamera.GetChild("fov"), iCamera->yFov);
         ReadFloat(jsonCamera.GetChild("near"), iCamera->zNear);
         ReadFloat(jsonCamera.GetChild("far"), iCamera->zFar);
-        if(ReadVector(jsonCamera.GetChild("orthographic"), iCamera->orthographicSize.AsFloat(), 4u))
+        if(ReadVector(jsonCamera.GetChild("orthographic"), dummyFloatArray, 4u))
         {
           iCamera->isPerspective = false;
+
+          iCamera->orthographicSize = dummyFloatArray[2] * 0.5f;
+          iCamera->aspectRatio      = dummyFloatArray[1] / dummyFloatArray[2];
         }
 
         if(auto jsonMatrix = jsonCamera.GetChild("matrix"))
index 316803d..60f6970 100644 (file)
@@ -718,7 +718,8 @@ void ConvertCamera(const gt::Camera& camera, CameraParameters& camParams)
   else
   {
     auto& ortho                = camera.mOrthographic;
-    camParams.orthographicSize = Vector4(-ortho.mXMag, ortho.mXMag, ortho.mYMag, -ortho.mYMag) * .5f;
+    camParams.orthographicSize = ortho.mYMag * .5f;
+    camParams.aspectRatio      = ortho.mXMag / ortho.mYMag;
     camParams.zNear            = ortho.mZNear;
     camParams.zFar             = ortho.mZFar;
   }
index 4cbda06..4549ea4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -30,39 +30,39 @@ namespace Dali::Toolkit::Internal
 {
 Dali::Toolkit::GlView DrawableView::New(GlView::BackendMode backendMode)
 {
-  auto* impl   = new DrawableView(backendMode);
+  auto*                 impl   = new DrawableView(backendMode);
   Dali::Toolkit::GlView handle = Dali::Toolkit::GlView(*impl);
   impl->Initialize();
   return handle;
 }
 
 DrawableView::DrawableView(GlView::BackendMode backendMode)
-: Dali::Toolkit::Internal::GlViewImpl( backendMode),
+: Dali::Toolkit::Internal::GlViewImpl(backendMode),
   mRenderingMode(Toolkit::GlView::RenderingMode::CONTINUOUS),
   mDepth(false),
   mStencil(false),
   mMSAA(0)
 {
-  mRenderCallback = RenderCallback::New( this, &DrawableView::OnRenderCallback);
+  mRenderCallback = RenderCallback::New(this, &DrawableView::OnRenderCallback);
 
   // Create NativeRenderer
   Dali::Internal::NativeRendererCreateInfo createInfo;
   createInfo.maxOffscreenBuffers = 2u;
-  createInfo.threadEnabled = (backendMode == GlView::BackendMode::DIRECT_RENDERING_THREADED);
-  createInfo.presentationMode = Dali::Internal::NativeRendererCreateInfo::PresentationMode::FIFO;
-  mNativeRenderer = std::make_unique<Dali::Internal::DrawableViewNativeRenderer>(createInfo);
+  createInfo.threadEnabled       = (backendMode == GlView::BackendMode::DIRECT_RENDERING_THREADED);
+  createInfo.presentationMode    = Dali::Internal::NativeRendererCreateInfo::PresentationMode::FIFO;
+  mNativeRenderer                = std::make_unique<Dali::Internal::DrawableViewNativeRenderer>(createInfo);
 }
 
 DrawableView::~DrawableView() = default;
 
 void DrawableView::RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback)
 {
-  mNativeRenderer->RegisterGlCallbacks( initCallback, renderFrameCallback, terminateCallback );
+  mNativeRenderer->RegisterGlCallbacks(initCallback, renderFrameCallback, terminateCallback);
 }
 
 void DrawableView::SetResizeCallback(CallbackBase* resizeCallback)
 {
-  mOnResizeCallback.reset( resizeCallback );
+  mOnResizeCallback.reset(resizeCallback);
 }
 
 bool DrawableView::SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::Toolkit::GlView::GraphicsApiVersion version)
@@ -100,6 +100,11 @@ void DrawableView::RenderOnce()
   // feature.
 }
 
+void DrawableView::BindTextureResources(std::vector<Dali::Texture> textures)
+{
+  mRenderCallback->BindTextureResources(std::move(textures));
+}
+
 void DrawableView::OnInitialize()
 {
   AddRenderer();
@@ -118,7 +123,7 @@ void DrawableView::OnSizeSet(const Vector3& targetSize)
   // If the callbacks are set then schedule execution of resize callback
   if(mRenderCallback && mNativeRenderer)
   {
-    mNativeRenderer->Resize( uint32_t(targetSize.width), uint32_t(targetSize.height));
+    mNativeRenderer->Resize(uint32_t(targetSize.width), uint32_t(targetSize.height));
     mSurfaceResized = true;
   }
 }
@@ -158,19 +163,19 @@ void DrawableView::OnSceneDisconnection()
 void DrawableView::AddRenderer()
 {
   Actor    self     = Self();
-  Renderer renderer = Renderer::New( *mRenderCallback );
+  Renderer renderer = Renderer::New(*mRenderCallback);
   self.AddRenderer(renderer);
 }
 
-bool DrawableView::OnRenderCallback( const RenderCallbackInput& renderCallbackInput )
+bool DrawableView::OnRenderCallback(const RenderCallbackInput& renderCallbackInput)
 {
   if(mNativeRenderer)
   {
-    mNativeRenderer->PushRenderCallbackInputData( renderCallbackInput );
+    mNativeRenderer->PushRenderCallbackInputData(renderCallbackInput);
   }
 
   // Init state
-  if( mCurrentViewState == ViewState::INIT )
+  if(mCurrentViewState == ViewState::INIT)
   {
     mNativeRenderer->InvokeGlInitCallback(renderCallbackInput);
     mCurrentViewState = ViewState::RENDER;
@@ -178,18 +183,15 @@ bool DrawableView::OnRenderCallback( const RenderCallbackInput& renderCallbackIn
 
   if(mSurfaceResized)
   {
-    mNativeRenderer->Resize( uint32_t(mSurfaceSize.width), uint32_t(mSurfaceSize.height) );
+    mNativeRenderer->Resize(uint32_t(mSurfaceSize.width), uint32_t(mSurfaceSize.height));
     mSurfaceResized = false;
   }
 
-  if( mCurrentViewState == ViewState::RENDER )
+  if(mCurrentViewState == ViewState::RENDER)
   {
     // The mSurfaceResized is set by another thread so atomic check must be provided
-    bool expected{ true };
-    if(mSurfaceResized.compare_exchange_weak( expected, false,
-                                             std::memory_order_release,
-                                             std::memory_order_relaxed
-                                             ) && mOnResizeCallback)
+    bool expected{true};
+    if(mSurfaceResized.compare_exchange_weak(expected, false, std::memory_order_release, std::memory_order_relaxed) && mOnResizeCallback)
     {
       CallbackBase::Execute(*mOnResizeCallback, static_cast<int>(mSurfaceSize.x), static_cast<int>(mSurfaceSize.y));
     }
@@ -211,4 +213,4 @@ bool DrawableView::OnRenderCallback( const RenderCallbackInput& renderCallbackIn
   return true;
 }
 
-} // namespace Dali
+} // namespace Dali::Toolkit::Internal
index 55f1db3..57611cc 100644 (file)
@@ -28,8 +28,8 @@
 #include "gl-view-interface-impl.h"
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/gl-view/gl-view-interface-impl.h>
 #include <dali-toolkit/internal/controls/gl-view/drawable-view-native-renderer.h>
+#include <dali-toolkit/internal/controls/gl-view/gl-view-interface-impl.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/gl-view/gl-view.h>
 
@@ -45,7 +45,6 @@ protected:
   virtual ~DrawableView();
 
 public:
-
   /**
    * @brief Creates GlView interface object using DrawableView implementation
    *
@@ -91,7 +90,12 @@ public:
   /**
    * @copydoc Dali::Toolkit::GlView::RenderOnce()
    */
-  void RenderOnce();
+  void RenderOnce() override;
+
+  /**
+   * @copydoc Dali::Toolkit::GlView::BindTextureResources()
+   */
+  void BindTextureResources(std::vector<Dali::Texture> textures) override;
 
 private: // From Control
   /**
@@ -135,8 +139,7 @@ private:
   void AddRenderer();
 
 private:
-
-  bool OnRenderCallback( const RenderCallbackInput& renderCallbackInput );
+  bool OnRenderCallback(const RenderCallbackInput& renderCallbackInput);
 
 private:
   Dali::Toolkit::GlView::RenderingMode mRenderingMode;
@@ -170,6 +173,6 @@ private:
 
 } // namespace Internal
 
-} // namespace Dali
+} // namespace Dali::Toolkit
 
 #endif // DALI_TOOLKIT_INTERNAL_DRAWABLE_VIEW_H
index 2eaf78c..7d638ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -40,14 +40,14 @@ namespace Internal
 {
 Dali::Toolkit::GlView GlView::New(Dali::Toolkit::GlView::ColorFormat colorFormat)
 {
-  auto* impl   = new Dali::Toolkit::Internal::GlView(colorFormat);
+  auto*                 impl   = new Dali::Toolkit::Internal::GlView(colorFormat);
   Dali::Toolkit::GlView handle = Dali::Toolkit::GlView(*impl);
   impl->Initialize();
   return handle;
 }
 
 GlView::GlView(Dali::Toolkit::GlView::ColorFormat colorFormat)
-: Dali::Toolkit::Internal::GlViewImpl( Toolkit::GlView::BackendMode::EGL_IMAGE_OFFSCREEN_RENDERING ),
+: Dali::Toolkit::Internal::GlViewImpl(Toolkit::GlView::BackendMode::EGL_IMAGE_OFFSCREEN_RENDERING),
   mRenderThread(nullptr),
   mNativeImageQueue(nullptr),
   mRenderingMode(Toolkit::GlView::RenderingMode::CONTINUOUS),
@@ -147,6 +147,11 @@ void GlView::RenderOnce()
   }
 }
 
+void GlView::BindTextureResources(std::vector<Dali::Texture> textures)
+{
+  // Not supported in the indirect mode
+}
+
 void GlView::OnInitialize()
 {
   //Create NativeImageSourceQueue with the size of 1,1
index 306a53b..e70cd99 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_GL_VIEW_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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/rendering/shader.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/gl-view/gl-view-render-thread.h>
 #include <dali-toolkit/internal/controls/gl-view/gl-view-interface-impl.h>
+#include <dali-toolkit/internal/controls/gl-view/gl-view-render-thread.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/gl-view/gl-view.h>
 
-
 namespace Dali::Toolkit
 {
 class GlView;
@@ -84,6 +83,11 @@ public:
    */
   void RenderOnce() override;
 
+  /**
+   * @copydoc Dali::Toolkit::GlView::BindTextureResources()
+   */
+  void BindTextureResources(std::vector<Dali::Texture> textures) override;
+
 private: // From Control
   /**
    * @copydoc Toolkit::Control::OnInitialize()
@@ -155,6 +159,6 @@ private:
 
 } // namespace Internal
 
-} // namespace Dali
+} // namespace Dali::Toolkit
 
 #endif // DALI_TOOLKIT_INTERNAL_GL_VIEW_H
index 5547789..9b9ffa7 100644 (file)
@@ -39,16 +39,14 @@ namespace Internal
 class GlViewImpl : public Dali::Toolkit::Internal::Control
 {
 protected:
-
   virtual ~GlViewImpl() = default;
 
 public:
-
   /**
    * Construct a new GlView.
    */
-  explicit GlViewImpl( GlView::BackendMode backendMode ) :
-    Control(ControlBehaviour(0u | ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
+  explicit GlViewImpl(GlView::BackendMode backendMode)
+  : Control(ControlBehaviour(0u | ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
     mBackendMode(backendMode)
   {
   }
@@ -91,6 +89,11 @@ public:
    */
   virtual void RenderOnce() = 0;
 
+  /**
+   * @copydoc Dali::Toolkit::GlView::BindTextureResources()
+   */
+  virtual void BindTextureResources(std::vector<Dali::Texture> textures) = 0;
+
 private: // From Control
   /**
    * @copydoc Toolkit::Control::OnInitialize()
@@ -108,8 +111,7 @@ private: // From Control
   virtual void OnSceneDisconnection() override = 0;
 
 protected:
-
-  GlView::BackendMode mBackendMode { GlView::BackendMode::DEFAULT }; ///< Implementation backend mode (DirectRendering, EGL image)
+  GlView::BackendMode mBackendMode{GlView::BackendMode::DEFAULT}; ///< Implementation backend mode (DirectRendering, EGL image)
 };
 
 } // namespace Internal
@@ -128,6 +130,6 @@ inline const Dali::Toolkit::Internal::GlViewImpl& GetImpl(const Dali::Toolkit::G
   return static_cast<const Dali::Toolkit::Internal::GlViewImpl&>(impl);
 }
 
-} // namespace Dali
+} // namespace Dali::Toolkit
 
 #endif // DALI_TOOLKIT_INTERNAL_GL_VIEW_IMPL_H
index 55dfd8d..0f5f792 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali/devel-api/actors/camera-actor-devel.h>
 #include <dali/devel-api/adaptor-framework/file-stream.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/integration-api/debug.h>
@@ -231,7 +232,7 @@ void FitBuffer(Dali::Vector<Vector4>& bufferDestination, Dali::Vector<T>& buffer
 template<typename T>
 bool ReadBinFile(Vector<T>& dataBuffer, std::string url, int32_t offset, int32_t count)
 {
-  size_t readCount = 0;
+  size_t           readCount = 0;
   Dali::FileStream fileStream(url, FileStream::READ | FileStream::BINARY);
   FILE*            fp = fileStream.GetFile();
   if(fp)
@@ -1300,9 +1301,22 @@ void Loader::LoadCamera(Scene3dView& scene3dView)
     if(cameraInfo.type == "orthographic")
     {
       LoadOrthoGraphic((*cameraIter).second, cameraInfo);
-      float xMag_2 = cameraInfo.orthographic.xmag / 2.0;
-      float yMag_2 = cameraInfo.orthographic.ymag / 2.0;
-      cameraActor.SetOrthographicProjection(-xMag_2, xMag_2, yMag_2, -yMag_2, cameraInfo.orthographic.znear, cameraInfo.orthographic.zfar);
+      float       xMag_2 = cameraInfo.orthographic.xmag / 2.0;
+      float       yMag_2 = cameraInfo.orthographic.ymag / 2.0;
+      const float aspect = xMag_2 / yMag_2;
+
+      cameraActor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
+      cameraActor.SetProperty(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE, yMag_2);
+
+      cameraActor.SetNearClippingPlane(cameraInfo.orthographic.znear);
+      if(cameraInfo.orthographic.zfar > 0.0)
+      {
+        cameraActor.SetFarClippingPlane(cameraInfo.orthographic.zfar);
+      }
+      if(aspect > 0.0f) // Avoid divide-by-zero logic
+      {
+        cameraActor.SetAspectRatio(aspect);
+      }
     }
     else if(cameraInfo.type == "perspective")
     {
@@ -1593,7 +1607,7 @@ Actor Loader::AddNode(Scene3dView& scene3dView, uint32_t index)
     actor.SetProperty(Actor::Property::POSITION, translation);
 
     float hasLightSource = static_cast<float>(!!(scene3dView.GetLightType() & (Toolkit::Scene3dView::LightType::POINT_LIGHT | Toolkit::Scene3dView::LightType::DIRECTIONAL_LIGHT)));
-    float isPointLight = static_cast<float>(!!(scene3dView.GetLightType() & Toolkit::Scene3dView::LightType::POINT_LIGHT));
+    float isPointLight   = static_cast<float>(!!(scene3dView.GetLightType() & Toolkit::Scene3dView::LightType::POINT_LIGHT));
     shader.RegisterProperty("uHasLightSource", hasLightSource);
     shader.RegisterProperty("uIsPointLight", isPointLight);
     shader.RegisterProperty("uLightVector", scene3dView.GetLightVector());
index 8520498..a27f45d 100644 (file)
@@ -233,10 +233,10 @@ Toolkit::TextEditor::InputStyle::Mask ConvertInputStyle(Text::InputStyle::Mask i
 
 } // namespace
 
-Toolkit::TextEditor TextEditor::New()
+Toolkit::TextEditor TextEditor::New(ControlBehaviour additionalBehaviour)
 {
   // Create the implementation, temporarily owned by this handle on stack
-  IntrusivePtr<TextEditor> impl = new TextEditor();
+  IntrusivePtr<TextEditor> impl = new TextEditor(additionalBehaviour);
 
   // Pass ownership to CustomActor handle
   Toolkit::TextEditor handle(*impl);
@@ -1366,8 +1366,8 @@ void TextEditor::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type typ
   mController->ChangedLayoutDirection();
 }
 
-TextEditor::TextEditor()
-: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
+TextEditor::TextEditor(ControlBehaviour additionalBehaviour)
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour)),
   mAnimationPeriod(0.0f, 0.0f),
   mIdleCallback(NULL),
   mAlignmentOffset(0.f),
index 062baf4..a6cd50d 100644 (file)
@@ -58,8 +58,9 @@ class TextEditor : public Control, public Text::ControlInterface, public Text::E
 public:
   /**
    * @copydoc Dali::Toollkit::TextEditor::New()
+   * @param[in] additionalBehaviour custom behavior flags for this TextEditor. Default is CONTROL_BEHAVIOUR_DEFAULT
    */
-  static Toolkit::TextEditor New();
+  static Toolkit::TextEditor New(ControlBehaviour additionalBehaviour = ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
 
   // Properties
 
@@ -525,8 +526,10 @@ private: // Implementation
 
   /**
    * Construct a new TextEditor.
+   *
+   * @param[in] additionalBehaviour additional behaviour flags for this TextEditor
    */
-  TextEditor();
+  TextEditor(ControlBehaviour additionalBehaviour);
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
index 2f0b559..3d53aa1 100644 (file)
@@ -209,10 +209,10 @@ Toolkit::TextField::InputStyle::Mask ConvertInputStyle(Text::InputStyle::Mask in
 
 } // namespace
 
-Toolkit::TextField TextField::New()
+Toolkit::TextField TextField::New(ControlBehaviour additionalBehaviour)
 {
   // Create the implementation, temporarily owned by this handle on stack
-  IntrusivePtr<TextField> impl = new TextField();
+  IntrusivePtr<TextField> impl = new TextField(additionalBehaviour);
 
   // Pass ownership to CustomActor handle
   Toolkit::TextField handle(*impl);
@@ -1167,8 +1167,8 @@ void TextField::OnIdleSignal()
   mIdleCallback = NULL;
 }
 
-TextField::TextField()
-: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
+TextField::TextField(ControlBehaviour additionalBehaviour)
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour)),
   mIdleCallback(NULL),
   mAlignmentOffset(0.f),
   mRenderingBackend(DEFAULT_RENDERING_BACKEND),
index 7b5d2f6..c9ef431 100644 (file)
@@ -54,8 +54,9 @@ class TextField : public Control, public Text::ControlInterface, public Text::Ed
 public:
   /**
    * @copydoc Dali::Toollkit::TextField::New()
+   * @param[in] additionalBehaviour custom behavior flags for this TextField. Default is CONTROL_BEHAVIOUR_DEFAULT
    */
-  static Toolkit::TextField New();
+  static Toolkit::TextField New(ControlBehaviour additionalBehaviour = ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
 
   // Properties
 
@@ -481,8 +482,10 @@ private: // Implementation
 
   /**
    * Construct a new TextField.
+   *
+   * @param[in] additionalBehaviour additional behaviour flags for this TextField
    */
-  TextField();
+  TextField(ControlBehaviour additionalBehaviour);
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
index 2c379db..570e370 100644 (file)
@@ -1214,8 +1214,8 @@ void TextLabel::OnAccessibilityStatusChanged()
   CommonTextUtils::SynchronizeTextAnchorsInParent(Self(), mController, mAnchorActors);
 }
 
-TextLabel::TextLabel(ControlBehaviour additionalBehavior)
-: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehavior)),
+TextLabel::TextLabel(ControlBehaviour additionalBehaviour)
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour)),
   mRenderingBackend(DEFAULT_RENDERING_BACKEND),
   mTextUpdateNeeded(false),
   mLastAutoScrollEnabled(false)
index c759051..f95019a 100644 (file)
@@ -23,9 +23,9 @@
 #include <limits>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
 #include <dali-toolkit/internal/text/controller/text-controller-event-handler.h>
 #include <dali-toolkit/internal/text/controller/text-controller-impl.h>
+#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
 
 namespace
 {
@@ -253,48 +253,65 @@ void Controller::Relayouter::FitPointSizeforLayout(Controller& controller, const
     float currentFitPointSize = impl.mFontDefaults->mFitPointSize;
 
     model->mElideEnabled = false;
-    Vector<float> pointSizeArray;
 
     // check zero value
     if(pointInterval < 1.f)
     {
       impl.mTextFitStepSize = pointInterval = 1.0f;
     }
+    uint32_t pointSizeRange = static_cast<uint32_t>(ceil((maxPointSize - minPointSize) / pointInterval));
 
-    pointSizeArray.Reserve(static_cast<unsigned int>(ceil((maxPointSize - minPointSize) / pointInterval)));
-
-    for(float i = minPointSize; i < maxPointSize; i += pointInterval)
+    // Ensure minPointSize + pointSizeRange * pointInverval >= maxPointSize
+    while(minPointSize + static_cast<float>(pointSizeRange) * pointInterval < maxPointSize)
     {
-      pointSizeArray.PushBack(i);
+      ++pointSizeRange;
     }
 
-    pointSizeArray.PushBack(maxPointSize);
-
-    int bestSizeIndex = 0;
-    int min           = bestSizeIndex + 1;
-    int max           = pointSizeArray.Size() - 1;
-    while(min <= max)
+    uint32_t bestSizeIndex = 0;
+    uint32_t minIndex      = bestSizeIndex + 1u;
+    uint32_t maxIndex      = pointSizeRange + 1u;
+
+    bool bestSizeUpdatedLatest = false;
+    // Find best size as binary search.
+    // Range format as [l r). (left closed, right opened)
+    // It mean, we already check all i < l is valid, and r <= i is invalid.
+    // Below binary search will check m = (l+r)/2 point.
+    // Search area sperate as [l m) or [m+1 r)
+    //
+    // Basically, we can assume that 0 (minPointSize) is always valid.
+    // Now, we will check [1 pointSizeRange] range s.t. pointSizeRange mean the maxPointSize
+    while(minIndex < maxIndex)
     {
-      int destI = (min + max) / 2;
+      uint32_t    testIndex     = minIndex + ((maxIndex - minIndex) >> 1u);
+      const float testPointSize = std::min(maxPointSize, minPointSize + static_cast<float>(testIndex) * pointInterval);
 
-      if(CheckForTextFit(controller, pointSizeArray[destI], layoutSize))
+      if(CheckForTextFit(controller, testPointSize, layoutSize))
       {
-        bestSizeIndex = min;
-        min           = destI + 1;
+        bestSizeUpdatedLatest = true;
+
+        bestSizeIndex = testIndex;
+        minIndex      = testIndex + 1u;
       }
       else
       {
-        max           = destI - 1;
-        bestSizeIndex = max;
+        bestSizeUpdatedLatest = false;
+        maxIndex              = testIndex;
       }
     }
+    const float bestPointSize = std::min(maxPointSize, minPointSize + static_cast<float>(bestSizeIndex) * pointInterval);
+
+    // Best point size was not updated. re-run so the TextFit should be fitted really.
+    if(!bestSizeUpdatedLatest)
+    {
+      CheckForTextFit(controller, bestPointSize, layoutSize);
+    }
 
     model->mElideEnabled = actualellipsis;
-    if(currentFitPointSize != pointSizeArray[bestSizeIndex])
+    if(currentFitPointSize != bestPointSize)
     {
       impl.mTextFitChanged = true;
     }
-    impl.mFontDefaults->mFitPointSize = pointSizeArray[bestSizeIndex];
+    impl.mFontDefaults->mFitPointSize = bestPointSize;
     impl.mFontDefaults->sizeDefined   = true;
     impl.ClearFontData();
   }
index 390af53..f0dbb94 100644 (file)
@@ -92,7 +92,7 @@ TextureSet RollingImageCache::Frame(uint32_t frameIndex)
     // If the frame of frameIndex was already loaded, load batch from the last frame of queue
     if(!mQueue.IsEmpty())
     {
-      batchFrameIndex = (mQueue.Back().mUrlIndex + 1) % mImageUrls.size();
+      batchFrameIndex = (mQueue.Back().mUrlIndex + 1) % static_cast<uint32_t>(mImageUrls.size());
     }
     LoadBatch(batchFrameIndex);
   }
index 77e75e8..3035ace 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -24,7 +24,6 @@
 
 namespace Dali::Toolkit
 {
-
 GlView::GlView() = default;
 
 GlView::GlView(const GlView& GlView) = default;
@@ -41,7 +40,7 @@ GlView GlView::New(ColorFormat colorFormat)
 {
   // This function is backward compatible and always returns
   // backend based on NativeImage.
-  return Internal::GlView::New( colorFormat );
+  return Internal::GlView::New(colorFormat);
 }
 
 GlView GlView::New(BackendMode backendMode, ColorFormat colorFormat)
@@ -105,6 +104,11 @@ void GlView::RenderOnce()
   Dali::Toolkit::GetImpl(*this).RenderOnce();
 }
 
+void GlView::BindTextureResources(std::vector<Dali::Texture> textures)
+{
+  Dali::Toolkit::GetImpl(*this).BindTextureResources(std::move(textures));
+}
+
 GlView::GlView(Internal::GlViewImpl& implementation)
 : Control(implementation)
 {
@@ -116,4 +120,4 @@ GlView::GlView(Dali::Internal::CustomActor* internal)
   VerifyCustomActorPointer<Internal::GlViewImpl>(internal);
 }
 
-} // namespace Dali
+} // namespace Dali::Toolkit
index a3b18c6..ff67832 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_TOOLKIT_GL_VIEW_H
 #define DALI_TOOLKIT_GL_VIEW_H
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -17,6 +17,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <dali/public-api/rendering/texture.h>
+
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 
@@ -41,7 +44,6 @@ class GlViewImpl;
 class DALI_TOOLKIT_API GlView : public Dali::Toolkit::Control
 {
 public:
-
   /**
    * @brief Implementation backend mode
    *
@@ -322,6 +324,24 @@ public:
    */
   void RenderOnce();
 
+  /**
+   * @brief Binds DALi textures to the callback
+   *
+   * The textures that are bound to the callback will be passed upon
+   * callback execution providing native handles (like GL name) so they
+   * can be used alongside with custom GL code.
+   *
+   * Binding texture does not affect lifecycle and it's up to the client-side
+   * to make sure the resource is alive when used inside the callback.
+   *
+   * @param[in] textures List of DALi textures to be bound to the callback
+   *
+   * @note It only supported only in the GlView::BackendMode::DIRECT_RENDERING.
+   *
+   * @SINCE_2_2.2
+   */
+  void BindTextureResources(std::vector<Dali::Texture> textures);
+
 public: // Not intended for application developers
   /// @cond internal
   /**
index 980b0c9..17b7486 100644 (file)
@@ -30,6 +30,11 @@ TextEditor TextEditor::New()
   return Internal::TextEditor::New();
 }
 
+TextEditor TextEditor::New(ControlBehaviour additionalBehaviour)
+{
+  return Internal::TextEditor::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
+}
+
 TextEditor::TextEditor()
 {
 }
index b644b08..d3d8595 100644 (file)
@@ -512,6 +512,15 @@ public:
   New();
 
   /**
+   * @brief Creates the TextEditor control with additional behaviour.
+   *
+   * @SINCE_2_2.3
+   * @param[in] additionalBehaviour Additional control behaviour
+   * @return A handle to the TextEditor control
+   */
+  static TextEditor New(ControlBehaviour additionalBehaviour);
+
+  /**
    * @brief Creates an empty handle.
    *
    * @SINCE_1_1.37
index 075a468..3c862fa 100644 (file)
@@ -30,6 +30,11 @@ TextField TextField::New()
   return Internal::TextField::New();
 }
 
+TextField TextField::New(ControlBehaviour additionalBehaviour)
+{
+  return Internal::TextField::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
+}
+
 TextField::TextField()
 {
 }
index a99d1d2..302ba46 100644 (file)
@@ -523,6 +523,15 @@ public:
   static TextField New();
 
   /**
+   * @brief Creates the TextField control with additional behaviour.
+   *
+   * @SINCE_2_2.3
+   * @param[in] additionalBehaviour Additional control behaviour
+   * @return A handle to the TextField control
+   */
+  static TextField New(ControlBehaviour additionalBehaviour);
+
+  /**
    * @brief Creates an empty handle.
    * @SINCE_1_0.0
    */
index 3f0323f..0655519 100644 (file)
@@ -382,7 +382,7 @@ public:
   static TextLabel New(const std::string& text);
 
   /**
-   * @brief Creates the TextLabel control with additional behavior.
+   * @brief Creates the TextLabel control with additional behaviour.
    *
    * @SINCE_2_1.8
    * @param[in] additionalBehaviour Additional control behaviour
@@ -391,7 +391,7 @@ public:
   static TextLabel New(ControlBehaviour additionalBehaviour);
 
   /**
-   * @brief Creates the TextLabel control with additional behavior.
+   * @brief Creates the TextLabel control with additional behaviour.
    *
    * @SINCE_2_1.8
    * @param[in] additionalBehaviour Additional control behaviour
index c4f2c6d..6c1f712 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 1;
+const unsigned int TOOLKIT_MICRO_VERSION = 2;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index a0a54de..72900ce 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.2.1
+Version:    2.2.2
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT