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=9d0da9bfd3f9226ebc6777c0dcbbef93b02e0921;hpb=6cd8e473d54b3d231b49893a973afa63d865ce2e;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 9d0da9b..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) 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. @@ -19,21 +19,20 @@ #include // INTERNAL INCLUDES -#include -#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; @@ -42,47 +41,40 @@ static bool FullScreenFrameBufferFunction( Vector2& coordinates ) 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) -: 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 @@ -90,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 @@ -100,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 @@ -117,57 +109,68 @@ 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 @@ -175,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 @@ -185,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 @@ -207,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 @@ -217,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 @@ -227,12 +230,12 @@ 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(); } @@ -242,9 +245,9 @@ 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 @@ -252,17 +255,17 @@ 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 { @@ -270,8 +273,7 @@ bool RenderTask::ViewportToLocal(Actor actor, float viewportX, float viewportY, } } - -RenderTask::RenderTask( Internal::RenderTask* internal ) +RenderTask::RenderTask(Internal::RenderTask* internal) : Handle(internal) { }