X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fshadow-view%2Fshadow-view-impl.h;h=c0de0e421efa3f2d705b3d4d0f6a04354fc3918d;hb=b8da2e53925b9abb9fa362560069e8ca4aa62f81;hp=aa104287db1c86d1ae49208936f38b9c686c52cb;hpb=e2eda444afbe82e9591fe198eef339227f90a616;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h index aa10428..c0de0e4 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h @@ -1,50 +1,51 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H__ -#define __DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +#ifndef DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H +#define DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H + +/* + * Copyright (c) 2021 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. + * + */ // EXTERNAL INCLUDES -#include +#include +#include +#include +#include #include +#include // INTERNAL INCLUDES -#include -#include -#include +#include #include +#include +#include namespace Dali { - namespace Toolkit { - class ShadowView; namespace Internal { - /** * ShadowView implementation class */ -class ShadowView : public ControlImpl +class ShadowView : public Control { public: - /** * @copydoc Dali::Toolkit::ShadowView::ShadowView */ @@ -66,19 +67,9 @@ public: static Dali::Toolkit::ShadowView New(float downsampleWidthScale, float downsampleHeightScale); /** - * @copydoc Dali::Toolkit::ShadowView::Add(Actor child) - */ - void Add(Actor child); - - /** - * @copydoc Dali::Toolkit::ShadowView::Remove(Actor child) + * @copydoc Dali::Toolkit::ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground) */ - void Remove(Actor child); - - /** - * @copydoc Dali::Toolkit::ShadowView::SetShadowPlane(Actor shadowPlane) - */ - void SetShadowPlane(Actor shadowPlane); + void SetShadowPlaneBackground(Actor shadowPlaneBackground); /** * @copydoc Dali::Toolkit::ShadowView::SetPointLight(Actor pointLight) @@ -108,21 +99,33 @@ public: /** * @copydoc Dali::Toolkit::ShadowView::GetBlurStrengthPropertyIndex() */ - Property::Index GetBlurStrengthPropertyIndex() const {return mBlurStrengthPropertyIndex;} + Property::Index GetBlurStrengthPropertyIndex() const + { + return mBlurStrengthPropertyIndex; + } /** * @copydoc Dali::Toolkit::ShadowView::GetShadowColorPropertyIndex() */ - Property::Index GetShadowColorPropertyIndex() const {return mShadowColorPropertyIndex;} + Property::Index GetShadowColorPropertyIndex() const + { + return mShadowColorPropertyIndex; + } void SetShaderConstants(); private: + void OnInitialize() override; - virtual void OnInitialize(); - virtual void OnSizeSet(const Vector3& targetSize); - virtual void OnStageConnection(); - virtual void OnStageDisconnection(); + /** + * @copydoc Control::OnChildAdd() + */ + void OnChildAdd(Actor& child) override; + + /** + * @copydoc Control::OnChildRemove() + */ + void OnChildRemove(Actor& child) override; /** * Constrain the camera actor to the position of the point light, pointing @@ -135,65 +138,61 @@ private: void CreateBlurFilter(); private: - ImageActor 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 + 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 - ImageActor mShadowPlaneDrawable; // Positioned on top of mShadowPlane for drawing shadow image + Actor mChildrenRoot; // Subtree for all user added child actors that should be rendered normally + Actor mBlurRootActor; // Root actor for blur filter processing RenderTask mRenderSceneTask; CameraActor mCameraActor; // Constrained to same position as mPointLight and pointing at mShadowPlane - ShaderEffect mShadowRenderShader; + Property::Map mShadowVisualMap; BlurTwoPassFilter mBlurFilter; - Vector4 mCachedShadowColor; ///< Cached Shadow color. - Vector4 mCachedBackgroundColor; ///< Cached Shadow background color (same as shadow color but with alpha at 0.0) + Vector4 mCachedShadowColor; ///< Cached Shadow color. + Vector4 mCachedBackgroundColor; ///< Cached Shadow background color (same as shadow color but with alpha at 0.0) ///////////////////////////////////////////////////////////// // Properties that can be animated Property::Index mBlurStrengthPropertyIndex; Property::Index mShadowColorPropertyIndex; - float mDownsampleWidthScale; - float mDownsampleHeightScale; + float mDownsampleWidthScale; + float mDownsampleHeightScale; private: - // Undefined copy constructor. - ShadowView( const ShadowView& ); + ShadowView(const ShadowView&); // Undefined assignment operator. - ShadowView& operator=( const ShadowView& ); + ShadowView& operator=(const ShadowView&); }; } // namespace Internal - // Helpers for public-api forwarding methods -inline Toolkit::Internal::ShadowView& GetImpl( Toolkit::ShadowView& obj ) +inline Toolkit::Internal::ShadowView& GetImpl(Toolkit::ShadowView& obj) { DALI_ASSERT_ALWAYS(obj); Dali::RefObject& handle = obj.GetImplementation(); return static_cast(handle); } -inline const Toolkit::Internal::ShadowView& GetImpl( const Toolkit::ShadowView& obj ) +inline const Toolkit::Internal::ShadowView& GetImpl(const Toolkit::ShadowView& obj) { DALI_ASSERT_ALWAYS(obj); const Dali::RefObject& handle = obj.GetImplementation(); return static_cast(handle); } - } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H__ +#endif // DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H