/*
- * Copyright (c) 2014 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.
#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
-namespace Dali
-{
-
-class EglInterface;
-class DisplayConnection;
-class ThreadSynchronizationInterface;
-
-namespace Integration
-{
-
-class GlAbstraction;
+#include <toolkit-adaptor-impl.h>
+#include <dali/integration-api/debug.h>
+#include <test-application.h>
-} // namespace Integration
-
-class TestRenderSurface : public RenderSurface
+namespace Dali
{
-public:
- virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
-
- virtual void InitializeEgl( EglInterface& egl ) {}
-
- virtual void CreateEglSurface( EglInterface& egl ) {}
-
- virtual void DestroyEglSurface( EglInterface& egl ) {}
-
- virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
-
- virtual void MoveResize( Dali::PositionSize positionSize ) {}
-
- virtual void SetViewMode( ViewMode viewMode ) {}
-
- virtual void StartRender() {}
-
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
-
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
-
- virtual void StopRender() {}
-
- virtual void ReleaseLock() {}
-
- virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
-
- virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
-};
namespace Internal
{
namespace Adaptor
{
-class Adaptor: public BaseObject
-{
-public:
- static Dali::Adaptor& Get();
- Adaptor();
- ~Adaptor();
-
-public:
- static Dali::RenderSurface& GetSurface();
- static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
-};
+bool Adaptor::mAvailable = false;
+Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
Dali::Adaptor& Adaptor::Get()
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
+ Adaptor::mAvailable = true;
return *adaptor;
}
return *signal;
}
-}
-}
-}
-
-namespace Dali
-{
+} // namespace Adaptor
+} // namespace Internal
Adaptor& Adaptor::New( Window window )
{
{
}
-bool Adaptor::AddIdle( CallbackBase* callback )
+bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
+{
+ const bool isAvailable = IsAvailable();
+
+ if( isAvailable )
+ {
+ Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback );
+ }
+
+ return isAvailable;
+}
+
+void Adaptor::RemoveIdle( CallbackBase* callback )
{
- return false;
+ const bool isAvailable = IsAvailable();
+
+ if( isAvailable )
+ {
+ for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
+ endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
+ it != endIt;
+ ++it )
+ {
+ if( callback == *it )
+ {
+ Internal::Adaptor::Adaptor::mCallbacks.Remove( it );
+ return;
+ }
+ }
+ }
}
void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
bool Adaptor::IsAvailable()
{
- return false;
+ return Internal::Adaptor::Adaptor::mAvailable;
}
void Adaptor::NotifySceneCreated()
{
}
-void Adaptor::SetViewMode( ViewMode mode )
+class LogFactory : public LogFactoryInterface
{
-}
+public:
+ virtual void InstallLogFunction() const
+ {
+ Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
+ Dali::Integration::Log::InstallLogFunction(logFunction);
+ }
+
+ LogFactory()
+ {
+ }
+ virtual ~LogFactory()
+ {
+ }
+};
-void Adaptor::SetStereoBase( float stereoBase )
+LogFactory* gLogFactory = NULL;
+const LogFactoryInterface& Adaptor::GetLogFactory()
{
+ if( gLogFactory == NULL )
+ {
+ gLogFactory = new LogFactory;
+ }
+ return *gLogFactory;
}
Adaptor::Adaptor()