Updated all code to new format
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / scene-holder-impl.cpp
index fc29948..ec4be19 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -27,7 +27,6 @@
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/dali-common.h>
-#include <sys/time.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/adaptor-impl.h>
@@ -35,6 +34,7 @@
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/input/common/key-impl.h>
 #include <dali/internal/input/common/physical-keyboard-impl.h>
+#include <dali/internal/system/common/time-service.h>
 
 namespace Dali
 {
@@ -47,43 +47,6 @@ namespace
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gSceneHolderLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_SCENE_HOLDER");
 #endif
-
-// Copied from x server
-static uint32_t GetCurrentMilliSeconds(void)
-{
-  struct timeval tv;
-
-  struct timespec  tp;
-  static clockid_t clockid;
-
-  if(!clockid)
-  {
-#ifdef CLOCK_MONOTONIC_COARSE
-    if(clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
-       (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
-    {
-      clockid = CLOCK_MONOTONIC_COARSE;
-    }
-    else
-#endif
-      if(clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
-    {
-      clockid = CLOCK_MONOTONIC;
-    }
-    else
-    {
-      clockid = ~0L;
-    }
-  }
-  if(clockid != ~0L && clock_gettime(clockid, &tp) == 0)
-  {
-    return static_cast<uint32_t>((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L));
-  }
-
-  gettimeofday(&tv, NULL);
-  return static_cast<uint32_t>((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
-}
-
 } // unnamed namespace
 
 uint32_t SceneHolder::mSceneHolderCounter = 0;
@@ -242,7 +205,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
 
   // Create the scene
   PositionSize surfacePositionSize = mSurface->GetPositionSize();
-  mScene                           = Dali::Integration::Scene::New(Size(static_cast<float>(surfacePositionSize.width), static_cast<float>(surfacePositionSize.height)));
+  int          orientation         = mSurface->GetOrientation();
+  mScene                           = Dali::Integration::Scene::New(Size(static_cast<float>(surfacePositionSize.width), static_cast<float>(surfacePositionSize.height)), orientation);
 
   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
   mAdaptor                                = &adaptorImpl;
@@ -272,11 +236,16 @@ void SceneHolder::Resume()
   OnResume();
 }
 
+void SceneHolder::SurfaceRotated(float width, float height, int orientation)
+{
+  mScene.SurfaceRotated(width, height, orientation);
+}
+
 void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp)
 {
   if(timeStamp < 1)
   {
-    timeStamp = GetCurrentMilliSeconds();
+    timeStamp = TimeService::GetMilliSeconds();
   }
 
   RecalculateTouchPosition(point);
@@ -342,14 +311,14 @@ void SceneHolder::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callbac
 {
   mScene.AddFrameRenderedCallback(std::move(callback), frameId);
 
-  DALI_LOG_INFO(gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFrameRenderedCallback:: Added [%d]\n", frameId);
+  DALI_LOG_RELEASE_INFO("SceneHolder::AddFrameRenderedCallback:: Added [%d]\n", frameId);
 }
 
 void SceneHolder::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
 {
   mScene.AddFramePresentedCallback(std::move(callback), frameId);
 
-  DALI_LOG_INFO(gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFramePresentedCallback:: Added [%d]\n", frameId);
+  DALI_LOG_RELEASE_INFO("SceneHolder::AddFramePresentedCallback:: Added [%d]\n", frameId);
 }
 
 Dali::Integration::SceneHolder SceneHolder::Get(Dali::Actor actor)