[Tizen] Revert "[Tizen] Create Widget Application"
[platform/core/uifw/dali-adaptor.git] / adaptors / common / adaptor-impl.cpp
index da9476b..70f65ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -29,7 +29,7 @@
 
 // INTERNAL INCLUDES
 #include <base/thread-controller.h>
-#  include <base/performance-logging/performance-interface-factory.h>
+#include <base/performance-logging/performance-interface-factory.h>
 #include <base/lifecycle-observer.h>
 
 #include <dali/devel-api/text-abstraction/font-client.h>
@@ -53,6 +53,7 @@
 #include <window-impl.h>
 
 #include <tizen-logging.h>
+#include <image-loading.h>
 
 using Dali::TextAbstraction::FontClient;
 
@@ -132,7 +133,7 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
     mGLES = new GlImplementation();
   }
 
-  mEglFactory = new EglFactory();
+  mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel() );
 
   EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
 
@@ -183,6 +184,12 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
   {
     Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
   }
+
+  // Set max texture size
+  if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
+  {
+    Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+  }
 }
 
 Adaptor::~Adaptor()
@@ -385,46 +392,11 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
   mEventHandler->FeedKeyEvent( keyEvent );
 }
 
-bool Adaptor::MoveResize( const PositionSize& positionSize )
-{
-  PositionSize old = mSurface->GetPositionSize();
-
-  // just resize the surface. The driver should automatically resize the egl Surface (untested)
-  // EGL Spec says : EGL window surfaces need to be resized when their corresponding native window
-  // is resized. Implementations typically use hooks into the OS and native window
-  // system to perform this resizing on demand, transparently to the client.
-  mSurface->MoveResize( positionSize );
-
-  if(old.width != positionSize.width || old.height != positionSize.height)
-  {
-    SurfaceSizeChanged(positionSize);
-  }
-
-  return true;
-}
-
-void Adaptor::SurfaceResized( const PositionSize& positionSize )
-{
-  PositionSize old = mSurface->GetPositionSize();
-
-  // Called by an application, when it has resized a window outside of Dali.
-  // The EGL driver automatically detects X Window resize calls, and resizes
-  // the EGL surface for us.
-  mSurface->MoveResize( positionSize );
-
-  if(old.width != positionSize.width || old.height != positionSize.height)
-  {
-    SurfaceSizeChanged(positionSize);
-  }
-}
-
 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
 {
   mNativeWindow = nativeWindow;
   mSurface = &surface;
 
-  SurfaceSizeChanged(mSurface->GetPositionSize());
-
   // flush the event queue to give update and render threads chance
   // to start processing messages for new camera setup etc as soon as possible
   ProcessCoreEvents();
@@ -620,6 +592,11 @@ Any Adaptor::GetNativeWindowHandle()
   return mNativeWindow;
 }
 
+void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
+{
+  mUseRemoteSurface = useRemoteSurface;
+}
+
 void Adaptor::AddObserver( LifeCycleObserver& observer )
 {
   ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
@@ -719,10 +696,10 @@ void Adaptor::OnDamaged( const DamageArea& area )
   RequestUpdate();
 }
 
-void Adaptor::SurfaceSizeChanged(const PositionSize& positionSize)
+void Adaptor::SurfaceSizeChanged( Dali::Adaptor::SurfaceSize surfaceSize )
 {
   // let the core know the surface size has changed
-  mCore->SurfaceResized(positionSize.width, positionSize.height);
+  mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
 
   mResizedSignal.Emit( mAdaptor );
 }
@@ -733,6 +710,9 @@ void Adaptor::NotifySceneCreated()
 
   // Start thread controller after the scene has been created
   mThreadController->Start();
+
+  // process after surface is created (registering to remote surface provider if required)
+  SurfaceInitialized();
 }
 
 void Adaptor::NotifyLanguageChanged()
@@ -751,6 +731,12 @@ void Adaptor::RequestUpdateOnce()
   }
 }
 
+void Adaptor::IndicatorSizeChanged(int height)
+{
+  // let the core know the indicator height is changed
+  mCore->SetTopMargin(height);
+}
+
 void Adaptor::ProcessCoreEventsFromIdle()
 {
   ProcessCoreEvents();
@@ -791,7 +777,8 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   mTriggerEventFactory(),
   mObjectProfiler( NULL ),
   mSocketFactory(),
-  mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ )
+  mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
+  mUseRemoteSurface( false )
 {
   DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
   gThreadLocalAdaptor = this;