../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-options.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-options.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-sound-player.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
dali-core
dali-toolkit
- dali-adaptor
-)
-
-PKG_CHECK_MODULES(DALI_ADAPTOR REQUIRED
- dali-adaptor
)
ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
return bitmap;
}
-Integration::ResourcePointer CustomizeNinePatch( TestApplication& application,
+Integration::ResourcePointer CustomizeNinePatch( ToolkitTestApplication& application,
unsigned int ninePatchImageWidth,
unsigned int ninePatchImageHeight)
{
int UtcDaliStyleManagerCopyConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
StyleManager styleManager = StyleManager::Get();
StyleManager copyOfStyleManager( styleManager );
int UtcDaliStyleManagerAssignmentOperatorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
StyleManager styleManager = StyleManager::Get();
StyleManager copyOfStyleManager = styleManager;
# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-singleton-service.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
- ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
- ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp
)
# Locate GTest
-cmake_minimum_required(VERSION 2.6)
-find_package(GTest REQUIRED)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+FIND_PACKAGE(GTest REQUIRED)
#ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
# ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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 <cstdlib>
-#include <dali-toolkit-test-suite-utils.h>
+#include <dali-test-suite-utils.h>
// GTest fails to compile with "error: return-statement with a value, in function returning 'void'" error
// if using dali assert function so define new assert with returning void.
#define _ASSERT_H_
dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
dali-toolkit-test-utils/toolkit-environment-variable.cpp
dali-toolkit-test-utils/toolkit-input-method-context.cpp
+ dali-toolkit-test-utils/toolkit-input-method-options.cpp
dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
dali-toolkit-test-utils/toolkit-orientation.cpp
dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
dali-toolkit-test-utils/toolkit-style-monitor.cpp
dali-toolkit-test-utils/toolkit-singleton-service.cpp
+ dali-toolkit-test-utils/toolkit-test-application.cpp
dali-toolkit-test-utils/toolkit-timer.cpp
+ dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
dali-toolkit-test-utils/toolkit-tts-player.cpp
dali-toolkit-test-utils/toolkit-native-image-source.cpp
dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
dali-toolkit-test-utils/toolkit-video-player.cpp
dali-toolkit-test-utils/toolkit-web-engine.cpp
dali-toolkit-test-utils/toolkit-window.cpp
- dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
dali-toolkit-test-utils/dali-test-suite-utils.cpp
dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
dali-toolkit-test-utils/dummy-control.cpp
uint32_t surfaceHeight,
uint32_t horizontalDpi,
uint32_t verticalDpi,
- ResourcePolicy::DataRetention policy)
+ ResourcePolicy::DataRetention policy,
+ bool initialize )
: mCore( NULL ),
mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mLastVSyncTime(0u),
mDataRetentionPolicy( policy )
{
- Initialize();
+ if( initialize )
+ {
+ Initialize();
+ }
}
void TestApplication::Initialize()
{
+ CreateCore();
+ CreateScene();
+ InitializeCore();
+}
+
+void TestApplication::CreateCore()
+{
// We always need the first update!
mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING;
mPlatformAbstraction,
mGlAbstraction,
mGlSyncAbstraction,
+ mGlContextHelperAbstraction,
mDataRetentionPolicy,
Integration::RenderToFrameBuffer::FALSE,
Integration::DepthBufferAvailable::TRUE,
Dali::Integration::Trace::InstallLogContextFunction( logContextFunction );
Dali::Integration::Trace::LogContext( true, "Test" );
+}
+void TestApplication::CreateScene()
+{
mRenderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, mSurfaceWidth, mSurfaceHeight ) );
mScene = Dali::Integration::Scene::New( Vector2( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
mScene.SetSurface( *mRenderSurface );
-
mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
mCore->SurfaceResized( mRenderSurface );
+}
+void TestApplication::InitializeCore()
+{
mCore->SceneCreated();
mCore->Initialize();
}
return mGlSyncAbstraction;
}
+TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction()
+{
+ return mGlContextHelperAbstraction;
+}
+
void TestApplication::ProcessEvent(const Integration::Event& event)
{
mCore->QueueEvent(event);
#include <test-platform-abstraction.h>
#include "test-gl-sync-abstraction.h"
#include "test-gl-abstraction.h"
+#include "test-gl-context-helper-abstraction.h"
#include "test-render-controller.h"
#include "test-render-surface.h"
#include <dali/public-api/common/dali-common.h>
static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
static const uint32_t DEFAULT_SURFACE_HEIGHT = 800;
-#ifdef _CPP11
static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220;
static constexpr uint32_t DEFAULT_VERTICAL_DPI = 217;
-#else
- static const uint32_t DEFAULT_HORIZONTAL_DPI = 220;
- static const uint32_t DEFAULT_VERTICAL_DPI = 217;
-#endif
static const uint32_t DEFAULT_RENDER_INTERVAL = 1;
uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
- ResourcePolicy::DataRetention policy = ResourcePolicy::DALI_DISCARDS_ALL_DATA);
+ ResourcePolicy::DataRetention policy = ResourcePolicy::DALI_DISCARDS_ALL_DATA,
+ bool initialize = true );
void Initialize();
+ void CreateCore();
+ void CreateScene();
+ void InitializeCore();
virtual ~TestApplication();
static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message );
static void LogContext( bool start, const char* tag );
TestRenderController& GetRenderController();
TestGlAbstraction& GetGlAbstraction();
TestGlSyncAbstraction& GetGlSyncAbstraction();
+ TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
void ProcessEvent(const Integration::Event& event);
void SendNotification();
bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
TestRenderController mRenderController;
TestGlAbstraction mGlAbstraction;
TestGlSyncAbstraction mGlSyncAbstraction;
+ TestGlContextHelperAbstraction mGlContextHelperAbstraction;
TestRenderSurface* mRenderSurface;
Integration::UpdateStatus mStatus;
--- /dev/null
+#ifndef TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
+#define TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
+
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/gl-context-helper-abstraction.h>
+
+namespace Dali
+{
+
+/**
+ * Class to emulate the GL context helper
+ */
+class DALI_CORE_API TestGlContextHelperAbstraction: public Integration::GlContextHelperAbstraction
+{
+public:
+ /**
+ * Constructor
+ */
+ TestGlContextHelperAbstraction() {};
+
+ /**
+ * Destructor
+ */
+ ~TestGlContextHelperAbstraction() {};
+
+ /**
+ * @brief Switch to the surfaceless GL context
+ */
+ virtual void MakeSurfacelessContextCurrent() {};
+
+ /**
+ * @brief Switch to the GL context of the specific render surface
+ * @param[in] surface The render surface
+ */
+ virtual void MakeContextCurrent( Integration::RenderSurface* surface ) {};
+
+ /**
+ * @brief Clear the GL context
+ */
+ virtual void MakeContextNull() {};
+
+ /**
+ * @brief Wait until all GL rendering calls for the current GL context are executed
+ */
+ virtual void WaitClient() {};
+private:
+
+ TestGlContextHelperAbstraction( const TestGlContextHelperAbstraction& ); ///< Undefined
+ TestGlContextHelperAbstraction& operator=( const TestGlContextHelperAbstraction& ); ///< Undefined
+};
+
+} // Dali
+
+#endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
class ThreadSynchronizationInterface;
class Window;
+namespace Integration
+{
+class Scene;
+}
+
using WindowContainer = std::vector<Window>;
namespace Internal
namespace Adaptor
{
-class Adaptor: public BaseObject
+class Adaptor
{
public:
+ static Dali::Adaptor& New();
static Dali::Adaptor& Get();
Adaptor();
~Adaptor();
-public:
- static Dali::RenderSurfaceInterface& GetSurface();
- static Dali::WindowContainer GetWindows();
- static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
- static Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
- static bool mAvailable;
- static Vector<CallbackBase*> mCallbacks;
- static Dali::WindowContainer mWindows;
- static Dali::Adaptor::WindowCreatedSignalType* mWindowCreatedSignal;
+ void Start( Dali::Window window );
+
+ bool AddIdle( CallbackBase* callback, bool hasReturnValue );
+ void RemoveIdle( CallbackBase* callback );
+ void RunIdles();
+
+ static Integration::Scene GetScene( Dali::Window window );
+
+ Dali::RenderSurfaceInterface& GetSurface();
+ Dali::WindowContainer GetWindows();
+
+ Dali::Adaptor::AdaptorSignalType& ResizedSignal();
+ Dali::Adaptor::AdaptorSignalType& LanguageChangedSignal();
+ Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
+
+ static Adaptor& GetImpl( Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
+ static const Adaptor& GetImpl( const Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
+
+private:
+
+ Vector<CallbackBase*> mCallbacks;
+ Dali::WindowContainer mWindows;
+ Dali::Adaptor::AdaptorSignalType mResizedSignal;
+ Dali::Adaptor::AdaptorSignalType mLanguageChangedSignal;
+ Dali::Adaptor::WindowCreatedSignalType mWindowCreatedSignal;
};
} // namespace Adaptor
*
*/
+#include <algorithm>
+
#include <toolkit-window.h>
// Don't want to include the actual window.h which otherwise will be indirectly included by adaptor.h.
#include <dali/integration-api/adaptors/scene-holder.h>
-#include <dali/public-api/object/base-object.h>
-
#include <toolkit-adaptor-impl.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/scene.h>
#include <test-application.h>
#include <test-render-surface.h>
namespace Dali
{
+namespace
+{
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// LogFactoryStub
+//
+///////////////////////////////////////////////////////////////////////////////
+
+class LogFactory : public LogFactoryInterface
+{
+public:
+ LogFactory() = default;
+ virtual ~LogFactory() = default;
+
+private:
+ void InstallLogFunction() const override
+ {
+ Dali::Integration::Log::InstallLogFunction( &TestApplication::LogMessage );
+ }
+};
+LogFactory* gLogFactory = NULL; // For some reason, destroying this when the Adaptor is destroyed causes a crash in some test cases when running all of them.
+} //unnamed namespace
+
namespace Internal
{
namespace Adaptor
{
-bool Adaptor::mAvailable = false;
-Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
-Dali::WindowContainer Adaptor::mWindows;
-Dali::Adaptor::WindowCreatedSignalType* Adaptor::mWindowCreatedSignal = nullptr;
+///////////////////////////////////////////////////////////////////////////////
+//
+// Dali::Internal::Adaptor::Adaptor Stub
+//
+///////////////////////////////////////////////////////////////////////////////
-Dali::Adaptor& Adaptor::Get()
+Dali::Adaptor* gAdaptor = nullptr;
+
+Dali::Adaptor& Adaptor::New()
{
- Dali::Adaptor* adaptor = new Dali::Adaptor;
- Adaptor::mAvailable = true;
- return *adaptor;
+ DALI_ASSERT_ALWAYS( ! gAdaptor );
+ gAdaptor = new Dali::Adaptor;
+ return *gAdaptor;
}
-Dali::RenderSurfaceInterface& Adaptor::GetSurface()
+Dali::Adaptor& Adaptor::Get()
{
- Dali::RenderSurfaceInterface* renderSurface = reinterpret_cast <Dali::RenderSurfaceInterface*>( new Dali::TestRenderSurface( Dali::PositionSize( 0, 0, 480, 800 ) ) );
- return *renderSurface;
+ DALI_ASSERT_ALWAYS( gAdaptor );
+ return *gAdaptor;
}
-Dali::WindowContainer Adaptor::GetWindows()
+Adaptor::Adaptor()
{
- return Adaptor::mWindows;
}
-Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
+Adaptor::~Adaptor()
{
- Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
- return *signal;
+ gAdaptor = nullptr;
}
-Dali::Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+void Adaptor::Start( Dali::Window window )
{
- if ( !Adaptor::mWindowCreatedSignal )
+ if ( window )
{
- Adaptor::mWindowCreatedSignal = new Dali::Adaptor::WindowCreatedSignalType;
+ mWindows.push_back( window );
+ mWindowCreatedSignal.Emit( window );
}
+}
- return *Adaptor::mWindowCreatedSignal;
+Integration::Scene Adaptor::GetScene( Dali::Window window )
+{
+ return window.GetScene();
}
-} // namespace Adaptor
-} // namespace Internal
+bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
+{
+ mCallbacks.PushBack( callback );
+ return true;
+}
-Adaptor& Adaptor::New( Window window )
+void Adaptor::RemoveIdle( CallbackBase* callback )
{
- return Internal::Adaptor::Adaptor::Get();
+ mCallbacks.Erase( std::find_if( mCallbacks.Begin(), mCallbacks.End(),
+ [ &callback ] ( CallbackBase* current ) { return callback == current; } ) );
}
-Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
+void Adaptor::RunIdles()
{
- return Internal::Adaptor::Adaptor::Get();
+ for( auto& callback : mCallbacks )
+ {
+ CallbackBase::Execute( *callback );
+ }
+
+ mCallbacks.Clear();
}
-Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface )
+Dali::RenderSurfaceInterface& Adaptor::GetSurface()
{
- return Internal::Adaptor::Adaptor::Get();
+ DALI_ASSERT_ALWAYS( ! mWindows.empty() );
+
+ return reinterpret_cast < Dali::RenderSurfaceInterface& >( mWindows.front().GetRenderSurface() );
}
-Adaptor& Adaptor::New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
+Dali::WindowContainer Adaptor::GetWindows()
{
- return Internal::Adaptor::Adaptor::Get();
+ return mWindows;
}
-Adaptor& Adaptor::New( Dali::Integration::SceneHolder window )
+Dali::Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
{
- return Internal::Adaptor::Adaptor::Get();
+ return mResizedSignal;
}
-Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, Configuration::ContextLoss configuration )
+Dali::Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
{
- return Internal::Adaptor::Adaptor::Get();
+ return mLanguageChangedSignal;
}
-Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface )
+Dali::Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
{
- return Internal::Adaptor::Adaptor::Get();
+ return mWindowCreatedSignal;
}
-Adaptor& Adaptor::New( Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
+} // namespace Adaptor
+} // namespace Internal
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Dali::Adaptor Stub
+//
+///////////////////////////////////////////////////////////////////////////////
+
+Adaptor::Adaptor()
+: mImpl( new Internal::Adaptor::Adaptor )
{
- return Internal::Adaptor::Adaptor::Get();
}
Adaptor::~Adaptor()
{
+ Internal::Adaptor::gAdaptor = nullptr;
+ delete mImpl;
}
void Adaptor::Start()
bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
{
- const bool isAvailable = IsAvailable();
-
- if( isAvailable )
- {
- Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback );
- }
-
- return isAvailable;
+ return mImpl->AddIdle( callback, hasReturnValue );
}
void Adaptor::RemoveIdle( CallbackBase* callback )
{
- 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;
- }
- }
- }
+ mImpl->RemoveIdle( callback );
}
void Adaptor::ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface )
Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
{
- return Internal::Adaptor::Adaptor::AdaptorSignal();
+ return mImpl->ResizedSignal();
}
Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
{
- return Internal::Adaptor::Adaptor::AdaptorSignal();
+ return mImpl->LanguageChangedSignal();
}
Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
{
- return Internal::Adaptor::Adaptor::WindowCreatedSignal();
+ return mImpl->WindowCreatedSignal();
}
Dali::RenderSurfaceInterface& Adaptor::GetSurface()
{
- return Internal::Adaptor::Adaptor::GetSurface();
+ return mImpl->GetSurface();
}
Dali::WindowContainer Adaptor::GetWindows() const
{
- return Internal::Adaptor::Adaptor::GetWindows();
+ return mImpl->GetWindows();
}
Any Adaptor::GetNativeWindowHandle()
bool Adaptor::IsAvailable()
{
- return Internal::Adaptor::Adaptor::mAvailable;
+ return Internal::Adaptor::gAdaptor;
}
void Adaptor::NotifySceneCreated()
{
}
-class LogFactory : public LogFactoryInterface
-{
-public:
- virtual void InstallLogFunction() const
- {
- Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
- Dali::Integration::Log::InstallLogFunction(logFunction);
- }
-
- LogFactory()
- {
- }
- virtual ~LogFactory()
- {
- }
-};
-
-LogFactory* gLogFactory = NULL;
const LogFactoryInterface& Adaptor::GetLogFactory()
{
if( gLogFactory == NULL )
return *gLogFactory;
}
-Adaptor::Adaptor()
-: mImpl( NULL )
-{
- Dali::PositionSize win_size;
- win_size.width = 640;
- win_size.height = 800;
-
- Dali::Window window = Dali::Window::New( win_size, "" );
- Internal::Adaptor::Adaptor::mWindows.push_back( window );
-}
-
} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * This is a copy of dali-adaptor/devel-api/adaptor-framework/input-method-options.cpp.
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/adaptor-framework/input-method-options.h>
+
+using namespace Dali::InputMethod;
+using namespace Dali::InputMethod::Category;
+
+namespace Dali
+{
+
+#define TOKEN_STRING(x) #x
+
+struct InputMethodOptions::Impl
+{
+ Impl()
+ {
+ mPanelLayout = PanelLayout::NORMAL;
+ mAutoCapital = AutoCapital::SENTENCE;
+ mButtonAction = ButtonAction::DEFAULT;
+ mVariation = NormalLayout::NORMAL;
+ }
+
+ PanelLayout::Type mPanelLayout;
+ AutoCapital::Type mAutoCapital;
+ ButtonAction::Type mButtonAction;
+ int mVariation:4;
+};
+
+InputMethodOptions::InputMethodOptions()
+{
+ mImpl.reset(new Impl());
+}
+
+InputMethodOptions::~InputMethodOptions()
+{
+ // destructor cannot be inlined and must be in a unit
+ // for unique_ptr to work with forward declaration
+}
+
+bool InputMethodOptions::IsPassword() const
+{
+ return (mImpl->mPanelLayout == Dali::InputMethod::PanelLayout::PASSWORD);
+}
+
+void InputMethodOptions::ApplyProperty( const Property::Map& settings )
+{
+ for ( unsigned int i = 0, count = settings.Count(); i < count; ++i )
+ {
+ Property::Key key = settings.GetKeyAt( i );
+ if( key.type == Property::Key::INDEX )
+ {
+ continue;
+ }
+
+ Property::Value item = settings.GetValue(i);
+
+ if( key == TOKEN_STRING( PANEL_LAYOUT ) )
+ {
+ if( item.GetType() == Property::INTEGER )
+ {
+ int value = item.Get< int >();
+ mImpl->mPanelLayout = static_cast<InputMethod::PanelLayout::Type>(value);
+ }
+ }
+ else if ( key == TOKEN_STRING( BUTTON_ACTION ) )
+ {
+ if ( item.GetType() == Property::INTEGER )
+ {
+ int value = item.Get< int >();
+ mImpl->mButtonAction = static_cast<InputMethod::ButtonAction::Type>(value);
+ }
+ }
+ else if ( key == TOKEN_STRING( AUTO_CAPITALIZE ) )
+ {
+ if ( item.GetType() == Property::INTEGER )
+ {
+ int value = item.Get< int >();
+ mImpl->mAutoCapital = static_cast<InputMethod::AutoCapital::Type>(value);
+ }
+ }
+ else if( key == TOKEN_STRING( VARIATION ) )
+ {
+ if( item.GetType() == Property::INTEGER )
+ {
+ int value = item.Get< int >();
+ mImpl->mVariation = value;
+ }
+ }
+ else
+ {
+ }
+ }
+}
+
+void InputMethodOptions::RetrieveProperty( Property::Map& settings )
+{
+ settings[TOKEN_STRING( PANEL_LAYOUT )] = mImpl->mPanelLayout;
+ settings[TOKEN_STRING( BUTTON_ACTION )] = mImpl->mButtonAction;
+ settings[TOKEN_STRING( AUTO_CAPITALIZE )] = mImpl->mAutoCapital;
+ settings[TOKEN_STRING( VARIATION )] = mImpl->mVariation;
+}
+
+bool InputMethodOptions::CompareAndSet( InputMethod::Category::Type type, const InputMethodOptions& options, int& index)
+{
+ return true;
+ bool updated = false;
+
+ switch (type)
+ {
+ case PANEL_LAYOUT:
+ {
+ if ( options.mImpl->mPanelLayout != mImpl->mPanelLayout )
+ {
+ mImpl->mPanelLayout = options.mImpl->mPanelLayout;
+ index = static_cast<int>(mImpl->mPanelLayout);
+ updated = true;
+ }
+ break;
+ }
+ case BUTTON_ACTION:
+ {
+ if ( options.mImpl->mButtonAction != mImpl->mButtonAction )
+ {
+ mImpl->mButtonAction = options.mImpl->mButtonAction;
+ index = static_cast<int>(mImpl->mButtonAction);
+ updated = true;
+ }
+ break;
+ }
+ case AUTO_CAPITALIZE:
+ {
+ if ( options.mImpl->mAutoCapital != mImpl->mAutoCapital )
+ {
+ mImpl->mAutoCapital = options.mImpl->mAutoCapital;
+ index = static_cast<int>(mImpl->mAutoCapital);
+ updated = true;
+ }
+ break;
+ }
+ case VARIATION:
+ {
+ if ( options.mImpl->mVariation != mImpl->mVariation )
+ {
+ mImpl->mVariation = options.mImpl->mVariation;
+ index = static_cast<int>(mImpl->mVariation);
+ updated = true;
+ }
+ break;
+ }
+ }
+ return updated;
+}
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <toolkit-test-application.h>
+
+// INTERNAL INCLUDES
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/integration-api/adaptors/adaptor.h>
+#include <toolkit-adaptor-impl.h>
+#include <toolkit-singleton-service.h>
+#include <toolkit-lifecycle-controller.h>
+
+namespace Dali
+{
+
+using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
+
+ToolkitTestApplication::ToolkitTestApplication( size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, float verticalDpi )
+: TestApplication( surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi, ResourcePolicy::DALI_DISCARDS_ALL_DATA, false /* Do not Initialize Core */ ),
+ mAdaptor( &AdaptorImpl::New() ) // Need to create Adaptor first as many singletons in dali-adaptor need it
+{
+ // Create Core next
+ CreateCore();
+
+ // Override Scene creation in TestApplication by creating a window.
+ // The window will create a Scene & surface and set up the scene's surface appropriately.
+ Window window( Window::New( PositionSize( 0, 0, surfaceWidth, surfaceHeight ), "" ) );
+ mScene = AdaptorImpl::GetScene( window );
+ mRenderSurface = dynamic_cast< TestRenderSurface* >( mScene.GetSurface() );
+ mScene.SetDpi( Vector2( horizontalDpi, verticalDpi ) );
+
+ // Core needs to be initialized next before we start the adaptor
+ InitializeCore();
+
+ auto singletonService = SingletonService::Get();
+ Test::SetApplication( singletonService, *this );
+
+ // This will also emit the window created signals
+ AdaptorImpl::GetImpl( *mAdaptor ).Start( window );
+
+ Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
+ lifecycleController.InitSignal().Emit();
+
+ // set the DPI value for font rendering
+ TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get();
+ if( fontClient )
+ {
+ fontClient.SetDpi( mDpi.x, mDpi.y );
+ }
+}
+
+ToolkitTestApplication::~ToolkitTestApplication()
+{
+ // Need to delete core before we delete the adaptor.
+ delete mCore;
+ mCore = NULL;
+
+ // Set mRenderSurface to null, it will be deleted by the window that owns it
+ mRenderSurface = nullptr;
+}
+
+void ToolkitTestApplication::RunIdles()
+{
+ AdaptorImpl::GetImpl( *mAdaptor.get() ).RunIdles();
+}
+
+} // namespace Dali
*
*/
+// EXTERNAL INCLUDES
+#include <memory>
+
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
-#include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/integration-api/adaptors/adaptor.h>
-#include <toolkit-adaptor-impl.h>
-#include <toolkit-singleton-service.h>
-#include <toolkit-lifecycle-controller.h>
namespace Dali
{
+class Adaptor;
+
/**
* Adds some functionality on top of TestApplication that is required by the Toolkit.
+ *
+ * This includes creation and destruction of the Adaptor and Window classes.
*/
class ToolkitTestApplication : public TestApplication
{
ToolkitTestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- float verticalDpi = DEFAULT_VERTICAL_DPI )
- : TestApplication( surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi )
- {
- auto singletonService = SingletonService::Get();
- Test::SetApplication( singletonService, *this );
-
- // set the DPI value for font rendering
- Dali::TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get();
- if( fontClient )
- {
- fontClient.SetDpi( mDpi.x, mDpi.y );
- }
-
- bool isAdaptorAvailable = Dali::Internal::Adaptor::Adaptor::Get().IsAvailable();
- if ( isAdaptorAvailable )
- {
- Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
- lifecycleController.InitSignal().Emit();
-
- Dali::Window window = Dali::Internal::Adaptor::Adaptor::mWindows.front();
- if ( window )
- {
- Dali::Internal::Adaptor::Adaptor::WindowCreatedSignal().Emit( window );
- }
- }
- }
+ float verticalDpi = DEFAULT_VERTICAL_DPI );
- ~ToolkitTestApplication()
- {
- // Need to delete core before we delete the adaptor.
- delete mCore;
- mCore = NULL;
- }
-
- //ToolkitOrientation& GetOrientation()
- //{
- //return mOrientation;
- //}
-
- /**
- * @brief Creates an adaptor implementation for those controls like the
- * text-field and the text-editor which connects a callback to the idle signal.
- */
- void CreateAdaptor()
- {
- Adaptor::Get();
- }
+ ~ToolkitTestApplication();
/**
* @brief Executes the idle callbacks.
* Some controls like the text-field and the text-editor connect callbacks to the
* idle signal.
*/
- void RunIdles()
- {
- if( Adaptor::IsAvailable() )
- {
- for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
- endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
- it != endIt;
- ++it )
- {
- CallbackBase* callback = *it;
-
- CallbackBase::Execute( *callback );
- }
-
- Internal::Adaptor::Adaptor::mCallbacks.Clear();
- }
- }
+ void RunIdles();
private:
- //ToolkitOrientation mOrientation;
+ std::unique_ptr< Adaptor > mAdaptor;
};
} // namespace Dali
*
*/
+// CLASS HEADER
+#include "toolkit-window.h"
+
// EXTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
-#include "toolkit-window.h"
+#include "test-render-surface.h"
namespace Dali
{
{
namespace Adaptor
{
-
class Window : public Dali::BaseObject
{
public:
- Window()
+ Window( const PositionSize& positionSize )
+ : mScene( Dali::Integration::Scene::New( Size( positionSize.width, positionSize.height ) ) ),
+ mRenderSurface( new TestRenderSurface( positionSize ) )
{
+ mScene.SetSurface( *mRenderSurface );
}
virtual ~Window()
{
+ delete mRenderSurface;
+ mRenderSurface = nullptr;
}
static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
{
- return new Window();
+ return new Window( positionSize );
}
- static Dali::Window Get( Dali::Actor actor )
- {
- return Dali::Window();
- }
+ Integration::Scene mScene;
+ TestRenderSurface* mRenderSurface;
};
} // Adaptor
} // Internal
+inline Internal::Adaptor::Window& GetImplementation(Dali::Window& window)
+{
+ DALI_ASSERT_ALWAYS( window && "Window handle is empty" );
+ BaseObject& object = window.GetBaseObject();
+ return static_cast<Internal::Adaptor::Window&>(object);
+}
+
Window::Window()
{
}
{
}
+Window::Window(const Window& handle)
+: BaseHandle( handle )
+{
+}
+
+Window& Window::operator=(const Window& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
{
Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
{
}
+Integration::Scene Window::GetScene()
+{
+ return GetImplementation( *this ).mScene;
+}
+
+Integration::RenderSurface& Window::GetRenderSurface()
+{
+ return *GetImplementation( *this ).mRenderSurface;
+}
+
namespace DevelWindow
{
Window Get( Actor actor )
{
- return Internal::Adaptor::Window::Get( actor );
+ return Window();
+}
+
+EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
+{
+ return GetImplementation( window ).mScene.EventProcessingFinishedSignal();
}
KeyEventSignalType& KeyEventSignal( Window window )
{
- return Dali::Stage::GetCurrent().KeyEventSignal();
+ return GetImplementation( window ).mScene.KeyEventSignal();
}
TouchSignalType& TouchSignal( Window window )
{
- return Dali::Stage::GetCurrent().TouchSignal();
+ return GetImplementation( window ).mScene.TouchSignal();
+}
+
+WheelEventSignalType& WheelEventSignal( Window window )
+{
+ return GetImplementation( window ).mScene.WheelEventSignal();
}
} // namespace DevelWindow
#include <dali/public-api/math/rect.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/integration-api/scene.h>
namespace Dali
{
class Actor;
class Layer;
-class KeyEvent;
+struct KeyEvent;
class TouchData;
+struct WheelEvent;
typedef Dali::Rect<int> PositionSize;
static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
+
Window();
~Window();
Window(const Window& handle);
Window& operator=(const Window& rhs);
Layer GetRootLayer() const;
+ Integration::Scene GetScene();
+ Integration::RenderSurface& GetRenderSurface();
+
public:
explicit Window( Internal::Adaptor::Window* window );
};
namespace DevelWindow
{
-
+typedef Signal< void () > EventProcessingFinishedSignalType;
typedef Signal< void (const KeyEvent&) > KeyEventSignalType;
typedef Signal< void (const TouchData&) > TouchSignalType;
+typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
Dali::Window Get( Actor actor );
+
+EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
KeyEventSignalType& KeyEventSignal( Dali::Window window );
TouchSignalType& TouchSignal( Dali::Window window );
+WheelEventSignalType& WheelEventSignal( Window window );
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
int UtcDaliAsyncImageLoaderDownCastP(void)
{
+ ToolkitTestApplication application;
+
AsyncImageLoader asyncImageLoader = AsyncImageLoader::New();
BaseHandle object(asyncImageLoader);
int UtcDaliAsyncImageLoaderDownCastN(void)
{
+ ToolkitTestApplication application;
+
BaseHandle unInitializedObject;
AsyncImageLoader asyncImageLoader = AsyncImageLoader::DownCast( unInitializedObject );
END_TEST;
}
-int UtcDaliBuilderFrameBufferP(void)
-{
- ToolkitTestApplication application;
-
- // JSON with a quit event when the actor is touched
- std::string json(
- "{\n"
- " \"constants\":\n"
- " {\n"
- " \"FB_WIDTH\": 200.0,\n"
- " \"FB_HEIGHT\": 200.0,\n"
- " \"FB_SIZE\": [200,200],\n"
- " \"FB_ASPECT_RATIO\": 1\n"
- " },\n"
- " \"stage\": [\n"
- " {\n"
- " \"type\": \"ImageView\",\n"
- " \"name\": \"fbOnStage\",\n"
- " \"position\": [\n"
- " 0.40461349487305,\n"
- " 0.9150390625,\n"
- " 0.0\n"
- " ],\n"
- " \"parentOrigin\": [0.5, 0.5, 0.5],\n"
- " \"size\": [300, 300, 0],\n"
- " \"image\": \"fb0\",\n"
- " \"clearColor\": [1,0,0,1]\n"
- " },\n"
- " {\n"
- " \"type\": \"ImageView\",\n"
- " \"name\": \"Image1\",\n"
- " \"size\": [200, 200, 0],\n"
- " \"parentOrigin\": [0.5, 0.5, 0.5],\n"
- " \"effect\": \"Ripple2D\",\n"
- " \"image\": {\n"
- " \"url\": \"{DALI_IMAGE_DIR}gallery-medium-25.jpg\"\n"
- " },\n"
- " \"signals\": [\n"
- " {\n"
- " \"name\": \"onStage\",\n"
- " \"action\": \"play\",\n"
- " \"animation\": \"Animation_1\"\n"
- " }\n"
- " ]\n"
- " },\n"
- " {\n"
- " \"type\":\"CameraActor\",\n"
- " \"name\":\"fbCam\",\n"
- " \"aspectRatio\": \"{FB_ASPECT_RATIO}\",\n"
- " \"projectionMode\": \"PERSPECTIVE_PROJECTION\",\n"
- " \"fieldOfView\": 0.785,\n"
- " \"invertYAxis\": true\n"
- " }\n"
- " ],\n"
- " \"frameBufferImages\":\n"
- " {\n"
- " \"fb0\":\n"
- " {\n"
- " \"type\": \"FrameBufferImage\",\n"
- " \"width\": { \"typeCast\":\"float\", \"value\":\"{FB_WIDTH}\" },\n"
- " \"height\": { \"typeCast\":\"float\", \"value\":\"{FB_HEIGHT}\" }\n"
- " }\n"
- " },\n"
- " \"renderTasks\":\n"
- " {\n"
- " \"stage\":\n"
- " [\n"
- " {\n"
- " \"sourceActor\": \"fbOnStage\"\n"
- " },\n"
- " {\n"
- " \"sourceActor\": \"Image1\",\n"
- " \"targetFrameBuffer\": \"fb0\",\n"
- " \"viewportSize\":\"{FB_SIZE}\",\n"
- " \"cameraActor\":\"fbCam\"\n"
- " }\n"
- " ]\n"
- " },\n"
- " \"paths\": {},\n"
- " \"animations\": {\n"
- " \"Animation_1\": {\n"
- " \"loop\":true,\n"
- " \"properties\": [\n"
- " {\n"
- " \"actor\": \"Image1\",\n"
- " \"property\": \"uTime\",\n"
- " \"value\": 10.0,\n"
- " \"alphaFunction\": \"LINEAR\",\n"
- " \"timePeriod\": {\n"
- " \"delay\": 0,\n"
- " \"duration\": 10.0\n"
- " },\n"
- " \"gui-builder-timeline-color\": \"#8dc0da\"\n"
- " }\n"
- " ]\n"
- " }\n"
- " }\n"
- "}\n");
-
- Builder builder = Builder::New();
-
- // frame buffer coverage
- builder.LoadFromString( json );
-
- // Render and notify
- application.SendNotification();
- application.Render();
-
- Dali::FrameBufferImage frameBuffer = builder.GetFrameBufferImage( "fb0" );
- DALI_TEST_CHECK( frameBuffer );
-
- Dali::FrameBufferImage frameBuffer2 = builder.GetFrameBufferImage( "fb0" );
- DALI_TEST_CHECK( frameBuffer2 );
- DALI_TEST_CHECK( frameBuffer == frameBuffer2 );
-
- DALI_TEST_CHECK( true );
-
- END_TEST;
-}
-
int UtcDaliBuilderPathConstraintsP(void)
{
ToolkitTestApplication application;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
int UtcDaliCheckBoxButtonConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox;
int UtcDaliCheckBoxButtonCopyConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
// Initialize an object, ref count == 1
CheckBoxButton checkBox = CheckBoxButton::New();
int UtcDaliCheckBoxButtonAssignmentOperatorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
int UtcDaliCheckBoxButtonNewP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
int UtcDaliCheckBoxButtonDownCastP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
int UtcDaliCheckBoxButtonDownCastN(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
BaseHandle unInitializedObject;
int UtcDaliCheckBoxSetLabelP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
int UtcDaliCheckBoxSetDisabledPropertyP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
Stage::GetCurrent().Add( checkBox );
int UtcDaliCheckBoxSetLabelDisabledP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
CheckBoxButton checkBox = CheckBoxButton::New();
Stage::GetCurrent().Add( checkBox );
DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION );
END_TEST;
-}
\ No newline at end of file
+}
int UtcDaliDragAndDropDetectorStartSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control = Control::New();
int UtcDaliDragAndDropDetectorEnteredSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
int UtcDaliDragAndDropDetectorMovedSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
int UtcDaliDragAndDropDetectorExitedSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
int UtcDaliDragAndDropDetectorDroppedSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
int UtcDaliDragAndDropDetectorEndedSignal(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
int UtcDaliDragAndDropDetectorGetContent(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
Control control1 = Control::New();
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
int UtcDaliImageAtlasUploadWithObserver01(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageAtlas atlas = ImageAtlas::New( 200, 200 );
int UtcDaliImageAtlasUploadWithObserver02(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageAtlas atlas = ImageAtlas::New( 200, 200 );
gCountOfTestFuncCall = 0;
int UtcDaliImageAtlasUploadWithObserver03(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
gCountOfTestFuncCall = 0;
TestUploadObserver* uploadObserver = new TestUploadObserver;
int UtcDaliImageAtlasRemove(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
unsigned int size = 100;
ImageAtlas atlas = ImageAtlas::New( size, size );
Vector4 textureRect1;
int UtcDaliImageViewNewP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageView imageView = ImageView::New();
int UtcDaliImageViewNewImageP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
BufferImage image = CreateBufferImage( 100, 200, Vector4( 1.f, 1.f, 1.f, 1.f ) );
ImageView imageView = ImageView::New( image );
int UtcDaliImageViewNewUrlP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageView imageView = ImageView::New( TEST_IMAGE_FILE_NAME );
DALI_TEST_CHECK( imageView );
int UtcDaliImageViewConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageView imageView;
int UtcDaliImageViewCopyConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
// Initialize an object, ref count == 1
ImageView imageView = ImageView::New();
int UtcDaliImageViewAssignmentOperatorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageView imageView = ImageView::New();
int UtcDaliImageViewDownCastP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
ImageView imageView = ImageView::New();
int UtcDaliImageViewDownCastN(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
BaseHandle unInitializedObject;
{
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
const unsigned int TOTAL_PAGE_NUMBER = 20;
-const Vector2 PAGE_SIZE( 300.f,400.f );
+const Vector2 VIEW_PAGE_SIZE( 300.f,400.f );
const Vector2 SPINE_SHADOW_PARAMETER( 60.0f, 30.0f );
static bool gObjectCreatedCallBackCalled;
// Test object creation
TestPageFactory factory;
- portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ portraitView = PageTurnPortraitView::New( factory, VIEW_PAGE_SIZE );
DALI_TEST_CHECK( portraitView );
//Additional check to ensure object is created by checking if it's registered
registry.ObjectCreatedSignal().Connect( &TestCallback );
{
TestPageFactory factory;
- PageTurnView portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ PageTurnView portraitView = PageTurnPortraitView::New( factory, VIEW_PAGE_SIZE );
}
DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
// Test object creation
TestPageFactory factory;
- landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ landscapeView = PageTurnLandscapeView::New( factory, VIEW_PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
//Additional check to ensure object is created by checking if it's registered
registry.ObjectCreatedSignal().Connect( &TestCallback );
{
TestPageFactory factory;
- PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ PageTurnView landscapeView = PageTurnLandscapeView::New( factory, VIEW_PAGE_SIZE );
}
DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
// Test object creation
TestPageFactory factory;
- portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
+ portraitView = PageTurnPortraitView::New( factory, VIEW_PAGE_SIZE );
DALI_TEST_CHECK( portraitView );
// Test copy constructor
// Test object creation
TestPageFactory factory;
- landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ landscapeView = PageTurnLandscapeView::New( factory, VIEW_PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
// Test copy constructor
tet_infoline(" UtcDaliPageTurnViewSetGetProperty ");
TestPageFactory factory;
- PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
+ PageTurnView landscapeView = PageTurnLandscapeView::New( factory, VIEW_PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
Stage::GetCurrent().Add( landscapeView );
- // Test "pageSize" property
- DALI_TEST_CHECK( landscapeView.GetPropertyIndex("pageSize") == PageTurnView::Property::PAGE_SIZE );
- DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), PAGE_SIZE, TEST_LOCATION );
+ // Test "viewPageSize" property
+ DALI_TEST_CHECK( landscapeView.GetPropertyIndex("viewPageSize") == PageTurnView::Property::VIEW_PAGE_SIZE );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::VIEW_PAGE_SIZE).Get<Vector2>(), VIEW_PAGE_SIZE, TEST_LOCATION );
- Vector2 newSize( PAGE_SIZE.x*0.75, PAGE_SIZE.y*0.5f );
- landscapeView.SetProperty( PageTurnView::Property::PAGE_SIZE, newSize );
- DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), newSize, TEST_LOCATION );
+ Vector2 newSize( VIEW_PAGE_SIZE.x*0.75, VIEW_PAGE_SIZE.y*0.5f );
+ landscapeView.SetProperty( PageTurnView::Property::VIEW_PAGE_SIZE, newSize );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::VIEW_PAGE_SIZE).Get<Vector2>(), newSize, TEST_LOCATION );
Wait( application);
DALI_TEST_EQUALS( Vector2(landscapeView.GetTargetSize()), Vector2(newSize.x*2.f, newSize.y), TEST_LOCATION);
- landscapeView.SetProperty( PageTurnView::Property::PAGE_SIZE,newSize*1.5f);
- DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), newSize*1.5f, TEST_LOCATION );
+ landscapeView.SetProperty( PageTurnView::Property::VIEW_PAGE_SIZE,newSize*1.5f);
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::VIEW_PAGE_SIZE).Get<Vector2>(), newSize*1.5f, TEST_LOCATION );
Wait( application);
DALI_TEST_EQUALS( Vector2(landscapeView.GetTargetSize()), Vector2(newSize.x*3.f, newSize.y*1.5f), TEST_LOCATION);
ScrollView scrollView = ScrollView::New();
// Do not rely on stage size for UTC tests.
- Vector2 pageSize( 720.0f, 1280.0f );
+ Vector2 viewPageSize( 720.0f, 1280.0f );
scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- scrollView.SetSize( pageSize );
+ scrollView.SetSize( viewPageSize );
scrollView.SetParentOrigin( ParentOrigin::CENTER );
scrollView.SetAnchorPoint( AnchorPoint::CENTER );
scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
// Position rulers.
Property::Map rulerMap;
rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, true );
- rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, pageSize.width );
- rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, pageSize.width*3 );
+ rulerMap.Add( ScrollMode::X_AXIS_SNAP_TO_INTERVAL, viewPageSize.width );
+ rulerMap.Add( ScrollMode::X_AXIS_SCROLL_BOUNDARY, viewPageSize.width*3 );
rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, false );
scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
- DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
+ DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final X coord has snapped to exactly one page ahead of the start page.
- DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
END_TEST;
}
ScrollView scrollView = ScrollView::New();
// Do not rely on stage size for UTC tests.
- Vector2 pageSize( 720.0f, 1280.0f );
+ Vector2 viewPageSize( 720.0f, 1280.0f );
scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- scrollView.SetSize( pageSize );
+ scrollView.SetSize( viewPageSize );
scrollView.SetParentOrigin( ParentOrigin::CENTER );
scrollView.SetAnchorPoint( AnchorPoint::CENTER );
scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
Property::Map rulerMap;
rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
- rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
- rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
+ rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height );
+ rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 );
scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
scrollView.SetWrapMode( false );
Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
- DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
+ DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final Y coord has snapped to exactly one page ahead of the start page.
- DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
END_TEST;
}
ScrollView scrollView = ScrollView::New();
// Do not rely on stage size for UTC tests.
- Vector2 pageSize( 720.0f, 1280.0f );
+ Vector2 viewPageSize( 720.0f, 1280.0f );
scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- scrollView.SetSize( pageSize );
+ scrollView.SetSize( viewPageSize );
scrollView.SetParentOrigin( ParentOrigin::CENTER );
scrollView.SetAnchorPoint( AnchorPoint::CENTER );
scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
Property::Map rulerMap;
rulerMap.Add( ScrollMode::X_AXIS_SCROLL_ENABLED, false );
rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_ENABLED, true );
- rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, pageSize.height );
- rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, pageSize.height*3 );
+ rulerMap.Add( ScrollMode::Y_AXIS_SNAP_TO_INTERVAL, viewPageSize.height );
+ rulerMap.Add( ScrollMode::Y_AXIS_SCROLL_BOUNDARY, viewPageSize.height*3 );
scrollView.SetProperty( ScrollView::Property::SCROLL_MODE, rulerMap);
scrollView.SetWrapMode( false );
Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
- DALI_TEST_GREATER( ( startPos.y + pageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
+ DALI_TEST_GREATER( ( startPos.y + viewPageSize.height ), scrollView.GetCurrentScrollPosition().y, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final Y coord has snapped to exactly one page ahead of the start page.
- DALI_TEST_EQUALS( pageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS( viewPageSize.height, scrollView.GetCurrentScrollPosition().y, Math::MACHINE_EPSILON_0, TEST_LOCATION );
END_TEST;
}
ScrollView scrollView = ScrollView::New();
// Do not rely on stage size for UTC tests.
- Vector2 pageSize( 720.0f, 1280.0f );
+ Vector2 viewPageSize( 720.0f, 1280.0f );
scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- scrollView.SetSize( pageSize );
+ scrollView.SetSize( viewPageSize );
scrollView.SetParentOrigin( ParentOrigin::TOP_LEFT );
scrollView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
ScrollView scrollView = ScrollView::New();
// Do not rely on stage size for UTC tests.
- Vector2 pageSize( 720.0f, 1280.0f );
+ Vector2 viewPageSize( 720.0f, 1280.0f );
scrollView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- scrollView.SetSize( pageSize );
+ scrollView.SetSize( viewPageSize );
scrollView.SetParentOrigin( ParentOrigin::CENTER );
scrollView.SetAnchorPoint( AnchorPoint::CENTER );
scrollView.SetPosition( 0.0f, 0.0f, 0.0f );
// Position rulers.
// We set the X ruler to fixed to give us pages to snap to.
- Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( pageSize.width );
+ Dali::Toolkit::FixedRuler* rulerX = new Dali::Toolkit::FixedRuler( viewPageSize.width );
// Note: The 3x page width is arbitary, but we need enough to show that we are
// capping page movement by the page limiter, and not the domain.
- rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, pageSize.width * 3.0f, false ) );
+ rulerX->SetDomain( Dali::Toolkit::RulerDomain( 0.0f, viewPageSize.width * 3.0f, false ) );
Dali::Toolkit::RulerPtr rulerY = new Dali::Toolkit::DefaultRuler();
rulerY->Disable();
scrollView.SetRulerX( rulerX );
Vector2 currentPos( PerformGestureSwipe( application, startPos, direction, frames - 1, time, false ) );
// Confirm the final X coord has not moved more than one page from the start X position.
- DALI_TEST_GREATER( ( startPos.x + pageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
+ DALI_TEST_GREATER( ( startPos.x + viewPageSize.width ), scrollView.GetCurrentScrollPosition().x, TEST_LOCATION );
// Finish the gesture and wait for the snap.
currentPos += direction;
time += Wait( application, RENDER_DELAY_SCROLL + RENDER_FRAME_INTERVAL );
// Confirm the final X coord has snapped to exactly one page ahead of the start page.
- DALI_TEST_EQUALS( pageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS( viewPageSize.width, scrollView.GetCurrentScrollPosition().x, Math::MACHINE_EPSILON_0, TEST_LOCATION );
END_TEST;
}
#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-toolkit-test-suite-utils.h>
int utcDaliTextEditorInputStyleChanged01(void)
{
- ToolkitTestApplication application;
- tet_infoline(" utcDaliTextEditorInputStyleChanged01");
-
// The text-editor emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
// The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
- // This creates an implementation of the adaptor stub and a queue of idle callbacks.
- application.CreateAdaptor();
+ // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorInputStyleChanged01");
// Load some fonts.
int utcDaliTextEditorInputStyleChanged02(void)
{
- ToolkitTestApplication application;
- tet_infoline(" utcDaliTextEditorInputStyleChanged02");
-
// The text-editor emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
// The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
- // This creates an implementation of the adaptor stub and a queue of idle callbacks.
- application.CreateAdaptor();
+ // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorInputStyleChanged02");
// Load some fonts.
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
int utcDaliTextFieldInputStyleChanged01(void)
{
- ToolkitTestApplication application;
- tet_infoline(" utcDaliTextFieldInputStyleChanged01");
-
// The text-field emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
// The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
- // This creates an implementation of the adaptor stub and a queue of idle callbacks.
- application.CreateAdaptor();
+ // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged01");
// Load some fonts.
int utcDaliTextFieldInputStyleChanged02(void)
{
- ToolkitTestApplication application;
- tet_infoline(" utcDaliTextFieldInputStyleChanged02");
-
// The text-field emits signals when the input style changes. These changes of style are
// detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
// can't be emitted during the size negotiation as the callbacks may update the UI.
// The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
- // This creates an implementation of the adaptor stub and a queue of idle callbacks.
- application.CreateAdaptor();
+ // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged02");
// Load some fonts.
#include <dali-toolkit/devel-api/controls/text-controls/text-style-properties-devel.h>
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali/devel-api/text-abstraction/bitmap-font.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali-toolkit/devel-api/text/bitmap-font.h>
using namespace Dali;
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
int UtcDaliTransitionDataNew(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map = CreateMap();
Dali::Toolkit::TransitionData transition = TransitionData::New( map );
int UtcDaliTransitionDataDownCast(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map = CreateMap();
int UtcDaliTransitionDataCopyConstructor(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map = CreateMap();
int UtcDaliTransitionDataAssignmentOperator(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map = CreateMap();
int UtcDaliTransitionDataCount(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map = CreateMap();
TransitionData transitionData = TransitionData::New( map );
int UtcDaliTransitionDataMap1P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation of a visual property using stylesheet equivalent maps\n");
int UtcDaliTransitionDataMap2P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation of a visual property using programmatic maps\n");
int UtcDaliTransitionDataMap2Pb(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation of a visual property using programmatic maps\n");
int UtcDaliTransitionDataMap3P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation of an actor's position property using bezier curve\n");
int UtcDaliTransitionDataMap4P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation of a visual's transform property using programmatic maps\n");
int UtcDaliTransitionDataMap5P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
int UtcDaliTransitionDataMap6P(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing animation visual opacity using stylesheet equivalent maps\n");
int UtcDaliTransitionDataMap1N(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map;
map["target"] = "Actor1";
int UtcDaliTransitionDataMapN3(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing visual lookup with no renderers\n");
int UtcDaliTransitionDataMapN4(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing visual doesn't animate with duff bezier data \n");
int UtcDaliTransitionDataMapN5(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing visual doesn't animate with duff bezier data \n");
int UtcDaliTransitionDataMapN6(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
tet_printf("Testing visual doesn't animate with duff bezier data \n");
int UtcDaliTransitionDataArrayP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map1;
map1["target"] = "Actor1";
int UtcDaliTransitionDataGetAnimatorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Property::Map map1;
map1["target"] = "Actor1";
#include <toolkit-event-thread-callback.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali/devel-api/object/handle-devel.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
GetImpl(*this).CreateRenderTask( name );
}
-FrameBufferImage Builder::GetFrameBufferImage( const std::string &name )
-{
- return GetImpl(*this).GetFrameBufferImage( name );
-}
-
Path Builder::GetPath( const std::string &name )
{
return GetImpl(*this).GetPath( name );
void CreateRenderTask( const std::string &name );
/**
- * Get or create FrameBufferImage from the FrameBufferImage instance library.
- * An empty handle is returned otherwise.
- * @pre The Builder has been initialized.
- * @param name The name of a FrameBufferImage in the loaded representation
- * @return A handle to a FrameBufferImage if found, otherwise empty
- */
- FrameBufferImage GetFrameBufferImage( const std::string &name );
-
- /**
* Get or create Path from the Path instance library.
* An empty handle is returned otherwise.
* @pre The Builder has been initialized.
*/
// EXTERNAL INCLUDES
+#include <cctype>
#include <cstring>
+#include <string>
#include <algorithm>
// INTERNAL INCLUDES
{
}
-PageTurnLandscapeView PageTurnLandscapeView::New( PageFactory& pageFactory, const Vector2& pageSize )
+PageTurnLandscapeView PageTurnLandscapeView::New( PageFactory& pageFactory, const Vector2& viewPageSize )
{
- return Internal::PageTurnLandscapeView::New(pageFactory, pageSize);
+ return Internal::PageTurnLandscapeView::New(pageFactory, viewPageSize);
}
PageTurnLandscapeView PageTurnLandscapeView::DownCast( BaseHandle handle )
* @brief Create an initialized PageTurnLandscapeView control
* @SINCE_1_0.0
* @param[in] pageFactory The factory which provides PageTurnView with pages.
- * @param[in] pageSize The size of the page
+ * @param[in] viewPageSize The size of the page
* @return A handle to the PageTurnLandscapeView control.
*/
- static PageTurnLandscapeView New( PageFactory& pageFactory, const Vector2& pageSize );
+ static PageTurnLandscapeView New( PageFactory& pageFactory, const Vector2& viewPageSize );
/**
* @brief Downcast an Object handle to PageTurnPortraitView. If handle points to a PageTurnLandscapeView the
{
}
-PageTurnPortraitView PageTurnPortraitView::New( PageFactory& pageFactory, const Vector2& pageSize)
+PageTurnPortraitView PageTurnPortraitView::New( PageFactory& pageFactory, const Vector2& viewPageSize)
{
- return Internal::PageTurnPortraitView::New(pageFactory, pageSize);
+ return Internal::PageTurnPortraitView::New(pageFactory, viewPageSize);
}
PageTurnPortraitView PageTurnPortraitView::DownCast( BaseHandle handle )
* @brief Create an initialized PageTurnPortraitView control
* @SINCE_1_1.4
* @param[in] pageFactory The factory which provides PageTurnView with pages.
- * @param[in] pageSize The size of the page
+ * @param[in] viewPageSize The size of the page
* @return A handle to the PageTurnPortraitView control.
*/
- static PageTurnPortraitView New( PageFactory& pageFactory, const Vector2& pageSize );
+ static PageTurnPortraitView New( PageFactory& pageFactory, const Vector2& viewPageSize );
/**
* @brief Downcast an Object handle to PageTurnPortraitView. If handle points to a PageTurnPortraitView the
{
enum
{
- PAGE_SIZE = PROPERTY_START_INDEX, ///< name "pageSize", type Vector2 @SINCE_1_1.4
- CURRENT_PAGE_ID, ///< name "currentPageId", type Integer @SINCE_1_1.4
+ VIEW_PAGE_SIZE = PROPERTY_START_INDEX, ///< name "viewPageSize", type Vector2 @SINCE_1_1.4
+ CURRENT_PAGE_ID, ///< name "currentPageId", type Integer @SINCE_1_1.4
/**
* The two values are the major&minor radius (in pixels) to form an ellipse shape.
#include <fstream>
#include <sstream>
-#include <wordexp.h>
#include <stdio.h>
#include <unistd.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
-inline std::string ExpandPath(const std::string &name)
-{
- wordexp_t p;
- char** w;
- wordexp( name.c_str(), &p, 0 );
- w = p.we_wordv;
- std::stringstream s;
- for (size_t i=0; i<p.we_wordc;i++ )
- {
- s << w[i];
- }
- wordfree( &p );
- return s.str();
-}
-
-
-inline std::string ExePath(void)
-{
- char buf[256];
- ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
- len = len > 0 ? len : 0;
- buf[len] = '\0';
- return std::string(buf);
-}
-
inline std::string GetFileContents(const std::string &fn)
{
std::streampos bufferSize = 0;
}
}
-FrameBufferImage Builder::GetFrameBufferImage( const std::string &name )
-{
- Replacement constant( mReplacementMap );
- return GetFrameBufferImage(name, constant);
-}
-
-FrameBufferImage Builder::GetFrameBufferImage( const std::string &name, const Replacement& constant )
-{
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
-
- FrameBufferImage ret;
-
- ImageLut::const_iterator iter( mFrameBufferImageLut.find( name ) );
- if( iter != mFrameBufferImageLut.end() )
- {
- ret = iter->second;
- }
- else
- {
- if( OptionalChild images = IsChild( *mParser.GetRoot(), "frameBufferImages") )
- {
- if( OptionalChild image = IsChild( *images, name ) )
- {
- Dali::Property::Value property(Property::MAP);
- if( DeterminePropertyFromNode( *image, Property::MAP, property, constant ) )
- {
- Property::Map* map = property.GetMap();
-
- if( map )
- {
- (*map)[ KEYNAME_TYPE ] = Property::Value(std::string("FrameBufferImage") );
- ret = FrameBufferImage::DownCast( Dali::Scripting::NewImage( property ) );
- mFrameBufferImageLut[ name ] = ret;
- }
- }
- }
- }
- }
-
- return ret;
-}
-
Path Builder::GetPath( const std::string& name )
{
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
}
}
- if( OptionalString s = constant.IsString( IsChild(node, "targetFrameBuffer") ) )
- {
- FrameBufferImage fb = GetFrameBufferImage( *s, constant );
- if(fb)
- {
- task.SetTargetFrameBuffer( fb );
- }
- else
- {
- DALI_SCRIPT_WARNING("Cannot find target frame buffer '%s'\n", (*s).c_str() );
- }
- }
-
if( OptionalString s = constant.IsString( IsChild(node, "screenToFrameBufferFunction") ) )
{
if("DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION" == *s)
void CreateRenderTask( const std::string &name );
/**
- * @copydoc Toolkit::Builder::GetFrameBufferImage
- */
- FrameBufferImage GetFrameBufferImage( const std::string &name );
-
- /**
- * @copydoc Toolkit::Builder::GetFrameBufferImage
- */
- FrameBufferImage GetFrameBufferImage( const std::string &name, const Replacement& constant );
-
- /**
* @copydoc Toolkit::Builder::GetPath
*/
Path GetPath( const std::string &name );
typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry;
typedef std::vector<PathConstrainerEntry> PathConstrainerLut;
typedef std::map<const std::string, Path> PathLut;
- typedef std::map<const std::string, FrameBufferImage> ImageLut;
private:
// Undefined
private:
Toolkit::JsonParser mParser;
- ImageLut mFrameBufferImageLut;
PathLut mPathLut;
PathConstrainerLut mPathConstrainerLut;
LinearConstrainerLut mLinearConstrainerLut;
#include <dali-toolkit/internal/builder/json-parser-state.h>
// EXTERNAL INCLUDES
+#include <string>
#include <algorithm>
namespace Dali
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
-#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
namespace Dali
{
// Create actors
// Create an image view for rendering from the scene texture to the bloom texture
- mBloomExtractImageView = Toolkit::ImageView::New();
- mBloomExtractImageView.SetParentOrigin( ParentOrigin::CENTER );
+ mBloomExtractActor = Actor::New();
+ mBloomExtractActor.SetParentOrigin( ParentOrigin::CENTER );
// Create an image view for compositing the result (scene and bloom textures) to output
- mCompositeImageView = Toolkit::ImageView::New();
- mCompositeImageView.SetParentOrigin( ParentOrigin::CENTER );
+ mCompositeActor = Actor::New();
+ mCompositeActor.SetParentOrigin( ParentOrigin::CENTER );
// Create an image view for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
- mTargetImageView = Toolkit::ImageView::New();
- mTargetImageView.SetParentOrigin( ParentOrigin::CENTER );
+ mTargetActor = Actor::New();
+ mTargetActor.SetParentOrigin( ParentOrigin::CENTER );
// Create the Gaussian Blur object + render tasks
// Note that we use mBloomExtractTarget as the source image and also re-use this as the gaussian blur final render target. This saves the gaussian blur code from creating it
// Connect to actor tree
Self().Add( mChildrenRoot );
Self().Add( mInternalRoot );
- mInternalRoot.Add( mBloomExtractImageView );
+ mInternalRoot.Add( mBloomExtractActor );
mInternalRoot.Add( mGaussianBlurView );
- mInternalRoot.Add( mCompositeImageView );
- mInternalRoot.Add( mTargetImageView );
+ mInternalRoot.Add( mCompositeActor );
+ mInternalRoot.Add( mTargetActor );
mInternalRoot.Add( mRenderDownsampledCamera );
mInternalRoot.Add( mRenderFullSizeCamera );
{
mTargetSize = Vector2(targetSize);
mChildrenRoot.SetSize(targetSize);
- mCompositeImageView.SetSize(targetSize);
- mTargetImageView.SetSize(targetSize);
+ mCompositeActor.SetSize(targetSize);
+ mTargetActor.SetSize(targetSize);
// Children render camera must move when GaussianBlurView object is
// resized. This is since we cannot change render target size - so we need
// Create and place a camera for the renders corresponding to the (potentially downsampled) render targets' size
mRenderDownsampledCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
- // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
mRenderDownsampledCamera.SetNearClippingPlane(1.0f);
mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight);
mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
// Create and place a camera for the children render, corresponding to its render target size
mRenderFullSizeCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
- // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
mRenderFullSizeCamera.SetNearClippingPlane(1.0f);
mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
// Create render targets
// create off screen buffer of new size to render our child actors to
- mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mRenderTargetForRenderingChildren = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture textureForChildren = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mRenderTargetForRenderingChildren.AttachColorTexture( textureForChildren );
mBloomExtractTarget = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
Texture texture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight) );
texture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight) );
blurExtractTarget.AttachColorTexture( texture );
- mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mOutputRenderTarget = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture outputTexture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mOutputRenderTarget.AttachColorTexture( outputTexture );
//////////////////////////////////////////////////////
// Point actors and render tasks at new render targets
- mBloomExtractImageView.SetImage( mRenderTargetForRenderingChildren );
- mBloomExtractImageView.SetSize(mDownsampledWidth, mDownsampledHeight); // size needs to match render target
- // Create shader used for extracting the bright parts of an image
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
- Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
- mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ Renderer bloomRenderer = CreateRenderer( BASIC_VERTEX_SOURCE, BLOOM_EXTRACT_FRAGMENT_SOURCE );
+ SetRendererTexture( bloomRenderer, mRenderTargetForRenderingChildren );
+ mBloomExtractActor.AddRenderer( bloomRenderer );
+ mBloomExtractActor.SetSize( mDownsampledWidth, mDownsampledHeight ); // size needs to match render target
// set GaussianBlurView to blur our extracted bloom
mGaussianBlurView.SetUserImageAndOutputRenderTarget( mBloomExtractTarget.GetColorTexture(), blurExtractTarget );
// use the completed blur in the first buffer and composite with the original child actors render
- mCompositeImageView.SetImage( mRenderTargetForRenderingChildren );
- // Create shader used to composite bloom and original image to output render target
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
- mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
- TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
+ Renderer compositeRenderer = CreateRenderer( BASIC_VERTEX_SOURCE, COMPOSITE_FRAGMENT_SOURCE );
+ SetRendererTexture( compositeRenderer, mRenderTargetForRenderingChildren );
+ TextureSet textureSet = compositeRenderer.GetTextures();
+ textureSet.SetTexture( 0u, mRenderTargetForRenderingChildren.GetColorTexture() );
textureSet.SetTexture( 1u, blurExtractTarget.GetColorTexture() );
+ mCompositeActor.AddRenderer( compositeRenderer );
// set up target actor for rendering result, i.e. the blurred image
- mTargetImageView.SetImage(mOutputRenderTarget);
+ Renderer targetRenderer = CreateRenderer( BASIC_VERTEX_SOURCE, BASIC_FRAGMENT_SOURCE );
+ SetRendererTexture( targetRenderer, mOutputRenderTarget );
+ mTargetActor.AddRenderer( targetRenderer );
}
}
mRenderChildrenTask.SetInputEnabled( false );
mRenderChildrenTask.SetClearEnabled( true );
mRenderChildrenTask.SetCameraActor(mRenderFullSizeCamera); // use camera that covers render target exactly
- mRenderChildrenTask.SetTargetFrameBuffer( mRenderTargetForRenderingChildren );
+ mRenderChildrenTask.SetFrameBuffer( mRenderTargetForRenderingChildren );
// Extract the bright part of the image and render to a new buffer. Downsampling also occurs at this stage to save pixel fill, if it is set up.
mBloomExtractTask = taskList.CreateTask();
- mBloomExtractTask.SetSourceActor( mBloomExtractImageView );
+ mBloomExtractTask.SetSourceActor( mBloomExtractActor );
mBloomExtractTask.SetExclusive(true);
mBloomExtractTask.SetInputEnabled( false );
mBloomExtractTask.SetClearEnabled( true );
// Use an image view displaying the children render and composite it with the blurred bloom buffer, targeting the output
mCompositeTask = taskList.CreateTask();
- mCompositeTask.SetSourceActor( mCompositeImageView );
+ mCompositeTask.SetSourceActor( mCompositeActor );
mCompositeTask.SetExclusive(true);
mCompositeTask.SetInputEnabled( false );
mCompositeTask.SetClearEnabled( true );
mCompositeTask.SetCameraActor(mRenderFullSizeCamera);
- mCompositeTask.SetTargetFrameBuffer( mOutputRenderTarget );
+ mCompositeTask.SetFrameBuffer( mOutputRenderTarget );
}
void BloomView::RemoveRenderTasks()
mOutputRenderTarget.Reset();
// Reset children
- mBloomExtractImageView.SetImage( "" );
- mTargetImageView.SetImage( "" );
- mCompositeImageView.SetImage( "" );
+ mBloomExtractActor.RemoveRenderer( 0u );
+ mTargetActor.RemoveRenderer( 0u );
+ mCompositeActor.RemoveRenderer( 0u );
mGaussianBlurView.SetVisible( false );
// bloom threshold
// set defaults, makes sure properties are registered with shader
- mBloomExtractImageView.RegisterProperty( BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT );
- mBloomExtractImageView.RegisterProperty( RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME, 1.0f / (1.0f - BLOOM_THRESHOLD_DEFAULT) );
+ mBloomExtractActor.RegisterProperty( BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT );
+ mBloomExtractActor.RegisterProperty( RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME, 1.0f / (1.0f - BLOOM_THRESHOLD_DEFAULT) );
// Register a property that the user can control to change the bloom threshold
mBloomThresholdPropertyIndex = self.RegisterProperty(BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT);
- Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractImageView.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME);
- Constraint bloomThresholdConstraint = Constraint::New<float>( mBloomExtractImageView, shaderBloomThresholdPropertyIndex, EqualToConstraint());
+ Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractActor.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME);
+ Constraint bloomThresholdConstraint = Constraint::New<float>( mBloomExtractActor, shaderBloomThresholdPropertyIndex, EqualToConstraint());
bloomThresholdConstraint.AddSource( Source(self, mBloomThresholdPropertyIndex) );
bloomThresholdConstraint.Apply();
// precalc 1.0 / (1.0 - threshold) on CPU to save shader insns, using constraint to tie to the normal threshold property
- Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractImageView.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME);
- Constraint thresholdConstraint = Constraint::New<float>( mBloomExtractImageView, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint());
+ Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractActor.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME);
+ Constraint thresholdConstraint = Constraint::New<float>( mBloomExtractActor, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint());
thresholdConstraint.AddSource( LocalSource(shaderBloomThresholdPropertyIndex) );
thresholdConstraint.Apply();
// Register a property that the user can control to fade the bloom intensity via internally hidden shader
mBloomIntensityPropertyIndex = self.RegisterProperty(BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT);
- mCompositeImageView.RegisterProperty( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT );
- Property::Index shaderBloomIntensityPropertyIndex = mCompositeImageView.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME);
- Constraint bloomIntensityConstraint = Constraint::New<float>( mCompositeImageView, shaderBloomIntensityPropertyIndex, EqualToConstraint());
+ mCompositeActor.RegisterProperty( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT );
+ Property::Index shaderBloomIntensityPropertyIndex = mCompositeActor.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME);
+ Constraint bloomIntensityConstraint = Constraint::New<float>( mCompositeActor, shaderBloomIntensityPropertyIndex, EqualToConstraint());
bloomIntensityConstraint.AddSource( Source(self, mBloomIntensityPropertyIndex) );
bloomIntensityConstraint.Apply();
// Register a property that the user can control to fade the bloom saturation via internally hidden shader
mBloomSaturationPropertyIndex = self.RegisterProperty(BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT);
- mCompositeImageView.RegisterProperty( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT );
- Property::Index shaderBloomSaturationPropertyIndex = mCompositeImageView.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME);
- Constraint bloomSaturationConstraint = Constraint::New<float>( mCompositeImageView, shaderBloomSaturationPropertyIndex, EqualToConstraint());
+ mCompositeActor.RegisterProperty( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT );
+ Property::Index shaderBloomSaturationPropertyIndex = mCompositeActor.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME);
+ Constraint bloomSaturationConstraint = Constraint::New<float>( mCompositeActor, shaderBloomSaturationPropertyIndex, EqualToConstraint());
bloomSaturationConstraint.AddSource( Source(self, mBloomSaturationPropertyIndex) );
bloomSaturationConstraint.Apply();
// Register a property that the user can control to fade the image intensity via internally hidden shader
mImageIntensityPropertyIndex = self.RegisterProperty(IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT);
- mCompositeImageView.RegisterProperty( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT );
- Property::Index shaderImageIntensityPropertyIndex = mCompositeImageView.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME);
- Constraint imageIntensityConstraint = Constraint::New<float>( mCompositeImageView, shaderImageIntensityPropertyIndex, EqualToConstraint());
+ mCompositeActor.RegisterProperty( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT );
+ Property::Index shaderImageIntensityPropertyIndex = mCompositeActor.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME);
+ Constraint imageIntensityConstraint = Constraint::New<float>( mCompositeActor, shaderImageIntensityPropertyIndex, EqualToConstraint());
imageIntensityConstraint.AddSource( Source(self, mImageIntensityPropertyIndex) );
imageIntensityConstraint.Apply();
// Register a property that the user can control to fade the image saturation via internally hidden shader
mImageSaturationPropertyIndex = self.RegisterProperty(IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT);
- mCompositeImageView.RegisterProperty( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT );
- Property::Index shaderImageSaturationPropertyIndex = mCompositeImageView.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME);
- Constraint imageSaturationConstraint = Constraint::New<float>( mCompositeImageView, shaderImageSaturationPropertyIndex, EqualToConstraint());
+ mCompositeActor.RegisterProperty( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT );
+ Property::Index shaderImageSaturationPropertyIndex = mCompositeActor.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME);
+ Constraint imageSaturationConstraint = Constraint::New<float>( mCompositeActor, shaderImageSaturationPropertyIndex, EqualToConstraint());
imageSaturationConstraint.AddSource( Source(self, mImageSaturationPropertyIndex) );
imageSaturationConstraint.Apply();
}
#include <cmath>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/public-api/rendering/frame-buffer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
/////////////////////////////////////////////////////////////
// for rendering all user added children to offscreen target
- FrameBufferImage mRenderTargetForRenderingChildren;
+ FrameBuffer mRenderTargetForRenderingChildren;
RenderTask mRenderChildrenTask;
/////////////////////////////////////////////////////////////
// for extracting bright parts of image to an offscreen target
FrameBuffer mBloomExtractTarget; // for rendering bright parts of image into separate texture, also used as target for gaussian blur
RenderTask mBloomExtractTask;
- Toolkit::ImageView mBloomExtractImageView;
+ Actor mBloomExtractActor;
/////////////////////////////////////////////////////////////
// for blurring extracted bloom
// for compositing bloom and children renders to offscreen target
RenderTask mCompositeTask;
- Toolkit::ImageView mCompositeImageView;
+ Actor mCompositeActor;
/////////////////////////////////////////////////////////////
// for holding blurred result
- FrameBufferImage mOutputRenderTarget;
- Toolkit::ImageView mTargetImageView;
+ FrameBuffer mOutputRenderTarget;
+ Actor mTargetActor;
/////////////////////////////////////////////////////////////
// Properties for setting by user, e.g. by animations
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+#define DALI_COMPOSE_SHADER(STR) #STR
+
+const char * const BASIC_VERTEX_SOURCE = DALI_COMPOSE_SHADER(
+ precision mediump float;\n
+ attribute mediump vec2 aPosition;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec4 vertexPosition = vec4(aPosition * uSize.xy, 0.0, 1.0);\n
+ vTexCoord = aPosition + vec2(0.5);
+ gl_Position = uMvpMatrix * vertexPosition;\n
+ }\n
+);
+
+const char * const BASIC_FRAGMENT_SOURCE = DALI_COMPOSE_SHADER(
+ precision mediump float;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform vec4 uColor;\n
+ \n
+ void main()\n
+ {\n
+ gl_FragColor = texture2D(sTexture, vTexCoord);\n
+ gl_FragColor *= uColor;
+ }\n
+);
+
+Geometry CreateGridGeometry( Uint16Pair gridSize )
+{
+ uint16_t gridWidth = gridSize.GetWidth();
+ uint16_t gridHeight = gridSize.GetHeight();
+
+ // Create vertices
+ Vector< Vector2 > vertices;
+ vertices.Reserve( ( gridWidth + 1 ) * ( gridHeight + 1 ) );
+
+ for( int y = 0; y < gridHeight + 1; ++y )
+ {
+ for( int x = 0; x < gridWidth + 1; ++x )
+ {
+ vertices.PushBack( Vector2( (float)x/gridWidth - 0.5f, (float)y/gridHeight - 0.5f) );
+ }
+ }
+
+ // Create indices
+ Vector< unsigned short > indices;
+ indices.Reserve( (gridWidth+2)*gridHeight*2 - 2);
+
+ for( unsigned int row = 0u; row < gridHeight; ++row )
+ {
+ unsigned int rowStartIndex = row*(gridWidth+1u);
+ unsigned int nextRowStartIndex = rowStartIndex + gridWidth +1u;
+
+ if( row != 0u ) // degenerate index on non-first row
+ {
+ indices.PushBack( rowStartIndex );
+ }
+
+ for( unsigned int column = 0u; column < gridWidth+1u; column++) // main strip
+ {
+ indices.PushBack( rowStartIndex + column);
+ indices.PushBack( nextRowStartIndex + column);
+ }
+
+ if( row != gridHeight-1u ) // degenerate index on non-last row
+ {
+ indices.PushBack( nextRowStartIndex + gridWidth );
+ }
+ }
+
+ Property::Map vertexFormat;
+ vertexFormat[ "aPosition" ] = Property::VECTOR2;
+ PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
+ if( vertices.Size() > 0 )
+ {
+ vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
+ }
+
+ // Create the geometry object
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( vertexPropertyBuffer );
+ if( indices.Size() > 0 )
+ {
+ geometry.SetIndexBuffer( &indices[ 0 ], indices.Size() );
+ }
+
+ geometry.SetType( Geometry::TRIANGLE_STRIP );
+
+ return geometry;
+}
+
+Dali::Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc )
+{
+ Dali::Shader shader = Dali::Shader::New( vertexSrc, fragmentSrc );
+
+ Dali::Geometry texturedQuadGeometry = Dali::Geometry::New();
+
+ struct VertexPosition { Dali::Vector2 position; };
+ struct VertexTexture { Dali::Vector2 texture; };
+
+ VertexPosition positionArray[] =
+ {
+ { Dali::Vector2( -0.5f, -0.5f ) },
+ { Dali::Vector2( 0.5f, -0.5f ) },
+ { Dali::Vector2( -0.5f, 0.5f ) },
+ { Dali::Vector2( 0.5f, 0.5f ) }
+ };
+ uint32_t numberOfVertices = sizeof(positionArray)/sizeof(VertexPosition);
+
+ Dali::Property::Map positionVertexFormat;
+ positionVertexFormat["aPosition"] = Dali::Property::VECTOR2;
+ Dali::PropertyBuffer positionVertices = Dali::PropertyBuffer::New( positionVertexFormat );
+ positionVertices.SetData( positionArray, numberOfVertices );
+ texturedQuadGeometry.AddVertexBuffer( positionVertices );
+
+ const uint16_t indices[] = { 0, 3, 1, 0, 2, 3 };
+ texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
+
+ Dali::Renderer renderer = Dali::Renderer::New( texturedQuadGeometry, shader );
+
+ Dali::TextureSet textureSet = Dali::TextureSet::New();
+ renderer.SetTextures( textureSet );
+
+ return renderer;
+}
+
+Dali::Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc, Dali::Shader::Hint::Value hints, Uint16Pair gridSize )
+{
+ Dali::Shader shader = Dali::Shader::New( vertexSrc, fragmentSrc, hints );
+
+ Dali::Geometry gridGeometry = CreateGridGeometry( gridSize );
+
+ Dali::Renderer renderer = Dali::Renderer::New( gridGeometry, shader );
+
+ Dali::TextureSet textureSet = Dali::TextureSet::New();
+ renderer.SetTextures( textureSet );
+
+ return renderer;
+}
+
+void SetRendererTexture( Dali::Renderer renderer, Dali::Texture texture )
+{
+ if( renderer )
+ {
+ Dali::TextureSet textureSet = renderer.GetTextures();
+ textureSet.SetTexture( 0u, texture );
+ }
+}
+
+void SetRendererTexture( Dali::Renderer renderer, Dali::FrameBuffer frameBuffer )
+{
+ if( frameBuffer )
+ {
+ Dali::Texture texture = frameBuffer.GetColorTexture();
+ SetRendererTexture( renderer, texture );
+ }
+}
+
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
+#define DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
+
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/dali.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+extern const char* const BASIC_VERTEX_SOURCE;
+
+extern const char* const BASIC_FRAGMENT_SOURCE;
+
+/**
+ * Helper method for rendering an image with custom shader.
+ * @param[in] vertextSrc The custom vertex shader.
+ * @param[in] fragmentSrc The custom fragment shader.
+ * @return A newly created renderer.
+ */
+Dali::Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc );
+
+/**
+ * Helper method for rendering an image with custom shader.
+ * @param[in] vertextSrc The custom vertex shader.
+ * @param[in] fragmentSrc The custom fragment shader.
+ * @param[in] gridSize The number of grid sub-divisions required.
+ * @return A newly created renderer.
+ */
+Dali::Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc, Dali::Shader::Hint::Value hints, Dali::Uint16Pair gridSize );
+
+/**
+ * Helper method for setting the first texture passed to a renderer.
+ * @param[in] renderer The renderer using the texture.
+ * @param[in] texture The texture to set.
+ */
+void SetRendererTexture( Dali::Renderer renderer, Dali::Texture texture );
+
+/**
+ * Helper method for setting the first texture passed to a renderer.
+ * @param[in] renderer The renderer using the texture.
+ * @param[in] framebuffer A frame buffer color texture attached.
+ */
+void SetRendererTexture( Dali::Renderer renderer, Dali::FrameBuffer frameBuffer );
+
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
-#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
#include <dali-toolkit/internal/filters/emboss-filter.h>
#include <dali-toolkit/internal/filters/spread-filter.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
namespace Dali
{
const Vector4 EFFECTS_VIEW_DEFAULT_BACKGROUND_COLOR( 0.0f, 0.0f, 0.0f, 0.0 );
const bool EFFECTS_VIEW_REFRESH_ON_DEMAND(false);
-// Visuals are not stylable or public
-const Property::Index CHILD_VISUAL( Toolkit::EffectsView::ANIMATABLE_PROPERTY_START_INDEX - 1);
-const Property::Index POST_FILTER_VISUAL( CHILD_VISUAL-1 );
-
#define DALI_COMPOSE_SHADER(STR) #STR
const char* EFFECTS_VIEW_VERTEX_SOURCE = DALI_COMPOSE_SHADER(
mEffectType( Toolkit::EffectsView::INVALID_TYPE ),
mPixelFormat( EFFECTS_VIEW_DEFAULT_PIXEL_FORMAT ),
mEnabled( false ),
- mRefreshOnDemand(EFFECTS_VIEW_REFRESH_ON_DEMAND)
+ mRefreshOnDemand( EFFECTS_VIEW_REFRESH_ON_DEMAND )
{
}
}
}
- FrameBufferImage dummyImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
-
- Internal::InitializeVisual( self, mVisualPostFilter, dummyImage );
- DevelControl::RegisterVisual( *this, POST_FILTER_VISUAL, mVisualPostFilter );
-
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EFFECTS_VIEW_FRAGMENT_SOURCE;
- Toolkit::GetImplementation( mVisualPostFilter ).SetCustomShader( customShader );
-
mEffectType = type;
}
}
void EffectsView::Disable()
{
// stop render tasks processing
- // Note: render target resources are automatically freed since we set the Image::Unused flag
RemoveRenderTasks();
mLastSize = Vector2::ZERO; // Ensure resources are reallocated on subsequent enable
mEnabled = false;
void EffectsView::OnStageConnection( int depth )
{
+ Actor self( Self() );
+
+ // Create renderers
+ mRendererPostFilter = CreateRenderer( EFFECTS_VIEW_VERTEX_SOURCE, EFFECTS_VIEW_FRAGMENT_SOURCE );
+ mRendererPostFilter.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT );
+ self.AddRenderer( mRendererPostFilter );
+
+ mRendererForChildren = CreateRenderer( BASIC_VERTEX_SOURCE, BASIC_FRAGMENT_SOURCE );
+ mRendererForChildren.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + 1 );
+ self.AddRenderer( mRendererForChildren );
+
Enable();
Control::OnStageConnection( depth );
void EffectsView::OnStageDisconnection()
{
+ Actor self( Self() );
+
Disable();
const size_t numFilters( mFilters.Size() );
mFilters[i]->Disable();
}
+ // Remove renderers
+ self.RemoveRenderer( mRendererForChildren );
+ mRendererForChildren.Reset();
+
+ self.RemoveRenderer( mRendererPostFilter );
+ mRendererPostFilter.Reset();
+
Control::OnStageDisconnection();
}
case Toolkit::EffectsView::DROP_SHADOW:
{
SpreadFilter* spreadFilter = static_cast< SpreadFilter* >( mFilters[0] );
- spreadFilter->SetInputImage( mImageForChildren );
- spreadFilter->SetOutputImage( mImagePostFilter );
+ spreadFilter->SetInputTexture( mFrameBufferForChildren.GetColorTexture() );
+ spreadFilter->SetOutputFrameBuffer( mFrameBufferPostFilter );
spreadFilter->SetRootActor( mChildrenRoot );
spreadFilter->SetBackgroundColor( mBackgroundColor );
spreadFilter->SetPixelFormat( mPixelFormat );
spreadFilter->SetSpread( mEffectSize );
BlurTwoPassFilter* blurFilter = static_cast< BlurTwoPassFilter* >( mFilters[1] );
- blurFilter->SetInputImage( mImagePostFilter );
- blurFilter->SetOutputImage( mImagePostFilter );
+ blurFilter->SetInputTexture( mFrameBufferPostFilter.GetColorTexture() );
+ blurFilter->SetOutputFrameBuffer( mFrameBufferPostFilter );
blurFilter->SetRootActor( mChildrenRoot );
blurFilter->SetBackgroundColor( mBackgroundColor );
blurFilter->SetPixelFormat( mPixelFormat );
case Toolkit::EffectsView::EMBOSS:
{
SpreadFilter* spreadFilter = static_cast< SpreadFilter* >( mFilters[0] );
- spreadFilter->SetInputImage( mImageForChildren );
- spreadFilter->SetOutputImage( mImagePostFilter );
+ spreadFilter->SetInputTexture( mFrameBufferForChildren.GetColorTexture() );
+ spreadFilter->SetOutputFrameBuffer( mFrameBufferPostFilter );
spreadFilter->SetRootActor( mChildrenRoot );
spreadFilter->SetBackgroundColor( mBackgroundColor );
spreadFilter->SetPixelFormat( Pixel::RGBA8888 );
spreadFilter->SetSpread( mEffectSize );
EmbossFilter* embossFilter = static_cast< EmbossFilter* >( mFilters[1] );
- embossFilter->SetInputImage( mImagePostFilter );
- embossFilter->SetOutputImage( mImagePostFilter );
+ embossFilter->SetInputTexture( mFrameBufferPostFilter.GetColorTexture() );
+ embossFilter->SetOutputFrameBuffer( mFrameBufferPostFilter );
embossFilter->SetRootActor( mChildrenRoot );
embossFilter->SetBackgroundColor( mBackgroundColor );
embossFilter->SetPixelFormat( Pixel::RGBA8888 );
embossFilter->SetSize( mTargetSize );
BlurTwoPassFilter* blurFilter = static_cast< BlurTwoPassFilter* >( mFilters[2] );
- blurFilter->SetInputImage( mImagePostFilter );
- blurFilter->SetOutputImage( mImagePostFilter );
+ blurFilter->SetInputTexture( mFrameBufferPostFilter.GetColorTexture() );
+ blurFilter->SetOutputFrameBuffer( mFrameBufferPostFilter );
blurFilter->SetRootActor( mChildrenRoot );
blurFilter->SetBackgroundColor( Vector4( 0.5f, 0.5f, 0.5f, 0.0 ) );
blurFilter->SetPixelFormat( Pixel::RGBA8888 );
}
}
}
+
void EffectsView::AllocateResources()
{
if(mTargetSize != mLastSize)
Actor self( Self() );
- mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
- Internal::InitializeVisual( self, mVisualForChildren, mImageForChildren );
- DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren, DepthIndex::CONTENT + 1 );
+ mFrameBufferForChildren = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture textureForChildren = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferForChildren.AttachColorTexture( textureForChildren );
+
+ SetRendererTexture( mRendererForChildren, textureForChildren );
+
+ mFrameBufferPostFilter = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture texturePostFilter = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferPostFilter.AttachColorTexture( texturePostFilter );
- mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
- TextureSet textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, mImagePostFilter );
- self.GetRendererAt( 0 ).SetTextures( textureSet );
- mVisualPostFilter.SetDepthIndex( DepthIndex::CONTENT );
+ SetRendererTexture( mRendererPostFilter, texturePostFilter );
SetupFilters();
}
mRenderTaskForChildren.SetInputEnabled( false );
mRenderTaskForChildren.SetClearColor( mBackgroundColor );
mRenderTaskForChildren.SetClearEnabled( true );
- mRenderTaskForChildren.SetTargetFrameBuffer( mImageForChildren );
+ mRenderTaskForChildren.SetFrameBuffer( mFrameBufferForChildren );
mRenderTaskForChildren.SetCameraActor(mCameraForChildren); // use camera that covers render target exactly
// Enable image filters
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/effects-view/effects-view.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
namespace Dali
{
EffectsView();
/**
- * Constructor.
- * @copydoc Toolkit::EffectsView New(const unsigned int,const float,const Pixel::Format,const float,const float)
- */
- EffectsView(const unsigned int numSamples, const float blurBellCurveWidth, const int spread,
- const Pixel::Format pixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale,
- FrameBufferImage image);
-
- /**
* A reference counted object may only be deleted by calling Unreference()
*/
virtual ~EffectsView();
/////////////////////////////////////////////////////////////
// for rendering all user added children to offscreen target
- FrameBufferImage mImageForChildren;
- Toolkit::Visual::Base mVisualForChildren;
+ FrameBuffer mFrameBufferForChildren;
+ Renderer mRendererForChildren;
RenderTask mRenderTaskForChildren;
CameraActor mCameraForChildren;
Actor mChildrenRoot; // for creating a subtree for all user added child actors
Vector2 mLastSize;
/////////////////////////////////////////////////////////////
// post blur image
- FrameBufferImage mImagePostFilter;
- Toolkit::Visual::Base mVisualPostFilter;
+ FrameBuffer mFrameBufferPostFilter;
+ Renderer mRendererPostFilter;
Vector<ImageFilter*> mFilters;
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
// TODO:
// pixel format / size - set from JSON
const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
-#define DALI_COMPOSE_SHADER(STR) #STR
-
-const char * const BASIC_VERTEX_SOURCE = DALI_COMPOSE_SHADER(
- precision mediump float;\n
- attribute mediump vec2 aPosition;\n
- attribute mediump vec2 aTexture;\n
- varying mediump vec2 vTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- \n
- void main()\n
- {\n
- mediump vec4 vertexPosition = vec4(aPosition * uSize.xy, 0.0, 1.0);\n
- vTexCoord = aTexture;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
- }\n
-);
-
-const char * const BASIC_FRAGMENT_SOURCE = DALI_COMPOSE_SHADER(
- precision mediump float;\n
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- uniform vec4 uColor;\n
- \n
- void main()\n
- {\n
- gl_FragColor = texture2D(sTexture, vTexCoord);\n
- gl_FragColor *= uColor;
- }\n
-);
-
const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE = DALI_COMPOSE_SHADER(
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
}\n
);
-Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc )
-{
- Shader shader = Shader::New( vertexSrc, fragmentSrc );
-
- Geometry texturedQuadGeometry = Geometry::New();
-
- struct VertexPosition { Vector2 position; };
- struct VertexTexture { Vector2 texture; };
-
- VertexPosition positionArray[] =
- {
- { Vector2( -0.5f, -0.5f ) },
- { Vector2( 0.5f, -0.5f ) },
- { Vector2( -0.5f, 0.5f ) },
- { Vector2( 0.5f, 0.5f ) }
- };
- uint32_t numberOfVertices = sizeof(positionArray)/sizeof(VertexPosition);
-
- VertexTexture uvArray[] =
- {
- { Vector2( 0.0f, 0.0f ) },
- { Vector2( 1.0f, 0.0f ) },
- { Vector2( 0.0f, 1.0f ) },
- { Vector2( 1.0f, 1.0f ) }
- };
-
- Property::Map positionVertexFormat;
- positionVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
- positionVertices.SetData( positionArray, numberOfVertices );
- texturedQuadGeometry.AddVertexBuffer( positionVertices );
-
- Property::Map textureVertexFormat;
- textureVertexFormat["aTexture"] = Property::VECTOR2;
- PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
- textureVertices.SetData( uvArray, numberOfVertices );
- texturedQuadGeometry.AddVertexBuffer( textureVertices );
-
- const uint16_t indices[] = { 0, 3, 1, 0, 2, 3 };
- texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
-
- Renderer renderer = Renderer::New( texturedQuadGeometry, shader );
-
- TextureSet textureSet = TextureSet::New();
- renderer.SetTextures( textureSet );
-
- return renderer;
-}
-
-void SetTexture( Actor actor, Texture texture )
-{
- if( Renderer renderer = actor.GetRendererAt(0) )
- {
- TextureSet textureSet = renderer.GetTextures();
- textureSet.SetTexture( 0u, texture );
- }
-}
-
-void SetTexture( Actor actor, FrameBuffer frameBuffer )
-{
- if( frameBuffer )
- {
- SetTexture( actor, frameBuffer.GetColorTexture() );
- }
-}
-
} // namespace
mUserInputImage = inputImage;
- SetTexture( mHorizBlurActor, inputImage );
+ SetRendererTexture( mHorizBlurActor.GetRendererAt(0), inputImage );
mUserOutputRenderTarget = outputRenderTarget;
}
mRenderTargetForRenderingChildren.AttachColorTexture( texture );
// Set actor for performing a horizontal blur
- SetTexture( mHorizBlurActor, mRenderTargetForRenderingChildren );
+ SetRendererTexture( mHorizBlurActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
// Create offscreen buffer for vert blur pass
mRenderTarget1 = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
mRenderTarget1.AttachColorTexture( texture );
// use the completed blur in the first buffer and composite with the original child actors render
- SetTexture( mCompositingActor, mRenderTarget1 );
+ SetRendererTexture( mCompositingActor.GetRendererAt(0), mRenderTarget1 );
// set up target actor for rendering result, i.e. the blurred image
- SetTexture( mTargetActor, mRenderTargetForRenderingChildren );
+ SetRendererTexture( mTargetActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
}
// Create offscreen buffer for horiz blur pass
// size needs to match render target
mVertBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight);
- SetTexture( mVertBlurActor, mRenderTarget2 );
+ SetRendererTexture( mVertBlurActor.GetRendererAt(0), mRenderTarget2 );
// set gaussian blur up for new sized render targets
SetShaderConstants();
}
-PageTurnLandscapeView::PageTurnLandscapeView( PageFactory& pageFactory, const Vector2& pageSize )
-: PageTurnView( pageFactory, pageSize )
+PageTurnLandscapeView::PageTurnLandscapeView( PageFactory& pageFactory, const Vector2& viewPageSize )
+: PageTurnView( pageFactory, viewPageSize )
{
}
PageTurnLandscapeView::~PageTurnLandscapeView()
{}
-Toolkit::PageTurnLandscapeView PageTurnLandscapeView::New( PageFactory& pageFactory, const Vector2& pageSize )
+Toolkit::PageTurnLandscapeView PageTurnLandscapeView::New( PageFactory& pageFactory, const Vector2& viewPageSize )
{
// Create the implementation, temporarily owned on stack
- IntrusivePtr< PageTurnLandscapeView > internalPageTurnView = new PageTurnLandscapeView( pageFactory, pageSize );
+ IntrusivePtr< PageTurnLandscapeView > internalPageTurnView = new PageTurnLandscapeView( pageFactory, viewPageSize );
// Pass ownership to CustomActor
Dali::Toolkit::PageTurnLandscapeView pageTurnView( *internalPageTurnView );
/**
* @copydoc Toolkit::PageTurnLandscapeView::New( PageFactory&, const Vector2& )
*/
- static Toolkit::PageTurnLandscapeView New( PageFactory& pageFactory, const Vector2& pageSize );
+ static Toolkit::PageTurnLandscapeView New( PageFactory& pageFactory, const Vector2& viewPageSize );
protected:
/**
* Constructor.
* It initializes the PageTurnPortraitView members
* @param[in] pageFactory The factory which provides image to PageTurnView as the page content.
- * @param[in] pageSize The size of the page
+ * @param[in] viewPageSize The size of the page
*/
- PageTurnLandscapeView( PageFactory& pageFactory, const Vector2& pageSize );
+ PageTurnLandscapeView( PageFactory& pageFactory, const Vector2& viewPageSize );
/**
* A reference counted object may only be deleted by calling Unreference()
}
-PageTurnPortraitView::PageTurnPortraitView( PageFactory& pageFactory, const Vector2& pageSize )
-: PageTurnView( pageFactory, pageSize )
+PageTurnPortraitView::PageTurnPortraitView( PageFactory& pageFactory, const Vector2& viewPageSize )
+: PageTurnView( pageFactory, viewPageSize )
{
}
{
}
-Toolkit::PageTurnPortraitView PageTurnPortraitView::New( PageFactory& pageFactory, const Vector2& pageSize )
+Toolkit::PageTurnPortraitView PageTurnPortraitView::New( PageFactory& pageFactory, const Vector2& viewPageSize )
{
// Create the implementation, temporarily owned on stack
- IntrusivePtr< PageTurnPortraitView > internalPageTurnView = new PageTurnPortraitView( pageFactory, pageSize );
+ IntrusivePtr< PageTurnPortraitView > internalPageTurnView = new PageTurnPortraitView( pageFactory, viewPageSize );
// Pass ownership to CustomActor
Dali::Toolkit::PageTurnPortraitView pageTurnView( *internalPageTurnView );
/**
* @copydoc Toolkit::PageTurnPortraitView::New( PageFactory&, const Vector2& )
*/
- static Toolkit::PageTurnPortraitView New( PageFactory& pageFactory, const Vector2& pageSize );
+ static Toolkit::PageTurnPortraitView New( PageFactory& pageFactory, const Vector2& viewPageSize );
protected:
* Constructor.
* It initializes the PageTurnPortraitView members
* @param[in] pageFactory The factory which provides image to PageTurnView as the page content.
- * @param[in] pageSize The size of the page
+ * @param[in] viewPageSize The size of the page
*/
- PageTurnPortraitView( PageFactory& pageFactory, const Vector2& pageSize );
+ PageTurnPortraitView( PageFactory& pageFactory, const Vector2& viewPageSize );
/**
* A reference counted object may only be deleted by calling Unreference()
// default grid density for page turn effect, 20 pixels by 20 pixels
const float DEFAULT_GRID_DENSITY(20.0f);
-// to bent the page, the minimal horizontal pan start position is pageSize.x * MINIMUM_START_POSITION_RATIO
+// to bent the page, the minimal horizontal pan start position is viewPageSize.x * MINIMUM_START_POSITION_RATIO
const float MINIMUM_START_POSITION_RATIO(0.6f);
-// the maximum vertical displacement of pan gesture, if exceed, will reduce it: pageSize.y * MAXIMUM_VERTICAL_MOVEMENT_RATIO
+// the maximum vertical displacement of pan gesture, if exceed, will reduce it: viewPageSize.y * MAXIMUM_VERTICAL_MOVEMENT_RATIO
const float MAXIMUM_VERTICAL_MOVEMENT_RATIO(0.15f);
-// when the x component of pan position reaches pageSize.x * PAGE_TURN_OVER_THRESHOLD_RATIO, page starts to turn over
+// when the x component of pan position reaches viewPageSize.x * PAGE_TURN_OVER_THRESHOLD_RATIO, page starts to turn over
const float PAGE_TURN_OVER_THRESHOLD_RATIO(0.5f);
// duration of animation, shorter for faster speed
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::PageTurnView, Toolkit::Control, Create );
-DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "pageSize", VECTOR2, PAGE_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "viewPageSize", VECTOR2, VIEW_PAGE_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "currentPageId", INTEGER, CURRENT_PAGE_ID )
DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "spineShadow", VECTOR2, SPINE_SHADOW )
actor.SetProperty( propertyCurrentCenter, value );
}
-PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize )
+PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& viewPageSize )
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mPageFactory( &pageFactory ),
- mPageSize( pageSize ),
+ mPageSize( viewPageSize ),
mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
mDistanceUpCorner( 0.f ),
mDistanceBottomCorner( 0.f ),
Control::OnStageDisconnection();
}
-void PageTurnView::SetPageSize( const Vector2& pageSize )
+void PageTurnView::SetPageSize( const Vector2& viewPageSize )
{
- mPageSize = pageSize;
+ mPageSize = viewPageSize;
if( mPointLight )
{
switch( index )
{
- case Toolkit::PageTurnView::Property::PAGE_SIZE:
+ case Toolkit::PageTurnView::Property::VIEW_PAGE_SIZE:
{
pageTurnViewImpl.SetPageSize( value.Get<Vector2>() );
break;
switch( index )
{
- case Toolkit::PageTurnView::Property::PAGE_SIZE:
+ case Toolkit::PageTurnView::Property::VIEW_PAGE_SIZE:
{
value = pageTurnViewImpl.GetPageSize();
break;
* Constructor.
* It initializes the PageTurnView members
*/
- PageTurnView( PageFactory& pageFactory, const Vector2& pageSize );
+ PageTurnView( PageFactory& pageFactory, const Vector2& viewPageSize );
/**
* A reference counted object may only be deleted by calling Unreference()
/**
* Set the page size
- * @param[in] pageSize The size of pages
+ * @param[in] viewPageSize The size of pages
*/
- void SetPageSize( const Vector2& pageSize );
+ void SetPageSize( const Vector2& viewPageSize );
/**
* Retrieve the page size.
// Note: A further 1.0f is subtracted to handle a compensation that happens later within the flick handling code in SnapWithVelocity().
// When a flick is completed, an adjustment of 1.0f is sometimes made to allow for the scenario where:
// A flick finishes before the update thread has advanced the scroll position past the previous snap point.
- Vector2 pageSizeLimit( size.x - ( 1.0f + 1.0f ), size.y - ( 1.0f - 1.0f ) );
- Vector2 minPosition( mStartPosition.x - pageSizeLimit.x, mStartPosition.y - pageSizeLimit.y );
- Vector2 maxPosition( mStartPosition.x + pageSizeLimit.x, mStartPosition.y + pageSizeLimit.y );
+ Vector2 viewPageSizeLimit( size.x - ( 1.0f + 1.0f ), size.y - ( 1.0f - 1.0f ) );
+ Vector2 minPosition( mStartPosition.x - viewPageSizeLimit.x, mStartPosition.y - viewPageSizeLimit.y );
+ Vector2 maxPosition( mStartPosition.x + viewPageSizeLimit.x, mStartPosition.y + viewPageSizeLimit.y );
if( mFixedRulerX )
{
namespace Internal
{
-ScrollViewPagePathEffect::ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount)
-:mPageSize(pageSize),
+ScrollViewPagePathEffect::ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount)
+:mPageSize(viewPageSize),
mInputPropertyIndex(inputPropertyIndex),
mPageCount(pageCount)
{
* @param[in] path Pages will follow this path
* @param[in] forward Vector in page local space which will be aligned with tangent of the path
* @param[in] inputPropertyIndex index of the property in the scrollview used to drivce the path
- * @param[in] pageSize size of a page in the scrollview
+ * @param[in] viewPageSize size of a page in the scrollview
* @param[in] pageCount total number of pages in the scrollview
*/
- ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount );
+ ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount );
public:
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
{
mShadowPlaneBg = shadowPlaneBackground;
- mShadowPlane = Toolkit::ImageView::New( mOutputImage );
+ mShadowPlane = Actor::New();
mShadowPlane.SetName( "SHADOW_PLANE" );
- mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
- mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);
+ mShadowPlane.SetParentOrigin( ParentOrigin::CENTER );
+ mShadowPlane.SetAnchorPoint( AnchorPoint::CENTER );
+ Renderer shadowRenderer = CreateRenderer( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE, Shader::Hint::OUTPUT_IS_TRANSPARENT, Uint16Pair(20,20) );
+ TextureSet textureSet = shadowRenderer.GetTextures();
+ textureSet.SetTexture( 0u, mOutputFrameBuffer.GetColorTexture() );
+ mShadowPlane.AddRenderer( shadowRenderer );
- mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowVisualMap );
SetShaderConstants();
// Rather than parent the shadow plane drawable and have constraints to move it to the same
// position, instead parent the shadow plane drawable on the shadow plane passed in.
- mShadowPlaneBg.Add(mShadowPlane);
- mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
- mShadowPlane.SetZ(1.0f);
+ mShadowPlaneBg.Add( mShadowPlane );
+ mShadowPlane.SetParentOrigin( ParentOrigin::CENTER );
+ mShadowPlane.SetZ( 1.0f );
ConstrainCamera();
mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS);
mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
-
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = RENDER_SHADOW_VERTEX_SOURCE;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = RENDER_SHADOW_FRAGMENT_SOURCE;
-
- customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
- customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
-
- customShader[ Toolkit::Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
-
- mShadowVisualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
-
// Create render targets needed for rendering from light's point of view
- mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );
+ mSceneFromLightRenderTarget = FrameBuffer::New( stageSize.width, stageSize.height, FrameBuffer::Attachment::NONE );
+ Texture textureFromLight = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(stageSize.width), unsigned(stageSize.height) );
+ mSceneFromLightRenderTarget.AttachColorTexture( textureFromLight );
- mOutputImage = FrameBufferImage::New( stageSize.width * 0.5f, stageSize.height * 0.5f, Pixel::RGBA8888 );
+ mOutputFrameBuffer = FrameBuffer::New( stageSize.width * 0.5f, stageSize.height * 0.5f, FrameBuffer::Attachment::NONE );
+ Texture outputTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(stageSize.width * 0.5f), unsigned(stageSize.height * 0.5f) );
+ mOutputFrameBuffer.AttachColorTexture( outputTexture );
//////////////////////////////////////////////////////
// Connect to actor tree
Self().Add( mChildrenRoot );
Stage::GetCurrent().Add( mCameraActor );
- mBlurFilter.SetRefreshOnDemand(false);
- mBlurFilter.SetInputImage(mSceneFromLightRenderTarget);
- mBlurFilter.SetOutputImage(mOutputImage);
- mBlurFilter.SetSize(stageSize * 0.5f);
- mBlurFilter.SetPixelFormat(Pixel::RGBA8888);
+ mBlurFilter.SetRefreshOnDemand( false );
+ mBlurFilter.SetInputTexture( mSceneFromLightRenderTarget.GetColorTexture() );
+ mBlurFilter.SetOutputFrameBuffer( mOutputFrameBuffer );
+ mBlurFilter.SetSize( stageSize * 0.5f );
+ mBlurFilter.SetPixelFormat( Pixel::RGBA8888 );
mBlurRootActor = Actor::New();
mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" );
// Turn off inheritance to ensure filter renders properly
mBlurRootActor.SetParentOrigin( ParentOrigin::CENTER );
- mBlurRootActor.SetInheritPosition(false);
- mBlurRootActor.SetInheritOrientation(false);
- mBlurRootActor.SetInheritScale(false);
- mBlurRootActor.SetColorMode(USE_OWN_COLOR);
+ mBlurRootActor.SetInheritPosition( false );
+ mBlurRootActor.SetInheritOrientation( false );
+ mBlurRootActor.SetInheritScale( false );
+ mBlurRootActor.SetColorMode( USE_OWN_COLOR );
- Self().Add(mBlurRootActor);
+ Self().Add( mBlurRootActor );
mBlurFilter.SetRootActor(mBlurRootActor);
mBlurFilter.SetBackgroundColor(Vector4::ZERO);
mRenderSceneTask.SetCameraActor( mCameraActor );
mRenderSceneTask.SetSourceActor( mChildrenRoot );
- mRenderSceneTask.SetTargetFrameBuffer( mSceneFromLightRenderTarget );
+ mRenderSceneTask.SetFrameBuffer( mSceneFromLightRenderTarget );
mRenderSceneTask.SetInputEnabled( false );
mRenderSceneTask.SetClearEnabled( true );
void CreateBlurFilter();
private:
- Toolkit::ImageView mShadowPlane; // Shadow renders into this actor
+ Actor mShadowPlane; // Shadow renders into this actor
Actor mShadowPlaneBg; // mShadowPlane renders directly in front of this actor
Actor mPointLight; // Shadow is cast from this point light
/////////////////////////////////////////////////////////////
- FrameBufferImage mSceneFromLightRenderTarget; // for rendering normal scene seen from light to texture instead of the screen
+ FrameBuffer mSceneFromLightRenderTarget; // for rendering normal scene seen from light to texture instead of the screen
- FrameBufferImage mOutputImage;
+ FrameBuffer mOutputFrameBuffer;
Actor mChildrenRoot; // Subtree for all user added child actors that should be rendered normally
Actor mBlurRootActor; // Root actor for blur filter processing
// INTERNAL_INCLUDES
#include <dali-toolkit/public-api/image-loader/sync-image-loader.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
Vector2 mRange;
};
-#define DALI_COMPOSE_SHADER(STR) #STR
-
-const char * const BASIC_VERTEX_SOURCE = DALI_COMPOSE_SHADER(
- precision mediump float;\n
- attribute mediump vec2 aPosition;\n
- attribute mediump vec2 aTexture;\n
- varying mediump vec2 vTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- \n
- void main()\n
- {\n
- mediump vec4 vertexPosition = vec4(aPosition * uSize.xy, 0.0, 1.0);\n
- vTexCoord = aTexture;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
- }\n
-);
-
-const char * const BASIC_FRAGMENT_SOURCE = DALI_COMPOSE_SHADER(
- precision mediump float;\n
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- uniform vec4 uColor;\n
- \n
- void main()\n
- {\n
- gl_FragColor = texture2D(sTexture, vTexCoord);\n
- gl_FragColor *= uColor;
- }\n
-);
-
-Renderer CreateRenderer( const char* vertexSrc, const char* fragmentSrc )
-{
- Shader shader = Shader::New( vertexSrc, fragmentSrc );
-
- Geometry texturedQuadGeometry = Geometry::New();
-
- struct VertexPosition { Vector2 position; };
- struct VertexTexture { Vector2 texture; };
-
- VertexPosition positionArray[] =
- {
- { Vector2( -0.5f, -0.5f ) },
- { Vector2( 0.5f, -0.5f ) },
- { Vector2( -0.5f, 0.5f ) },
- { Vector2( 0.5f, 0.5f ) }
- };
- uint32_t numberOfVertices = sizeof(positionArray)/sizeof(VertexPosition);
-
- VertexTexture uvArray[] =
- {
- { Vector2( 0.0f, 0.0f ) },
- { Vector2( 1.0f, 0.0f ) },
- { Vector2( 0.0f, 1.0f ) },
- { Vector2( 1.0f, 1.0f ) }
- };
-
- Property::Map positionVertexFormat;
- positionVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
- positionVertices.SetData( positionArray, numberOfVertices );
- texturedQuadGeometry.AddVertexBuffer( positionVertices );
-
- Property::Map textureVertexFormat;
- textureVertexFormat["aTexture"] = Property::VECTOR2;
- PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
- textureVertices.SetData( uvArray, numberOfVertices );
- texturedQuadGeometry.AddVertexBuffer( textureVertices );
-
- const uint16_t indices[] = { 0, 3, 1, 0, 2, 3 };
- texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
-
- Renderer renderer = Renderer::New( texturedQuadGeometry, shader );
-
- TextureSet textureSet = TextureSet::New();
- renderer.SetTextures( textureSet );
-
- return renderer;
-}
-
-void SetRendererTexture( Renderer& renderer, Texture& texture )
-{
- if( renderer )
- {
- TextureSet textureSet = renderer.GetTextures();
- textureSet.SetTexture( 0u, texture );
- }
-}
-
-void SetRendererTexture( Renderer& renderer, FrameBuffer& frameBuffer )
-{
- if( frameBuffer )
- {
- Texture texture = frameBuffer.GetColorTexture();
- SetRendererTexture( renderer, texture );
- }
-}
-
} // namespace
namespace Dali
#include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
// EXTERNAL INCLUDES
+#if defined(__GLIBC__)
#include <libintl.h>
+#endif
#include <string.h>
#include <cfloat>
#include <dali/public-api/animation/animation.h>
namespace
{
-
+#if defined(__GLIBC__)
#define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
+#endif
const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "TextSelectionPopupButton" );
const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR( Dali::Vector4( 0.24f, 0.72f, 0.8f, 1.0f ) );
// Whether to mirror the list of buttons (for right to left languages)
bool mirror = false;
+#if defined(__GLIBC__)
char* idsLtr = GET_LOCALE_TEXT( IDS_LTR.c_str() );
if( NULL != idsLtr )
{
std::reverse( mOrderListOfButtons.begin(), mOrderListOfButtons.end() );
}
}
+#endif
// Iterate list of buttons and add active ones to Toolbar
std::size_t numberOfOptionsRequired = GetNumberOfEnabledOptions();
$(toolkit_src_dir)/controls/buttons/toggle-button-impl.cpp \
$(toolkit_src_dir)/controls/control/control-data-impl.cpp \
$(toolkit_src_dir)/controls/control/control-debug.cpp \
+ $(toolkit_src_dir)/controls/control/control-renderers.cpp \
$(toolkit_src_dir)/controls/effects-view/effects-view-impl.cpp \
$(toolkit_src_dir)/controls/flex-container/flex-container-impl.cpp \
$(toolkit_src_dir)/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp \
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
-#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
namespace Dali
{
{
// create blending actor and register the property in constructor
// to make sure that GetBlurStrengthPropertyIndex() always returns a valid index
- mActorForBlending = Toolkit::ImageView::New();
+ mActorForBlending = Actor::New();
mBlurStrengthPropertyIndex = mActorForBlending.RegisterProperty( BLUR_STRENGTH_UNIFORM_NAME, 1.f );
}
void BlurTwoPassFilter::Enable()
{
+ // create custom shader effect
+ if( !GetKernelSize() )
+ {
+ CreateKernel( DEFAULT_KERNEL4, sizeof(DEFAULT_KERNEL4)/sizeof(DEFAULT_KERNEL4[0]) );
+ }
+ int kernelSize( static_cast< int >(GetKernelSize()) );
+
+ // Set up blur-two-pass custom shader
+ std::ostringstream sstream;
+ sstream << "#define NUM_SAMPLES " << kernelSize << "\n";
+ sstream << BLUR_TWO_PASS_FRAGMENT_SOURCE;
+ std::string fragmentSource( sstream.str() );
+
// create actor to render input with applied emboss effect
- mActorForInput = Toolkit::ImageView::New( mInputImage );
+ mActorForInput = Actor::New();
mActorForInput.SetParentOrigin( ParentOrigin::CENTER );
mActorForInput.SetSize( mTargetSize );
+ Renderer rendererForInput = CreateRenderer( BASIC_VERTEX_SOURCE, fragmentSource.c_str() );
+ SetRendererTexture( rendererForInput, mInputTexture );
+ mActorForInput.AddRenderer( rendererForInput );
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mFrameBufferForHorz = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture textureForHorz = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferForHorz.AttachColorTexture( textureForHorz );
+
// create an actor to render mImageForHorz for vertical blur pass
- mActorForHorz = Toolkit::ImageView::New( mImageForHorz );
+ mActorForHorz = Actor::New();
mActorForHorz.SetParentOrigin( ParentOrigin::CENTER );
mActorForHorz.SetSize( mTargetSize );
+ Renderer rendererForHorz = CreateRenderer( BASIC_VERTEX_SOURCE, fragmentSource.c_str() );
+ SetRendererTexture( rendererForHorz, textureForHorz );
+ mActorForHorz.AddRenderer( rendererForHorz );
// create internal offscreen for result of the two pass blurred image
- mBlurredImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mBlurredFrameBuffer = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture blurredTexture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mBlurredFrameBuffer.AttachColorTexture( blurredTexture );
+
// create an actor to blend the blurred image and the input image with the given blur strength
- mActorForBlending.SetImage( mBlurredImage );
+ Renderer rendererForBlending = CreateRenderer( BASIC_VERTEX_SOURCE, BLEND_TWO_IMAGES_FRAGMENT_SOURCE );
+ TextureSet textureSetForBlending = rendererForBlending.GetTextures();
+ textureSetForBlending.SetTexture( 0u, blurredTexture );
+ textureSetForBlending.SetTexture( 1u, mInputTexture );
+ mActorForBlending.AddRenderer( rendererForBlending );
mActorForBlending.SetParentOrigin( ParentOrigin::CENTER );
mActorForBlending.SetSize( mTargetSize );
- // create custom shader effect
- if( !GetKernelSize() )
- {
- CreateKernel( DEFAULT_KERNEL4, sizeof(DEFAULT_KERNEL4)/sizeof(DEFAULT_KERNEL4[0]) );
- }
- int kernelSize( static_cast< int >(GetKernelSize()) );
-
for( int i = 0; i < kernelSize; ++i )
{
const std::string offsetUniform( GetOffsetUniformName( i ) );
mActorForHorz.RegisterProperty( weightUniform, mKernel[i].z );
}
- // Set up blur-two-pass custom shader
- std::ostringstream fragmentSource;
- fragmentSource << "#define NUM_SAMPLES " << kernelSize << "\n";
- fragmentSource << BLUR_TWO_PASS_FRAGMENT_SOURCE;
-
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource.str();
- Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
- mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
- mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
-
- // Set up blend-two-image custom shader
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLEND_TWO_IMAGES_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
- mActorForBlending.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
-
mRootActor.Add( mActorForInput );
mRootActor.Add( mActorForHorz );
mRootActor.Add( mActorForBlending );
- // Add effect texture to blend-two-image custom shader
- TextureSet textureSet = mActorForBlending.GetRendererAt(0).GetTextures();
- if( textureSet )
- {
- TextureSetImage( textureSet, 1u, mInputImage );
- }
-
SetupCamera();
CreateRenderTasks();
}
mRenderTaskForHorz.SetInputEnabled( false );
mRenderTaskForHorz.SetClearEnabled( true );
mRenderTaskForHorz.SetClearColor( mBackgroundColor );
- mRenderTaskForHorz.SetTargetFrameBuffer( mImageForHorz );
+ mRenderTaskForHorz.SetFrameBuffer( mFrameBufferForHorz );
mRenderTaskForHorz.SetCameraActor( mCameraActor );
// use the internal buffer and perform a horizontal blur targeting the output buffer
mRenderTaskForVert.SetInputEnabled( false );
mRenderTaskForVert.SetClearEnabled( true );
mRenderTaskForVert.SetClearColor( mBackgroundColor );
- mRenderTaskForVert.SetTargetFrameBuffer( mBlurredImage );
+ mRenderTaskForVert.SetFrameBuffer( mBlurredFrameBuffer );
mRenderTaskForVert.SetCameraActor( mCameraActor );
//Perform a blending between the blurred image and the input image
mRenderTaskForBlending.SetInputEnabled( false );
mRenderTaskForBlending.SetClearEnabled( true );
mRenderTaskForBlending.SetClearColor( mBackgroundColor );
- mRenderTaskForBlending.SetTargetFrameBuffer( mOutputImage );
+ mRenderTaskForBlending.SetFrameBuffer( mOutputFrameBuffer );
mRenderTaskForBlending.SetCameraActor( mCameraActor );
}
// EXTERNAL INCLUDES
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
// INTERNAL INCLUDES
#include "image-filter.h"
private: // Attributes
- // To perform horizontal blur from mInputImage to mImageForHorz
+ // To perform horizontal blur from mInputTexture to mFrameBufferForHorz
RenderTask mRenderTaskForHorz;
- Toolkit::ImageView mActorForInput;
- FrameBufferImage mImageForHorz;
+ Actor mActorForInput;
+ FrameBuffer mFrameBufferForHorz;
- // To perform vertical blur from mImageForHorz to mOutputImage
+ // To perform vertical blur from mFrameBufferForHorz to mOutputFrameBuffer
RenderTask mRenderTaskForVert;
- Toolkit::ImageView mActorForHorz;
- FrameBufferImage mBlurredImage;
+ Actor mActorForHorz;
+ FrameBuffer mBlurredFrameBuffer;
// To blend the blurred image and input image according to the blur strength
RenderTask mRenderTaskForBlending;
- Toolkit::ImageView mActorForBlending;
+ Actor mActorForBlending;
Actor mRootActorForBlending;
Property::Index mBlurStrengthPropertyIndex;
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
-#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
namespace Dali
{
void EmbossFilter::Enable()
{
- mImageForEmboss1 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
- mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mFrameBufferForEmboss1 = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture texture1 = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferForEmboss1.AttachColorTexture( texture1 );
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EMBOSS_FRAGMENT_SOURCE;
- Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ mFrameBufferForEmboss2 = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture texture2 = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferForEmboss2.AttachColorTexture( texture2 );
// create actor to render input with applied emboss effect
- mActorForInput1 = Toolkit::ImageView::New(mInputImage);
+ mActorForInput1 = Actor::New();
mActorForInput1.SetParentOrigin( ParentOrigin::CENTER );
mActorForInput1.SetSize(mTargetSize);
Vector2 textureScale( 1.5f/mTargetSize.width, 1.5f/mTargetSize.height);
mActorForInput1.RegisterProperty( TEX_SCALE_UNIFORM_NAME, textureScale );
mActorForInput1.RegisterProperty( COEFFICIENT_UNIFORM_NAME, Vector3( 2.f, -1.f, -1.f ) );
// set EMBOSS custom shader
- mActorForInput1.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ Renderer renderer1 = CreateRenderer( BASIC_VERTEX_SOURCE, EMBOSS_FRAGMENT_SOURCE );
+ SetRendererTexture( renderer1, mInputTexture );
+ mActorForInput1.AddRenderer( renderer1 );
mRootActor.Add( mActorForInput1 );
- mActorForInput2 = Toolkit::ImageView::New(mInputImage);
+ mActorForInput2 = Actor::New();
mActorForInput2.SetParentOrigin( ParentOrigin::CENTER );
mActorForInput2.SetSize(mTargetSize);
mActorForInput2.RegisterProperty( TEX_SCALE_UNIFORM_NAME, textureScale );
mActorForInput2.RegisterProperty( COEFFICIENT_UNIFORM_NAME, Vector3( -1.f, -1.f, 2.f ) );
// set EMBOSS custom shader
- mActorForInput2.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ Renderer renderer2 = CreateRenderer( BASIC_VERTEX_SOURCE, EMBOSS_FRAGMENT_SOURCE );
+ SetRendererTexture( renderer2, mInputTexture );
+ mActorForInput2.AddRenderer( renderer2 );
mRootActor.Add( mActorForInput2 );
mActorForComposite = Actor::New();
mActorForComposite.SetSize(mTargetSize);
mActorForComposite.SetColor( Color::BLACK );
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
-
mRootActor.Add( mActorForComposite );
- Internal::InitializeVisual( mActorForComposite, mVisualForEmboss1, mImageForEmboss1 );
- Toolkit::GetImplementation( mVisualForEmboss1 ).SetCustomShader( customShader );
- mActorForComposite.GetRendererAt(0).RegisterProperty( COLOR_UNIFORM_NAME, Color::BLACK );
- Internal::InitializeVisual( mActorForComposite, mVisualForEmboss2, mImageForEmboss2 );
- Toolkit::GetImplementation( mVisualForEmboss2 ).SetCustomShader( customShader );
- mActorForComposite.GetRendererAt(1).RegisterProperty( COLOR_UNIFORM_NAME, Color::WHITE );
+ mRendererForEmboss1 = CreateRenderer( BASIC_VERTEX_SOURCE, COMPOSITE_FRAGMENT_SOURCE );
+ SetRendererTexture( mRendererForEmboss1, mFrameBufferForEmboss1 );
+ mRendererForEmboss1.RegisterProperty( COLOR_UNIFORM_NAME, Color::BLACK );
+ mActorForComposite.AddRenderer( mRendererForEmboss1 );
+
+ mRendererForEmboss2 = CreateRenderer( BASIC_VERTEX_SOURCE, COMPOSITE_FRAGMENT_SOURCE );
+ SetRendererTexture( mRendererForEmboss2, mFrameBufferForEmboss2 );
+ mRendererForEmboss2.RegisterProperty( COLOR_UNIFORM_NAME, Color::WHITE );
+ mActorForComposite.AddRenderer( mRendererForEmboss2 );
SetupCamera();
CreateRenderTasks();
if( mActorForComposite )
{
- Toolkit::GetImplementation(mVisualForEmboss1).SetOffStage( mActorForComposite );
- Toolkit::GetImplementation(mVisualForEmboss2).SetOffStage( mActorForComposite );
- mVisualForEmboss1.Reset();
- mVisualForEmboss2.Reset();
+ mActorForComposite.RemoveRenderer( mRendererForEmboss1 );
+ mRendererForEmboss1.Reset();
+
+ mActorForComposite.RemoveRenderer( mRendererForEmboss2 );
+ mRendererForEmboss2.Reset();
+
mRootActor.Remove( mActorForComposite );
mActorForComposite.Reset();
}
mRenderTaskForEmboss1.SetInputEnabled( false );
mRenderTaskForEmboss1.SetClearColor( Vector4( 0.0f, 0.0f, 0.0f, 0.0f ) );
mRenderTaskForEmboss1.SetClearEnabled( true );
- mRenderTaskForEmboss1.SetTargetFrameBuffer( mImageForEmboss1 );
+ mRenderTaskForEmboss1.SetFrameBuffer( mFrameBufferForEmboss1 );
mRenderTaskForEmboss1.SetCameraActor( mCameraActor );
mRenderTaskForEmboss2 = taskList.CreateTask();
mRenderTaskForEmboss2.SetInputEnabled( false );
mRenderTaskForEmboss2.SetClearColor( Vector4( 1.0f, 1.0f, 1.0f, 0.0f ) );
mRenderTaskForEmboss2.SetClearEnabled( true );
- mRenderTaskForEmboss2.SetTargetFrameBuffer( mImageForEmboss2 );
+ mRenderTaskForEmboss2.SetFrameBuffer( mFrameBufferForEmboss2 );
mRenderTaskForEmboss2.SetCameraActor( mCameraActor );
mRenderTaskForOutput = taskList.CreateTask();
mRenderTaskForOutput.SetInputEnabled( false );
mRenderTaskForOutput.SetClearColor( Vector4( 0.5f, 0.5f, 0.5f, 0.0f ) );
mRenderTaskForOutput.SetClearEnabled( true );
- mRenderTaskForOutput.SetTargetFrameBuffer( mOutputImage );
+ mRenderTaskForOutput.SetFrameBuffer( mOutputFrameBuffer );
mRenderTaskForOutput.SetCameraActor( mCameraActor );
}
// EXTERNAL INCLUDES
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/rendering/renderer.h>
+
+// INTERNAL INCLUDES
#include "image-filter.h"
namespace Dali
RenderTask mRenderTaskForEmboss1;
RenderTask mRenderTaskForEmboss2;
RenderTask mRenderTaskForOutput;
- FrameBufferImage mImageForEmboss1;
- FrameBufferImage mImageForEmboss2;
- Toolkit::ImageView mActorForInput1;
- Toolkit::ImageView mActorForInput2;
- Toolkit::Visual::Base mVisualForEmboss1;
- Toolkit::Visual::Base mVisualForEmboss2;
+ FrameBuffer mFrameBufferForEmboss1;
+ FrameBuffer mFrameBufferForEmboss2;
+ Actor mActorForInput1;
+ Actor mActorForInput2;
+ Renderer mRendererForEmboss1;
+ Renderer mRendererForEmboss2;
Actor mActorForComposite;
}; // class EmbossFilter
mRefreshOnDemand = onDemand;
}
-void ImageFilter::SetInputImage( Image image )
+void ImageFilter::SetInputTexture( Texture texture )
{
- mInputImage = image;
+ mInputTexture = texture;
}
-void ImageFilter::SetOutputImage( FrameBufferImage image )
+void ImageFilter::SetOutputFrameBuffer( FrameBuffer frameBuffer )
{
- mOutputImage = image;
+ mOutputFrameBuffer = frameBuffer;
}
void ImageFilter::SetSize( const Vector2& size )
// EXTERNAL INCLUDES
#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/rendering/texture.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
/**
* An interface class that provides a interface for image filters that perform
- * a simple shader effect on an input image, rendering the output to a FrameBufferImage.
+ * a simple shader effect on an input texture, rendering the output to a FrameBuffer.
*/
class ImageFilter
{
void SetRefreshOnDemand( bool onDemand );
/**
- * Set the input image
- * @param[in] The input/original image.
+ * Set the input texture
+ * @param[in] The input/original texture.
*/
- void SetInputImage( Image image );
+ void SetInputTexture( Texture texture );
/**
- * Set the output image
- * @return The output image.
+ * Set the output frame buffer
+ * @return The output frame buffer.
*/
- void SetOutputImage( FrameBufferImage image );
+ void SetOutputFrameBuffer( FrameBuffer frameBuffer );
/**
* Set size of ImageFilter. Used to create internal offscreen buffers
void SetupCamera();
protected:
- Image mInputImage;
- FrameBufferImage mOutputImage;
+ Texture mInputTexture;
+ FrameBuffer mOutputFrameBuffer;
FilterKernel mKernel;
Actor mRootActor;
CameraActor mCameraActor;
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/controls/control/control-renderers.h>
namespace Dali
{
void SpreadFilter::Enable()
{
// create actor to render input with applied emboss effect
- mActorForInput = Toolkit::ImageView::New( mInputImage );
+ mActorForInput = Actor::New();
mActorForInput.SetParentOrigin( ParentOrigin::CENTER );
mActorForInput.SetSize(mTargetSize);
// register properties as shader uniforms
mActorForInput.RegisterProperty( SPREAD_UNIFORM_NAME, mSpread );
mActorForInput.RegisterProperty( TEX_SCALE_UNIFORM_NAME, Vector2( 1.0f / mTargetSize.width, 0.0f ) );
+ Renderer rendererForInput = CreateRenderer( BASIC_VERTEX_SOURCE, SPREAD_FRAGMENT_SOURCE );
+ SetRendererTexture( rendererForInput, mInputTexture );
+ mActorForInput.AddRenderer( rendererForInput );
+
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mFrameBufferForHorz = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+ Texture textureForHorz = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+ mFrameBufferForHorz.AttachColorTexture( textureForHorz );
+
// create an actor to render mImageForHorz for vertical blur pass
- mActorForHorz = Toolkit::ImageView::New( mImageForHorz );
+ mActorForHorz = Actor::New();
mActorForHorz.SetParentOrigin( ParentOrigin::CENTER );
mActorForHorz.SetSize(mTargetSize);
// register properties as shader uniforms
mActorForHorz.RegisterProperty( SPREAD_UNIFORM_NAME, mSpread );
mActorForHorz.RegisterProperty( TEX_SCALE_UNIFORM_NAME, Vector2( 0.0f, 1.0f / mTargetSize.height ) );
-
- Property::Map customShader;
- customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SPREAD_FRAGMENT_SOURCE;
- Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
-
- // set SPREAD custom shader
- mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
- mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ Renderer rendererForHorz = CreateRenderer( BASIC_VERTEX_SOURCE, SPREAD_FRAGMENT_SOURCE );
+ SetRendererTexture( rendererForHorz, textureForHorz );
+ mActorForHorz.AddRenderer( rendererForHorz );
mRootActor.Add( mActorForInput );
mRootActor.Add( mActorForHorz );
mRenderTaskForHorz.SetInputEnabled( false );
mRenderTaskForHorz.SetClearEnabled( true );
mRenderTaskForHorz.SetClearColor( mBackgroundColor );
- mRenderTaskForHorz.SetTargetFrameBuffer( mImageForHorz );
+ mRenderTaskForHorz.SetFrameBuffer( mFrameBufferForHorz );
mRenderTaskForHorz.SetCameraActor( mCameraActor );
// use the internal buffer and perform a horizontal blur targeting the output buffer
mRenderTaskForVert.SetInputEnabled( false );
mRenderTaskForVert.SetClearEnabled( true );
mRenderTaskForVert.SetClearColor( mBackgroundColor );
- mRenderTaskForVert.SetTargetFrameBuffer( mOutputImage );
+ mRenderTaskForVert.SetFrameBuffer( mOutputFrameBuffer );
mRenderTaskForVert.SetCameraActor( mCameraActor );
}
// EXTERNAL INCLUDES
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
// INTERNAL INCLUDES
#include "image-filter.h"
private: // Attributes
- // To perform horizontal spread from mInputImage to mImageForHorz
+ // To perform horizontal spread from mInputTexture to mFrameBufferForHorz
RenderTask mRenderTaskForHorz;
- Toolkit::ImageView mActorForInput;
- FrameBufferImage mImageForHorz;
+ Actor mActorForInput;
+ FrameBuffer mFrameBufferForHorz;
- // To perform vertical spread from mImageForHorz to mOutputImage
+ // To perform vertical spread from mFrameBufferForHorz to mOutputFrameBuffer
RenderTask mRenderTaskForVert;
- Toolkit::ImageView mActorForHorz;
+ Actor mActorForHorz;
int mSpread;
}; // class SpreadFilter
#include "atlas-packer.h"
// EXTERNAL HEADER
-#include <stdlib.h> // For abs()
+#include <cstdlib> // For abs()
#include <dali/integration-api/debug.h>
namespace Dali
bool ApproximatelyEqual( uint32_t a, uint32_t b )
{
- return abs( a-b ) <= 1;
+ return std::abs( static_cast<int32_t>( a - b ) ) <= 1;
}
uint16_t MaxDimension( const Uint16Pair& dimensions )
// EXTERNAL INCLUDES
#include <limits>
+#include <cmath>
#include <dali/integration-api/debug.h>
#include <dali/devel-api/text-abstraction/font-client.h>
const GlyphInfo& glyph = *( glyphsBuffer + i );
Vector2& position = *( glyphPositionsBuffer + i );
- position.x = std::round( penX + glyph.xBearing );
+ position.x = std::roundf( penX + glyph.xBearing );
position.y = -glyph.yBearing;
penX += ( glyph.advance + interGlyphExtraAdvance );
// EXTERNAL INCLUDES
#include <limits>
+#include <cmath>
#include <memory.h>
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/integration-api/debug.h>
bool Controller::SetDefaultLineSpacing( float lineSpacing )
{
- if( std::abs(lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing()) > Math::MACHINE_EPSILON_1000 )
+ if( std::fabs( lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing() ) > Math::MACHINE_EPSILON_1000 )
{
mImpl->mLayoutEngine.SetDefaultLineSpacing(lineSpacing);
mImpl->mRecalculateNaturalSize = true;
namespace Toolkit
{
-ScrollViewPagePathEffect ScrollViewPagePathEffect::New(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount)
+ScrollViewPagePathEffect ScrollViewPagePathEffect::New(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount)
{
- return ScrollViewPagePathEffect(new Internal::ScrollViewPagePathEffect(path, forward, inputPropertyIndex, pageSize,pageCount));
+ return ScrollViewPagePathEffect(new Internal::ScrollViewPagePathEffect(path, forward, inputPropertyIndex, viewPageSize,pageCount));
}
ScrollViewPagePathEffect::ScrollViewPagePathEffect()
* @param[in] path The path that will be used by the scroll effect
* @param[in] forward Vector in page object space which will be aligned with the tangent of the path
* @param[in] inputPropertyIndex Index of a property of the scroll-view which will be used as the input for the path
- * @param[in] pageSize Size of a page in the scrollview
+ * @param[in] viewPageSize Size of a page in the scrollview
* @param[in] pageCount Total number of pages in the scrollview
* @return A handle to a newly allocated Dali resource
*/
- static ScrollViewPagePathEffect New(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount);
+ static ScrollViewPagePathEffect New(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& viewPageSize, unsigned int pageCount);
/**
* @brief Creates an uninitialized ScrollViewPagePathEffect; this can be initialized with ScrollViewPagePathEffect::New().
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 28;
+const unsigned int TOOLKIT_MICRO_VERSION = 29;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
$(third_party_src_dir)/nanosvg/nanosvg.cc \
$(third_party_src_dir)/nanosvg/nanosvgrast.cc \
$(third_party_src_dir)/yoga/Utils.cpp \
- $(third_party_src_dir)/yoga/YGConfig.cpp \
+ $(third_party_src_dir)/yoga/YGConfig.cpp \
$(third_party_src_dir)/yoga/YGEnums.cpp \
$(third_party_src_dir)/yoga/YGFloatOptional.cpp \
$(third_party_src_dir)/yoga/YGLayout.cpp \
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.28
+Version: 1.4.29
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT