/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/render-tasks/render-task.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/public-api/common/constants.h>
+#include <dali/public-api/rendering/frame-buffer.h>
namespace Dali
{
-
-static bool DefaultScreenToFrameBufferFunction( Vector2& coordinates )
+static bool DefaultScreenToFrameBufferFunction(Vector2& coordinates)
{
return false;
}
-static bool FullScreenFrameBufferFunction( Vector2& coordinates )
+static bool FullScreenFrameBufferFunction(Vector2& coordinates)
{
// Don't need to modify frameBufferCoords
return true;
RenderTask::ConstScreenToFrameBufferFunction RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION = DefaultScreenToFrameBufferFunction;
RenderTask::ConstScreenToFrameBufferFunction RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION = FullScreenFrameBufferFunction;
-const bool RenderTask::DEFAULT_EXCLUSIVE = false;
-const bool RenderTask::DEFAULT_INPUT_ENABLED = true;
-const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
-const bool RenderTask::DEFAULT_CLEAR_ENABLED = false;
-const bool RenderTask::DEFAULT_CULL_MODE = true;
-const unsigned int RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
+const bool RenderTask::DEFAULT_EXCLUSIVE = false;
+const bool RenderTask::DEFAULT_INPUT_ENABLED = true;
+const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4(0.0f, 0.0f, 0.0f, 1.0f); // cannot use Color::Black because it may or may not be initialized yet
+const bool RenderTask::DEFAULT_CLEAR_ENABLED = false;
+const bool RenderTask::DEFAULT_CULL_MODE = true;
+const uint32_t RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
-RenderTask::RenderTask()
-{
-}
+RenderTask::RenderTask() = default;
-RenderTask RenderTask::DownCast( BaseHandle handle )
+RenderTask RenderTask::DownCast(BaseHandle handle)
{
- return RenderTask( dynamic_cast<Dali::Internal::RenderTask*>( handle.GetObjectPtr() ) );
+ return RenderTask(dynamic_cast<Dali::Internal::RenderTask*>(handle.GetObjectPtr()));
}
-RenderTask::~RenderTask()
-{
-}
+RenderTask::~RenderTask() = default;
-RenderTask::RenderTask(const RenderTask& handle)
-: Handle(handle)
-{
-}
+RenderTask::RenderTask(const RenderTask& handle) = default;
-RenderTask& RenderTask::operator=(const RenderTask& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+RenderTask& RenderTask::operator=(const RenderTask& rhs) = default;
+
+RenderTask::RenderTask(RenderTask&& rhs) noexcept = default;
+
+RenderTask& RenderTask::operator=(RenderTask&& rhs) noexcept = default;
-void RenderTask::SetSourceActor( Actor actor )
+void RenderTask::SetSourceActor(Actor actor)
{
// NULL handle is allowed
- Internal::Actor* actorImpl( NULL );
- if ( actor )
+ Internal::Actor* actorImpl(nullptr);
+ if(actor)
{
- actorImpl = &GetImplementation( actor );
+ actorImpl = &GetImplementation(actor);
}
- GetImplementation(*this).SetSourceActor( actorImpl );
+ GetImplementation(*this).SetSourceActor(actorImpl);
}
Actor RenderTask::GetSourceActor() const
return Dali::Actor(GetImplementation(*this).GetSourceActor());
}
-void RenderTask::SetExclusive( bool exclusive )
+void RenderTask::SetExclusive(bool exclusive)
{
- GetImplementation(*this).SetExclusive( exclusive );
+ GetImplementation(*this).SetExclusive(exclusive);
}
bool RenderTask::IsExclusive() const
return GetImplementation(*this).IsExclusive();
}
-void RenderTask::SetCameraActor( CameraActor cameraActor )
+void RenderTask::SetCameraActor(CameraActor cameraActor)
{
// NULL handle is allowed
- Internal::CameraActor* actorImpl( NULL );
- if ( cameraActor )
+ Internal::CameraActor* actorImpl(nullptr);
+ if(cameraActor)
{
- actorImpl = &GetImplementation( cameraActor );
+ actorImpl = &GetImplementation(cameraActor);
}
- GetImplementation(*this).SetCameraActor( actorImpl );
+ GetImplementation(*this).SetCameraActor(actorImpl);
}
CameraActor RenderTask::GetCameraActor() const
return Dali::CameraActor(GetImplementation(*this).GetCameraActor());
}
-void RenderTask::SetTargetFrameBuffer( FrameBufferImage frameBuffer )
+void RenderTask::SetFrameBuffer(FrameBuffer frameBuffer)
{
- GetImplementation(*this).SetTargetFrameBuffer( frameBuffer );
+ Internal::FrameBuffer* frameBufferPtr(nullptr);
+ if(frameBuffer)
+ {
+ frameBufferPtr = &GetImplementation(frameBuffer);
+ }
+
+ GetImplementation(*this).SetFrameBuffer(frameBufferPtr);
}
-FrameBufferImage RenderTask::GetTargetFrameBuffer() const
+FrameBuffer RenderTask::GetFrameBuffer() const
{
- return GetImplementation(*this).GetTargetFrameBuffer();
+ Internal::FrameBuffer* frameBufferPtr(GetImplementation(*this).GetFrameBuffer());
+ return FrameBuffer(frameBufferPtr);
}
-void RenderTask::SetFrameBuffer( FrameBuffer frameBuffer )
+void RenderTask::SetScreenToFrameBufferFunction(ScreenToFrameBufferFunction conversionFunction)
{
- GetImplementation(*this).SetFrameBuffer( frameBuffer );
+ GetImplementation(*this).SetScreenToFrameBufferFunction(conversionFunction);
}
-FrameBuffer RenderTask::GetFrameBuffer() const
+RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFunction() const
{
- Internal::FrameBuffer* frameBufferPtr( GetImplementation(*this).GetFrameBuffer() );
- return FrameBuffer( frameBufferPtr );
+ return GetImplementation(*this).GetScreenToFrameBufferFunction();
}
-void RenderTask::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction )
+void RenderTask::SetScreenToFrameBufferMappingActor(Dali::Actor mappingActor)
{
- GetImplementation(*this).SetScreenToFrameBufferFunction( conversionFunction );
+ GetImplementation(*this).SetScreenToFrameBufferMappingActor(mappingActor);
}
-RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFunction() const
+Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
{
- return GetImplementation(*this).GetScreenToFrameBufferFunction();
+ return GetImplementation(*this).GetScreenToFrameBufferMappingActor();
}
-void RenderTask::SetScreenToFrameBufferMappingActor( Dali::Actor mappingActor )
+void RenderTask::SetViewportGuideActor(Actor actor)
{
// NULL handle is allowed
- Internal::Actor* actorImpl( NULL );
- if ( mappingActor )
+ Internal::Actor* actorImpl(nullptr);
+ if(actor)
{
- actorImpl = &GetImplementation( mappingActor );
+ actorImpl = &GetImplementation(actor);
}
- GetImplementation(*this).SetScreenToFrameBufferMappingActor( actorImpl );
+ GetImplementation(*this).SetViewportGuideActor(actorImpl);
}
-Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
+Actor RenderTask::GetViewportGuideActor() const
{
- return Dali::Actor(GetImplementation(*this).GetScreenToFrameBufferMappingActor());
+ return Dali::Actor(GetImplementation(*this).GetViewportGuideActor());
}
-void RenderTask::SetViewportPosition( Vector2 position )
+void RenderTask::ResetViewportGuideActor()
{
- GetImplementation(*this).SetViewportPosition( position );
+ GetImplementation(*this).ResetViewportGuideActor();
+}
+
+void RenderTask::SetViewportPosition(Vector2 position)
+{
+ GetImplementation(*this).SetViewportPosition(position);
}
Vector2 RenderTask::GetCurrentViewportPosition() const
return GetImplementation(*this).GetCurrentViewportPosition();
}
-void RenderTask::SetViewportSize( Vector2 size )
+void RenderTask::SetViewportSize(Vector2 size)
{
- GetImplementation(*this).SetViewportSize( size );
+ GetImplementation(*this).SetViewportSize(size);
}
Vector2 RenderTask::GetCurrentViewportSize() const
return GetImplementation(*this).GetCurrentViewportSize();
}
-void RenderTask::SetViewport( Viewport viewport )
+void RenderTask::SetViewport(Viewport viewport)
{
- GetImplementation(*this).SetViewport( viewport );
+ GetImplementation(*this).SetViewport(viewport);
}
Viewport RenderTask::GetViewport() const
{
Viewport result;
- GetImplementation(*this).GetViewport( result );
+ GetImplementation(*this).GetViewport(result);
return result;
}
-void RenderTask::SetClearColor( const Vector4& color )
+void RenderTask::SetClearColor(const Vector4& color)
{
- GetImplementation(*this).SetClearColor( color );
+ GetImplementation(*this).SetClearColor(color);
}
Vector4 RenderTask::GetClearColor() const
return GetImplementation(*this).GetClearColor();
}
-void RenderTask::SetClearEnabled( bool enabled )
+void RenderTask::SetClearEnabled(bool enabled)
{
- GetImplementation(*this).SetClearEnabled( enabled );
+ GetImplementation(*this).SetClearEnabled(enabled);
}
bool RenderTask::GetClearEnabled() const
return GetImplementation(*this).GetClearEnabled();
}
-void RenderTask::SetCullMode( bool mode )
+void RenderTask::SetCullMode(bool mode)
{
- GetImplementation(*this).SetCullMode( mode );
+ GetImplementation(*this).SetCullMode(mode);
}
bool RenderTask::GetCullMode() const
return GetImplementation(*this).GetCullMode();
}
-void RenderTask::SetRefreshRate( unsigned int refreshRate )
+void RenderTask::SetRefreshRate(uint32_t refreshRate)
{
- GetImplementation(*this).SetRefreshRate( refreshRate );
+ GetImplementation(*this).SetRefreshRate(refreshRate);
}
-unsigned int RenderTask::GetRefreshRate() const
+uint32_t RenderTask::GetRefreshRate() const
{
return GetImplementation(*this).GetRefreshRate();
}
return GetImplementation(*this).FinishedSignal();
}
-void RenderTask::SetInputEnabled( bool enabled )
+void RenderTask::SetInputEnabled(bool enabled)
{
- GetImplementation(*this).SetInputEnabled( enabled );
+ GetImplementation(*this).SetInputEnabled(enabled);
}
bool RenderTask::GetInputEnabled() const
return GetImplementation(*this).GetInputEnabled();
}
-bool RenderTask::WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const
+bool RenderTask::WorldToViewport(const Vector3& position, float& viewportX, float& viewportY) const
{
return GetImplementation(*this).WorldToViewport(position, viewportX, viewportY);
}
-bool RenderTask::ViewportToLocal(Actor actor, float viewportX, float viewportY, float &localX, float &localY) const
+bool RenderTask::ViewportToLocal(Actor actor, float viewportX, float viewportY, float& localX, float& localY) const
{
- if( actor )
+ if(actor)
{
- Internal::Actor* actorImpl( &GetImplementation( actor ) );
- return GetImplementation(*this).ViewportToLocal( actorImpl, viewportX, viewportY, localX, localY );
+ Internal::Actor* actorImpl(&GetImplementation(actor));
+ return GetImplementation(*this).ViewportToLocal(actorImpl, viewportX, viewportY, localX, localY);
}
else
{
}
}
-
-RenderTask::RenderTask( Internal::RenderTask* internal )
+RenderTask::RenderTask(Internal::RenderTask* internal)
: Handle(internal)
{
}