X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Frender-tasks%2Frender-task.cpp;h=cd621e4ad228c4d7c7f23ebff84c62a667f950d5;hb=0b501ba800a263b97d99adf224fc42d0c2aa8b37;hp=971dc101d9864e1c81b9cb26fff757a1182be885;hpb=4db25a3da1c48b1c45b2d73a4aaf4945e7e40ca8;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/render-tasks/render-task.cpp b/dali/public-api/render-tasks/render-task.cpp index 971dc10..cd621e4 100644 --- a/dali/public-api/render-tasks/render-task.cpp +++ b/dali/public-api/render-tasks/render-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 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. @@ -19,71 +19,62 @@ #include // INTERNAL INCLUDES -#include #include #include #include +#include +#include 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; } -const char* const RenderTask::SIGNAL_FINISHED = "finished"; - 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( handle.GetObjectPtr() ) ); + return RenderTask(dynamic_cast(handle.GetObjectPtr())); } -RenderTask::~RenderTask() -{ -} +RenderTask::~RenderTask() = default; -RenderTask::RenderTask(const RenderTask& handle) -: Constrainable(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; -void RenderTask::SetSourceActor( Actor actor ) +RenderTask& RenderTask::operator=(RenderTask&& rhs) noexcept = default; + +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 @@ -91,9 +82,9 @@ 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 @@ -101,16 +92,16 @@ 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 @@ -118,19 +109,26 @@ 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::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction ) +void RenderTask::SetScreenToFrameBufferFunction(ScreenToFrameBufferFunction conversionFunction) { - GetImplementation(*this).SetScreenToFrameBufferFunction( conversionFunction ); + GetImplementation(*this).SetScreenToFrameBufferFunction(conversionFunction); } RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFunction() const @@ -138,26 +136,41 @@ RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFuncti return GetImplementation(*this).GetScreenToFrameBufferFunction(); } -void RenderTask::SetScreenToFrameBufferMappingActor( Dali::Actor mappingActor ) +void RenderTask::SetScreenToFrameBufferMappingActor(Dali::Actor mappingActor) +{ + GetImplementation(*this).SetScreenToFrameBufferMappingActor(mappingActor); +} + +Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const +{ + return GetImplementation(*this).GetScreenToFrameBufferMappingActor(); +} + +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 @@ -165,9 +178,9 @@ 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 @@ -175,21 +188,21 @@ 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 @@ -197,9 +210,9 @@ 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 @@ -207,9 +220,9 @@ 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 @@ -217,24 +230,24 @@ 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(); } -RenderTask::RenderTaskSignalV2& RenderTask::FinishedSignal() +RenderTask::RenderTaskSignalType& RenderTask::FinishedSignal() { 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 @@ -242,8 +255,26 @@ bool RenderTask::GetInputEnabled() const return GetImplementation(*this).GetInputEnabled(); } -RenderTask::RenderTask( Internal::RenderTask* internal ) -: Constrainable(internal) +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 +{ + if(actor) + { + Internal::Actor* actorImpl(&GetImplementation(actor)); + return GetImplementation(*this).ViewportToLocal(actorImpl, viewportX, viewportY, localX, localY); + } + else + { + return false; + } +} + +RenderTask::RenderTask(Internal::RenderTask* internal) +: Handle(internal) { }