/*
- * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/context-notifier.h>
// 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>
#include <window-impl.h>
#include <tizen-logging.h>
+#include <image-loading.h>
+
+#include <locale-utils.h>
using Dali::TextAbstraction::FontClient;
namespace
{
-__thread Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
+thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
} // unnamed namespace
Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
Window& windowImpl = Dali::GetImplementation(window);
Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
+
+ Internal::Adaptor::Adaptor::GetImplementation( *adaptor ).SetWindow( window );
windowImpl.SetAdaptor(*adaptor);
return adaptor;
}
{
Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
}
+
+ // Set max texture size
+ if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
+ {
+ Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
+ }
+
+ SetupSystemInformation();
}
Adaptor::~Adaptor()
mThreadController->Pause();
mCore->Suspend();
mState = PAUSED;
+
+ // Process remained events and rendering in the update thread
+ RequestUpdateOnce();
}
}
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 )
+void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
{
- PositionSize old = mSurface->GetPositionSize();
+ PositionSize positionSize = surface.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 );
+ // let the core know the surface size has changed
+ mCore->SurfaceResized( positionSize.width, positionSize.height );
- if(old.width != positionSize.width || old.height != positionSize.height)
- {
- SurfaceSizeChanged(positionSize);
- }
-}
+ mResizedSignal.Emit( mAdaptor );
-void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
-{
mNativeWindow = nativeWindow;
mSurface = &surface;
- // flush the event queue to give update and render threads chance
+ // flush the event queue to give the update-render thread chance
// to start processing messages for new camera setup etc as soon as possible
ProcessCoreEvents();
RequestUpdate();
}
-void Adaptor::SurfaceSizeChanged( const PositionSize& positionSize )
+void Adaptor::SurfaceResizePrepare( 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 );
}
+void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
+{
+ // flush the event queue to give the update-render thread chance
+ // to start processing messages for new camera setup etc as soon as possible
+ ProcessCoreEvents();
+
+ // this method blocks until the render thread has completed the resizing.
+ mThreadController->ResizeSurface();
+}
+
void Adaptor::NotifySceneCreated()
{
GetCore().SceneCreated();
mLanguageChangedSignal.Emit( mAdaptor );
}
+void Adaptor::RenderOnce()
+{
+ RequestUpdateOnce();
+}
+
void Adaptor::RequestUpdateOnce()
{
if( PAUSED_WHILE_HIDDEN != mState )
mTriggerEventFactory(),
mObjectProfiler( NULL ),
mSocketFactory(),
+ mWindow(),
mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
mUseRemoteSurface( false )
{
return mCore->GetStereoBase();
}
+void Adaptor::SetRootLayoutDirection( std::string locale )
+{
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+
+ stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
+ static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
+}
+
+void Adaptor::SetWindow( Dali::Window window )
+{
+ mWindow = window;
+}
+
+Dali::Window Adaptor::GetWindow()
+{
+ return mWindow;
+}
+
} // namespace Adaptor
} // namespace Internal