From ab447436de92a2e8bc8cd1393f4807f19ef6b316 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 25 Jan 2021 17:43:44 +0900 Subject: [PATCH] Create Renderer when the Visual is created Change-Id: I08ad0e53774094acf39dda4daaa98f5b899f0d2d --- .../dali-toolkit-test-utils/dummy-visual.cpp | 9 ++- .../dali-toolkit-test-utils/dummy-visual.h | 3 +- .../src/dali-toolkit/utc-Dali-TransitionData.cpp | 45 +------------- .../src/dali-toolkit/utc-Dali-Visual.cpp | 9 +-- dali-toolkit/devel-api/controls/control-devel.h | 2 - .../animated-gradient/animated-gradient-visual.cpp | 7 +-- .../animated-gradient/animated-gradient-visual.h | 11 ++-- .../animated-image/animated-image-visual.cpp | 12 ++-- .../visuals/animated-image/animated-image-visual.h | 7 ++- .../animated-vector-image-visual.cpp | 13 +++-- .../animated-vector-image-visual.h | 7 ++- dali-toolkit/internal/visuals/arc/arc-visual.cpp | 20 +------ dali-toolkit/internal/visuals/arc/arc-visual.h | 14 ++--- .../internal/visuals/border/border-visual.cpp | 7 +-- .../internal/visuals/border/border-visual.h | 12 ++-- .../internal/visuals/color/color-visual.cpp | 15 +---- dali-toolkit/internal/visuals/color/color-visual.h | 11 ++-- .../internal/visuals/gradient/gradient-visual.cpp | 7 +-- .../internal/visuals/gradient/gradient-visual.h | 12 ++-- .../internal/visuals/image/image-visual.cpp | 30 +++++----- dali-toolkit/internal/visuals/image/image-visual.h | 13 ++--- dali-toolkit/internal/visuals/mesh/mesh-visual.cpp | 7 +-- dali-toolkit/internal/visuals/mesh/mesh-visual.h | 12 ++-- .../internal/visuals/npatch/npatch-visual.cpp | 56 +++++++++++------- .../internal/visuals/npatch/npatch-visual.h | 37 +++++++----- .../visuals/primitive/primitive-visual.cpp | 7 +-- .../internal/visuals/primitive/primitive-visual.h | 7 ++- dali-toolkit/internal/visuals/svg/svg-visual.cpp | 41 +++++++------ dali-toolkit/internal/visuals/svg/svg-visual.h | 7 ++- dali-toolkit/internal/visuals/text/text-visual.cpp | 24 ++++---- dali-toolkit/internal/visuals/text/text-visual.h | 7 ++- dali-toolkit/internal/visuals/visual-base-impl.cpp | 68 +++++++++------------- dali-toolkit/internal/visuals/visual-base-impl.h | 11 +++- .../internal/visuals/visual-factory-impl.cpp | 10 ++-- .../visuals/wireframe/wireframe-visual.cpp | 13 ++--- .../internal/visuals/wireframe/wireframe-visual.h | 11 ++-- 36 files changed, 280 insertions(+), 304 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.cpp b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.cpp index c1d0585..1d8d611 100644 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.cpp +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -33,7 +33,7 @@ DummyVisualPtr DummyVisual::New( const Property::Map& properties ) VisualFactoryCache* factoryCache = new VisualFactoryCache(false); DummyVisualPtr dummyVisualPtr( new DummyVisual( *factoryCache ) ); - + dummyVisualPtr->Initialize(); return dummyVisualPtr; } @@ -43,6 +43,11 @@ DummyVisual::DummyVisual( VisualFactoryCache& factoryCache ) { } +void DummyVisual::OnInitialize() +{ + // Implement if required +} + void DummyVisual::DoCreatePropertyMap( Property::Map& map ) const { // Implement if required diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.h b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.h index ef4c37b..41b2c21 100644 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.h +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEST_DUMMY_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -75,6 +75,7 @@ protected: DummyVisual( VisualFactoryCache& factoryCache ); + void OnInitialize() override; void DoCreatePropertyMap( Property::Map& map ) const override; void DoCreateInstancePropertyMap( Property::Map& map ) const override; void DoSetProperties( const Property::Map& propertyMap ) override; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp index ca57b44..a68ac7a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TransitionData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -755,49 +755,6 @@ int UtcDaliTransitionDataMap1N(void) END_TEST; } - -int UtcDaliTransitionDataMapN3(void) -{ - ToolkitTestApplication application; - - tet_printf("Testing visual lookup with no renderers\n"); - - Property::Map map; - map["target"] = "visual1"; - map["property"] = "mixColor"; - map["initialValue"] = Vector3(Color::MAGENTA); - map["targetValue"] = Vector3(Color::RED); - map["animator"] = Property::Map() - .Add("alphaFunction", "EASE_OUT_BACK") - .Add("timePeriod", Property::Map() - .Add("delay", 0.5f) - .Add("duration", 1.0f)); - - Dali::Toolkit::TransitionData transition = TransitionData::New( map ); - CHECK_MAP_EQUALS( map, transition.GetAnimatorAt(0) ); - - DummyControl actor = DummyControl::New(); - actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); - actor.SetProperty( Dali::Actor::Property::NAME,"Actor1"); - actor.SetProperty( Actor::Property::COLOR,Color::CYAN); - // Don't stage actor - - DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); - Property::Map visualMap; - visualMap[Visual::Property::TYPE] = Visual::COLOR; - visualMap[ColorVisual::Property::MIX_COLOR] = Vector3(Color::MAGENTA); - Visual::Base visual = VisualFactory::Get().CreateVisual( visualMap ); - visual.SetName( "visual1" ); - - Property::Index visualIndex = Control::CONTROL_PROPERTY_END_INDEX + 1; - dummyImpl.RegisterVisual( visualIndex, visual ); - - Animation anim = dummyImpl.CreateTransition( transition ); - DALI_TEST_CHECK( !anim ); - END_TEST; -} - - int UtcDaliTransitionDataMapN4(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 761e88e..fbf3438 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -4136,13 +4136,6 @@ int UtcDaliVisualGetVisualProperty01(void) DALI_TEST_CHECK(!property3.object); DALI_TEST_CHECK(property3.propertyIndex == Property::INVALID_INDEX); - // Test after the control is unparented - dummyControl.Unparent(); - - Property property4 = DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR); - DALI_TEST_CHECK(!property4.object); - DALI_TEST_CHECK(property4.propertyIndex == Property::INVALID_INDEX); - END_TEST; } diff --git a/dali-toolkit/devel-api/controls/control-devel.h b/dali-toolkit/devel-api/controls/control-devel.h index af6c76c..9baeeb2 100644 --- a/dali-toolkit/devel-api/controls/control-devel.h +++ b/dali-toolkit/devel-api/controls/control-devel.h @@ -364,8 +364,6 @@ DALI_TOOLKIT_API VisualEventSignalType& VisualEventSignal(Control control); * @param[in] index The Property index of the visual. * @param[in] visualPropertyKey The key of the visual's property. * @return The Property object - * @pre The control should be added to the Scene. - * @pre The returned object is valid for as long as the control is on the Scene. */ DALI_TOOLKIT_API Dali::Property GetVisualProperty(Control control, Dali::Property::Index index, Dali::Property::Key visualPropertyKey); diff --git a/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.cpp b/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.cpp index 9b4bc8c..5ef6044 100755 --- a/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -130,6 +130,7 @@ AnimatedGradientVisualPtr AnimatedGradientVisual::New( VisualFactoryCache& facto { AnimatedGradientVisualPtr animatedGradientVisualPtr( new AnimatedGradientVisual( factoryCache ) ); animatedGradientVisualPtr->SetProperties( properties ); + animatedGradientVisualPtr->Initialize(); return animatedGradientVisualPtr; } @@ -474,7 +475,6 @@ void AnimatedGradientVisual::OnSetTransform() void AnimatedGradientVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); actor.AddRenderer( mImpl->mRenderer ); SetupAnimation(); PlayAnimation(); @@ -488,7 +488,6 @@ void AnimatedGradientVisual::DoSetOffScene( Actor& actor ) StopAnimation(); actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); } void AnimatedGradientVisual::DoCreatePropertyMap( Property::Map& map ) const @@ -664,7 +663,7 @@ Shader AnimatedGradientVisual::CreateShader() return shader; } -void AnimatedGradientVisual::InitializeRenderer() +void AnimatedGradientVisual::OnInitialize() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); VisualFactoryCache::ShaderType shaderType = GetShaderType( mGradientType, mUnitType, mSpreadType ); diff --git a/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h b/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h index bca20c2..96ea9ab 100755 --- a/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h +++ b/dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ANIMATED_GRADIENT_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -195,6 +195,10 @@ protected: virtual ~AnimatedGradientVisual(); protected: //from Visual + /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; /** * @copydoc Visual::Base::DoSetProperties @@ -224,11 +228,6 @@ private: void SetupDefaultValue(); /** - * @brief Initialize the rendere with the geometry from the cache, and shader which made by CreateShader() - */ - void InitializeRenderer(); - - /** * @brief Make animations with GradientAnimationData */ void SetupAnimation(); diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp index 09cad55..db1be08 100755 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -119,6 +119,8 @@ AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCach visual->LoadFirstBatch(); } + visual->Initialize(); + return visual; } @@ -143,6 +145,8 @@ AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCach visual->LoadFirstBatch(); } + visual->Initialize(); + return visual; } @@ -156,6 +160,8 @@ AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCach visual->LoadFirstBatch(); } + visual->Initialize(); + return visual; } @@ -487,7 +493,6 @@ void AnimatedImageVisual::DoSetOnScene( Actor& actor ) { mPlacementActor = actor; TextureSet textureSet = PrepareTextureSet(); - CreateRenderer(); // Always create a renderer when on stage if( textureSet ) // if the image loading is successful { @@ -510,7 +515,6 @@ void AnimatedImageVisual::DoSetOffScene( Actor& actor ) } actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); mPlacementActor.Reset(); mStartFirstFrame = false; } @@ -523,7 +527,7 @@ void AnimatedImageVisual::OnSetTransform() } } -void AnimatedImageVisual::CreateRenderer() +void AnimatedImageVisual::OnInitialize() { bool defaultWrapMode = mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE; bool atlasing = false; diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h index 862dbb8..3858f6d 100644 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -157,6 +157,11 @@ protected: ~AnimatedImageVisual() override; /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp index db97880..805b430 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -72,14 +72,14 @@ AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& { AnimatedVectorImageVisualPtr visual( new AnimatedVectorImageVisual( factoryCache, shaderFactory, imageUrl ) ); visual->SetProperties( properties ); - + visual->Initialize(); return visual; } AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ) { AnimatedVectorImageVisualPtr visual( new AnimatedVectorImageVisual( factoryCache, shaderFactory, imageUrl ) ); - + visual->Initialize(); return visual; } @@ -279,7 +279,7 @@ void AnimatedVectorImageVisual::DoSetProperty( Property::Index index, const Prop } } -void AnimatedVectorImageVisual::DoSetOnScene( Actor& actor ) +void AnimatedVectorImageVisual::OnInitialize(void) { Shader shader; @@ -305,7 +305,10 @@ void AnimatedVectorImageVisual::DoSetOnScene( Actor& actor ) // Register transform properties mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); +} +void AnimatedVectorImageVisual::DoSetOnScene(Actor& actor) +{ // Defer the rasterisation task until we get given a size (by Size Negotiation algorithm) // Hold the weak handle of the placement actor and delay the adding of renderer until the rasterization is finished. @@ -339,8 +342,6 @@ void AnimatedVectorImageVisual::DoSetOffScene( Actor& actor ) if( mImpl->mRenderer ) { actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); - mRendererAdded = false; } diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h index 5bf0f4e..9afd18e 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -121,6 +121,11 @@ protected: ~AnimatedVectorImageVisual() override; /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; diff --git a/dali-toolkit/internal/visuals/arc/arc-visual.cpp b/dali-toolkit/internal/visuals/arc/arc-visual.cpp index be58a9f..029cd71 100644 --- a/dali-toolkit/internal/visuals/arc/arc-visual.cpp +++ b/dali-toolkit/internal/visuals/arc/arc-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -54,6 +54,7 @@ ArcVisualPtr ArcVisual::New( VisualFactoryCache& factoryCache, const Property::M { ArcVisualPtr arcVisualPtr( new ArcVisual( factoryCache ) ); arcVisualPtr->SetProperties( properties ); + arcVisualPtr->Initialize(); return arcVisualPtr; } @@ -139,8 +140,6 @@ void ArcVisual::DoSetProperties( const Property::Map& propertyMap ) void ArcVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - actor.AddRenderer( mImpl->mRenderer ); // Arc Visual generated and ready to display @@ -149,20 +148,7 @@ void ArcVisual::DoSetOnScene( Actor& actor ) void ArcVisual::DoSetOffScene(Actor& actor) { - if(mImpl->mRenderer) - { - // Update values from Renderer - mThickness = mImpl->mRenderer.GetProperty(mThicknessIndex); - mStartAngle = mImpl->mRenderer.GetProperty(mStartAngleIndex); - mSweepAngle = mImpl->mRenderer.GetProperty(mSweepAngleIndex); - } - actor.RemoveRenderer(mImpl->mRenderer); - mImpl->mRenderer.Reset(); - - mThicknessIndex = Property::INVALID_INDEX; - mStartAngleIndex = Property::INVALID_INDEX; - mSweepAngleIndex = Property::INVALID_INDEX; } void ArcVisual::DoCreatePropertyMap( Property::Map& map ) const @@ -223,7 +209,7 @@ void ArcVisual::OnDoAction( const Property::Index actionId, const Property::Valu } } -void ArcVisual::InitializeRenderer() +void ArcVisual::OnInitialize() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); diff --git a/dali-toolkit/internal/visuals/arc/arc-visual.h b/dali-toolkit/internal/visuals/arc/arc-visual.h index 15f57d3..9a8b1c5 100644 --- a/dali-toolkit/internal/visuals/arc/arc-visual.h +++ b/dali-toolkit/internal/visuals/arc/arc-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ARC_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -89,6 +89,11 @@ protected: virtual ~ArcVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -115,13 +120,6 @@ protected: private: - /** - * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - -private: - // Undefined ArcVisual( const ArcVisual& arcVisual ) = delete; diff --git a/dali-toolkit/internal/visuals/border/border-visual.cpp b/dali-toolkit/internal/visuals/border/border-visual.cpp index f62afc3..4146b80 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.cpp +++ b/dali-toolkit/internal/visuals/border/border-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -51,6 +51,7 @@ BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache, const Prope { BorderVisualPtr borderVisualPtr( new BorderVisual( factoryCache ) ); borderVisualPtr->SetProperties( properties ); + borderVisualPtr->Initialize(); return borderVisualPtr; } @@ -129,8 +130,6 @@ void BorderVisual::DoSetProperty( Dali::Property::Index index, void BorderVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - mBorderColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor ); if( mBorderColor.a < 1.f || mAntiAliasing ) { @@ -166,7 +165,7 @@ void BorderVisual::OnSetTransform() } } -void BorderVisual::InitializeRenderer() +void BorderVisual::OnInitialize() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::BORDER_GEOMETRY ); if( !geometry ) diff --git a/dali-toolkit/internal/visuals/border/border-visual.h b/dali-toolkit/internal/visuals/border/border-visual.h index aa7a69b..15cb5bf 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.h +++ b/dali-toolkit/internal/visuals/border/border-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BORDER_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -76,6 +76,11 @@ protected: virtual ~BorderVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -103,11 +108,6 @@ protected: private: /** - * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - - /** * Request the border shader from the factory cache. If fail, create tha shader and add it to cache. * @return The border shader. */ diff --git a/dali-toolkit/internal/visuals/color/color-visual.cpp b/dali-toolkit/internal/visuals/color/color-visual.cpp index 492f203..77b0be0 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.cpp +++ b/dali-toolkit/internal/visuals/color/color-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -46,6 +46,7 @@ ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache, const Propert { ColorVisualPtr colorVisualPtr( new ColorVisual( factoryCache ) ); colorVisualPtr->SetProperties( properties ); + colorVisualPtr->Initialize(); return colorVisualPtr; } @@ -110,8 +111,6 @@ void ColorVisual::DoSetProperties( const Property::Map& propertyMap ) void ColorVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - // Only add the renderer if it's not fully transparent // We cannot avoid creating a renderer as it's used in the base class if( mRenderIfTransparent || mImpl->mMixColor.a > 0.0f ) @@ -125,15 +124,7 @@ void ColorVisual::DoSetOnScene( Actor& actor ) void ColorVisual::DoSetOffScene(Actor& actor) { - if(mImpl->mRenderer && mBlurRadiusIndex != Property::INVALID_INDEX) - { - // Update values from Renderer - mBlurRadius = mImpl->mRenderer.GetProperty(mBlurRadiusIndex); - } - actor.RemoveRenderer(mImpl->mRenderer); - mImpl->mRenderer.Reset(); - mBlurRadiusIndex = Property::INVALID_INDEX; } void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const @@ -194,7 +185,7 @@ void ColorVisual::UpdateShader() } } -void ColorVisual::InitializeRenderer() +void ColorVisual::OnInitialize() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); diff --git a/dali-toolkit/internal/visuals/color/color-visual.h b/dali-toolkit/internal/visuals/color/color-visual.h index bf28d25..11e43d3 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.h +++ b/dali-toolkit/internal/visuals/color/color-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -85,6 +85,11 @@ protected: virtual ~ColorVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -120,10 +125,6 @@ protected: Dali::Property OnGetPropertyObject(Dali::Property::Key key) override; private: - /** - * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); /** * @brief Get a shader for the current properties. diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index 504b0e0..96f9f85 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -147,6 +147,7 @@ GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache, const P { GradientVisualPtr gradientVisualPtr( new GradientVisual( factoryCache ) ); gradientVisualPtr->SetProperties( properties ); + gradientVisualPtr->Initialize(); return gradientVisualPtr; } @@ -199,8 +200,6 @@ void GradientVisual::OnSetTransform() void GradientVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - actor.AddRenderer( mImpl->mRenderer ); // Gradient Visual generated and ready to display @@ -264,7 +263,7 @@ void GradientVisual::DoCreateInstancePropertyMap( Property::Map& map ) const // Do nothing } -void GradientVisual::InitializeRenderer() +void GradientVisual::OnInitialize() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); Shader shader = GetShader(); diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.h b/dali-toolkit/internal/visuals/gradient/gradient-visual.h index 71ae1d6..fdd458b 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.h +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -120,6 +120,11 @@ protected: virtual ~GradientVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -142,11 +147,6 @@ protected: private: /** - * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - - /** * New a gradient object with the given property map. * * @return True if the property map provides valid properties to create a gradient. Otherwise, returns false. diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 3a91784..028773d 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -130,6 +130,7 @@ ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, { ImageVisualPtr imageVisualPtr( new ImageVisual( factoryCache, shaderFactory, imageUrl, size, fittingMode, samplingMode ) ); imageVisualPtr->SetProperties( properties ); + imageVisualPtr->Initialize(); return imageVisualPtr; } @@ -140,7 +141,9 @@ ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode ) { - return new ImageVisual( factoryCache, shaderFactory, imageUrl, size, fittingMode, samplingMode ); + ImageVisualPtr imageVisualPtr(new ImageVisual(factoryCache, shaderFactory, imageUrl, size, fittingMode, samplingMode)); + imageVisualPtr->Initialize(); + return imageVisualPtr; } ImageVisual::ImageVisual(VisualFactoryCache& factoryCache, @@ -510,7 +513,7 @@ void ImageVisual::GetNaturalSize( Vector2& naturalSize ) naturalSize = Vector2::ZERO; } -void ImageVisual::CreateRenderer( TextureSet& textureSet ) +void ImageVisual::OnInitialize() { Geometry geometry; @@ -538,19 +541,12 @@ void ImageVisual::CreateRenderer( TextureSet& textureSet ) // Create the renderer mImpl->mRenderer = Renderer::New( geometry, shader ); - if( textureSet ) - { - mImpl->mRenderer.SetTextures( textureSet ); - } - // else still waiting for texture load to finish. - //Register transform properties mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); EnablePreMultipliedAlpha( IsPreMultipliedAlphaEnabled() ); } - void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection, TextureManager::ReloadPolicy forceReload ) { @@ -635,8 +631,11 @@ void ImageVisual::InitializeRenderer() } } - CreateRenderer( mTextures ); - mTextures.Reset(); // Visual should not keep a handle to the texture after this point. + if(mTextures) + { + mImpl->mRenderer.SetTextures(mTextures); + mTextures.Reset(); // Visual should not keep a handle to the texture after this point. + } if( attemptAtlasing ) // the texture is packed inside atlas { @@ -706,17 +705,19 @@ void ImageVisual::DoSetOffScene( Actor& actor ) { // Visual::Base::SetOffScene only calls DoSetOffScene if mRenderer exists (is on onstage) - // Image release is dependent on the ReleasePolicy, renderer is destroyed. + // Image release is dependent on the ReleasePolicy, renderer is removed. actor.RemoveRenderer( mImpl->mRenderer); if( mReleasePolicy == Toolkit::ImageVisual::ReleasePolicy::DETACHED ) { RemoveTexture(); // If INVALID_TEXTURE_ID then removal will be attempted on atlas mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING; + TextureSet textureSet = TextureSet::New(); + mImpl->mRenderer.SetTextures(textureSet); + mLoadState = TextureManager::LoadState::NOT_STARTED; } - mImpl->mRenderer.Reset(); mPlacementActor.Reset(); } @@ -932,7 +933,6 @@ void ImageVisual::RemoveTexture() } TextureSet textureSet = mImpl->mRenderer.GetTextures(); - mImpl->mRenderer.Reset(); if( index != Property::INVALID_INDEX ) { diff --git a/dali-toolkit/internal/visuals/image/image-visual.h b/dali-toolkit/internal/visuals/image/image-visual.h index fb1a529..f40cf70 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.h +++ b/dali-toolkit/internal/visuals/image/image-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_IMAGE_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -205,6 +205,11 @@ protected: virtual ~ImageVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -290,12 +295,6 @@ private: void InitializeRenderer(); /** - * @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it - * @param[in] textures to use - */ - void CreateRenderer( TextureSet& textures ); - - /** * Creates the texture set and adds the texture to it * @param[out] textureRect The texture area of the texture in the atlas. * @param[in] url The URL of the image resource to use. diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp index f34f66c..6a1215c 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -101,6 +101,7 @@ MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache, const Property: { MeshVisualPtr meshVisualPtr( new MeshVisual( factoryCache ) ); meshVisualPtr->SetProperties( properties ); + meshVisualPtr->Initialize(); return meshVisualPtr; } @@ -245,8 +246,6 @@ void MeshVisual::OnSetTransform() void MeshVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - actor.AddRenderer( mImpl->mRenderer ); // Mesh loaded and ready to display @@ -271,7 +270,7 @@ void MeshVisual::DoCreateInstancePropertyMap( Property::Map& map ) const // Do nothing } -void MeshVisual::InitializeRenderer() +void MeshVisual::OnInitialize() { //Try to load the geometry from the file. if( !LoadGeometry() ) diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.h b/dali-toolkit/internal/visuals/mesh/mesh-visual.h index 852d7ef..3cc1d66 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.h +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_MESH_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -95,6 +95,11 @@ protected: virtual ~MeshVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -118,11 +123,6 @@ private: void SupplyEmptyGeometry(); /** - * @brief Initialize the visual with the geometry and shader from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - - /** * @brief Create a shader for the object to use. */ void CreateShader(); diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index 8bbdb09..ccee97d 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -25,15 +25,16 @@ // INTERNAL INCLUDES #include -#include +#include +#include #include -#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include +#include namespace Dali { @@ -134,20 +135,20 @@ void RegisterStretchProperties( Renderer& renderer, const char * uniformName, co /////////////////NPatchVisual//////////////// -NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl, const Property::Map& properties ) +NPatchVisualPtr NPatchVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties) { - NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) ); + NPatchVisualPtr nPatchVisual(new NPatchVisual(factoryCache, shaderFactory)); nPatchVisual->mImageUrl = imageUrl; nPatchVisual->SetProperties( properties ); - + nPatchVisual->Initialize(); return nPatchVisual; } -NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl ) +NPatchVisualPtr NPatchVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl) { - NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) ); + NPatchVisualPtr nPatchVisual(new NPatchVisual(factoryCache, shaderFactory)); nPatchVisual->mImageUrl = imageUrl; - + nPatchVisual->Initialize(); return nPatchVisual; } @@ -283,7 +284,8 @@ void NPatchVisual::DoSetOnScene( Actor& actor ) Geometry geometry = CreateGeometry(); Shader shader = CreateShader(); - mImpl->mRenderer = Renderer::New( geometry, shader ); + mImpl->mRenderer.SetGeometry(geometry); + mImpl->mRenderer.SetShader(shader); mPlacementActor = actor; if( data->GetLoadingState() != NPatchData::LoadingState::LOADING ) @@ -313,7 +315,6 @@ void NPatchVisual::DoSetOffScene( Actor& actor ) } actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); mPlacementActor.Reset(); } @@ -352,17 +353,18 @@ void NPatchVisual::DoCreateInstancePropertyMap( Property::Map& map ) const } } -NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache ) -: Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::N_PATCH ), +NPatchVisual::NPatchVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory) +: Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::N_PATCH), mPlacementActor(), - mLoader( factoryCache.GetNPatchLoader() ), + mLoader(factoryCache.GetNPatchLoader()), + mImageVisualShaderFactory(shaderFactory), mImageUrl(), mAuxiliaryUrl(), mId(NPatchData::INVALID_NPATCH_DATA_ID), - mBorderOnly( false ), + mBorderOnly(false), mBorder(), - mAuxiliaryImageAlpha( 0.0f ), - mReleasePolicy( Toolkit::ImageVisual::ReleasePolicy::DETACHED ) + mAuxiliaryImageAlpha(0.0f), + mReleasePolicy(Toolkit::ImageVisual::ReleasePolicy::DETACHED) { EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() ); } @@ -376,6 +378,18 @@ NPatchVisual::~NPatchVisual() } } +void NPatchVisual::OnInitialize() +{ + // Get basic geometry and shader + Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); + Shader shader = mImageVisualShaderFactory.GetShader(mFactoryCache, false, true, false); + + mImpl->mRenderer = Renderer::New(geometry, shader); + + //Register transform properties + mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); +} + Geometry NPatchVisual::CreateGeometry() { Geometry geometry; diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 19bdaff..e89d9e0 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_N_PATCH_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -40,7 +40,7 @@ namespace Toolkit namespace Internal { - +class ImageVisualShaderFactory; class NPatchVisual; typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr; @@ -60,18 +60,18 @@ typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr; class NPatchVisual: public Visual::Base, public TextureUploadObserver { public: - /** * @brief Create an N-patch visual using an image URL. * * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to 9 patch image resource to use * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl, const Property::Map& properties ); + static NPatchVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties); /** * @brief Create an N-patch visual using an image URL. @@ -79,10 +79,11 @@ public: * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to 9 patch image resource to use * @return A smart-pointer to the newly allocated visual. */ - static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl ); + static NPatchVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); public: // from Visual @@ -108,7 +109,7 @@ protected: * * @param[in] factoryCache Reference to the VisualFactoryCache object */ - NPatchVisual( VisualFactoryCache& factoryCache ); + NPatchVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -116,6 +117,11 @@ protected: virtual ~NPatchVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; @@ -223,15 +229,16 @@ private: void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied ) override; private: - WeakHandle mPlacementActor; ///< Weakhandle to contain Actor during texture loading - NPatchLoader& mLoader; ///< reference to N patch loader for fast access - VisualUrl mImageUrl; ///< The url to the N patch to load - VisualUrl mAuxiliaryUrl; ///< An auxiliary image that can be displayed on top of the N-Patch - NPatchData::NPatchDataId mId; ///< id of the N patch (from loader/cache) - Devel::PixelBuffer mAuxiliaryPixelBuffer; ///< pixel buffer of the auxiliary mask image - bool mBorderOnly; ///< if only border is desired - Rect mBorder; ///< The size of the border - float mAuxiliaryImageAlpha; ///< The alpha value for the auxiliary image only + WeakHandle mPlacementActor; ///< Weakhandle to contain Actor during texture loading + NPatchLoader& mLoader; ///< reference to N patch loader for fast access + ImageVisualShaderFactory& mImageVisualShaderFactory; + VisualUrl mImageUrl; ///< The url to the N patch to load + VisualUrl mAuxiliaryUrl; ///< An auxiliary image that can be displayed on top of the N-Patch + NPatchData::NPatchDataId mId; ///< id of the N patch (from loader/cache) + Devel::PixelBuffer mAuxiliaryPixelBuffer; ///< pixel buffer of the auxiliary mask image + bool mBorderOnly; ///< if only border is desired + Rect mBorder; ///< The size of the border + float mAuxiliaryImageAlpha; ///< The alpha value for the auxiliary image only Toolkit::ImageVisual::ReleasePolicy::Type mReleasePolicy; ///< The release policy to determine when an image should no longer be cached. }; diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp index 7ad7bf5..48f8fa4 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -99,6 +99,7 @@ PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache, const { PrimitiveVisualPtr primitiveVisualPtr( new PrimitiveVisual( factoryCache ) ); primitiveVisualPtr->SetProperties( properties ); + primitiveVisualPtr->Initialize(); return primitiveVisualPtr; } @@ -333,8 +334,6 @@ void PrimitiveVisual::GetNaturalSize( Vector2& naturalSize ) void PrimitiveVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - actor.AddRenderer( mImpl->mRenderer ); // Primitive generated and ready to display @@ -372,7 +371,7 @@ void PrimitiveVisual::OnSetTransform() } } -void PrimitiveVisual::InitializeRenderer() +void PrimitiveVisual::OnInitialize() { if( !mGeometry ) { diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.h b/dali-toolkit/internal/visuals/primitive/primitive-visual.h index 806f594..a3facd0 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.h +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_PRIMITIVE_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -142,6 +142,11 @@ protected: virtual ~PrimitiveVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index bce5c27..8ccb63b 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -52,6 +52,7 @@ SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, ImageVisualShader SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) ); svgVisual->Load(); svgVisual->SetProperties(properties); + svgVisual->Initialize(); return svgVisual; } @@ -59,6 +60,7 @@ SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, ImageVisualShader { SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) ); svgVisual->Load(); + svgVisual->Initialize(); return svgVisual; } @@ -83,6 +85,26 @@ SvgVisual::~SvgVisual() { } +void SvgVisual::OnInitialize() +{ + Shader shader; + if(!mImpl->mCustomShader) + { + shader = mImageVisualShaderFactory.GetShader(mFactoryCache, mAttemptAtlasing, true, IsRoundedCornerRequired()); + } + else + { + shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader, + mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader, + mImpl->mCustomShader->mHints); + + shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT); + } + + Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); + mImpl->mRenderer = Renderer::New(geometry, shader); +} + void SvgVisual::DoSetProperties( const Property::Map& propertyMap ) { // url already passed in from constructor @@ -138,23 +160,7 @@ void SvgVisual::DoSetProperty( Property::Index index, const Property::Value& val void SvgVisual::DoSetOnScene( Actor& actor ) { - Shader shader; - if( !mImpl->mCustomShader ) - { - shader = mImageVisualShaderFactory.GetShader( mFactoryCache, mAttemptAtlasing, true, IsRoundedCornerRequired() ); - } - else - { - shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader, - mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader, - mImpl->mCustomShader->mHints ); - - shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); - } - - Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); TextureSet textureSet = TextureSet::New(); - mImpl->mRenderer = Renderer::New( geometry, shader ); mImpl->mRenderer.SetTextures( textureSet ); // Register transform properties @@ -174,7 +180,6 @@ void SvgVisual::DoSetOffScene( Actor& actor ) mFactoryCache.GetSVGRasterizationThread()->RemoveTask( this ); actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); mPlacementActor.Reset(); // Reset the visual size to zero so that when adding the actor back to stage the SVG rasterization is forced diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.h b/dali-toolkit/internal/visuals/svg/svg-visual.h index 814fc67..b7582b9 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.h +++ b/dali-toolkit/internal/visuals/svg/svg-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_SVG_VISUAL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -114,6 +114,11 @@ protected: virtual ~SvgVisual(); /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + + /** * @copydoc Visual::Base::DoSetProperties */ void DoSetProperties( const Property::Map& propertyMap ) override; diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 29b18a1..56d3a8d 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -152,9 +152,10 @@ void OpacityConstraint( float& current, const PropertyInputContainer& inputs ) TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - TextVisualPtr TextVisualPtr( new TextVisual( factoryCache ) ); - TextVisualPtr->SetProperties( properties ); - return TextVisualPtr; + TextVisualPtr textVisualPtr(new TextVisual(factoryCache)); + textVisualPtr->SetProperties(properties); + textVisualPtr->Initialize(); + return textVisualPtr; } Property::Map TextVisual::ConvertStringKeysToIndexKeys( const Property::Map& propertyMap ) @@ -252,6 +253,14 @@ TextVisual::~TextVisual() { } +void TextVisual::OnInitialize() +{ + Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); + Shader shader = GetTextShader(mFactoryCache, TextType::SINGLE_COLOR_TEXT, TextType::NO_EMOJI, TextType::NO_STYLES); + + mImpl->mRenderer = Renderer::New(geometry, shader); +} + void TextVisual::DoSetProperties( const Property::Map& propertyMap ) { for( Property::Map::SizeType index = 0u, count = propertyMap.Count(); index < count; ++index ) @@ -282,10 +291,6 @@ void TextVisual::DoSetOnScene( Actor& actor ) { mControl = actor; - Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); - Shader shader = GetTextShader(mFactoryCache, TextType::SINGLE_COLOR_TEXT, TextType::NO_EMOJI, TextType::NO_STYLES); - - mImpl->mRenderer = Renderer::New( geometry, shader ); mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT ); // Enable the pre-multiplied alpha to improve the text quality @@ -337,9 +342,6 @@ void TextVisual::DoSetOffScene( Actor& actor ) { RemoveRenderer( actor ); - // Resets the renderer. - mImpl->mRenderer.Reset(); - // Resets the control handle. mControl.Reset(); } diff --git a/dali-toolkit/internal/visuals/text/text-visual.h b/dali-toolkit/internal/visuals/text/text-visual.h index 136a23f..881fc3b 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.h +++ b/dali-toolkit/internal/visuals/text/text-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -160,6 +160,11 @@ protected: */ virtual ~TextVisual(); + /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; + // from Visual::Base /** diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index e8e984f..a814d6b 100755 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -77,6 +77,25 @@ Visual::Base::~Base() delete mImpl; } +void Visual::Base::Initialize() +{ + // The Renderer should be created inside derived class here. + OnInitialize(); + + if(mImpl->mRenderer) + { + RegisterMixColor(); + + if(IsRoundedCornerRequired()) + { + mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius); + mImpl->mRenderer.RegisterProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy); + + mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); + } + } +} + void Visual::Base::SetCustomShader( const Property::Map& shaderMap ) { if( mImpl->mCustomShader ) @@ -87,6 +106,9 @@ void Visual::Base::SetCustomShader( const Property::Map& shaderMap ) { mImpl->mCustomShader = new Impl::CustomShader( shaderMap ); } + + // Let derived class know + UpdateShader(); } void Visual::Base::SetProperties( const Property::Map& propertyMap ) @@ -317,22 +339,13 @@ void Visual::Base::SetOnScene( Actor& actor ) // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. DoSetOnScene( actor ); - if( mImpl->mRenderer ) + if(mImpl->mRenderer) { - RegisterMixColor(); - - if( IsRoundedCornerRequired() ) - { - mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius); - mImpl->mRenderer.RegisterProperty( CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy ); - - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - } - - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); - mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); - mImpl->mFlags |= Impl::IS_ON_SCENE; // Only sets the flag if renderer exists + mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); + mImpl->mRenderer.SetProperty(Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex); } + + mImpl->mFlags |= Impl::IS_ON_SCENE; } } @@ -340,28 +353,7 @@ void Visual::Base::SetOffScene( Actor& actor ) { if( IsOnScene() ) { - if(mImpl->mRenderer) - { - // Update values from Renderer - mImpl->mMixColor = mImpl->mRenderer.GetProperty(mImpl->mMixColorIndex); - mImpl->mMixColor.a = mImpl->mRenderer.GetProperty(DevelRenderer::Property::OPACITY); - if(mImpl->mTransform.mOffsetIndex != Property::INVALID_INDEX) - { - mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty(mImpl->mTransform.mOffsetIndex); - } - if(mImpl->mTransform.mSizeIndex != Property::INVALID_INDEX) - { - mImpl->mTransform.mSize = mImpl->mRenderer.GetProperty(mImpl->mTransform.mSizeIndex); - } - if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX) - { - mImpl->mCornerRadius = mImpl->mRenderer.GetProperty(mImpl->mCornerRadiusIndex); - } - } - DoSetOffScene( actor ); - mImpl->mMixColorIndex = Property::INVALID_INDEX; - mImpl->mCornerRadiusIndex = Property::INVALID_INDEX; mImpl->mFlags &= ~Impl::IS_ON_SCENE; } } @@ -422,9 +414,6 @@ void Visual::Base::CreateInstancePropertyMap( Property::Map& map ) const { mImpl->mCustomShader->CreatePropertyMap( map ); } - - //map.Insert( Toolkit::Visual::Property::DEPTH_INDEX, mImpl->mDepthIndex ); - //map.Insert( Toolkit::Visual::Property::ENABLED, (bool) mImpl->mRenderer ); } @@ -454,7 +443,6 @@ bool Visual::Base::IsPreMultipliedAlphaEnabled() const void Visual::Base::DoSetOffScene( Actor& actor ) { actor.RemoveRenderer( mImpl->mRenderer ); - mImpl->mRenderer.Reset(); } bool Visual::Base::IsOnScene() const diff --git a/dali-toolkit/internal/visuals/visual-base-impl.h b/dali-toolkit/internal/visuals/visual-base-impl.h index 8b0132e..3b23e5c 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_VISUAL_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -296,7 +296,16 @@ protected: */ ~Base() override; + /** + * @brief Second-phase constructor. + */ + void Initialize(); + protected: + /** + * @brief Called by Initialize() allowing sub classes to initialize them. + */ + virtual void OnInitialize() = 0; /** * @brief Called by CreatePropertyMap() allowing sub classes to respond to the CreatePropertyMap event diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 9e5238d..598f73d 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -1,5 +1,5 @@ - /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. +/* + * 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. @@ -155,7 +155,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property { case VisualUrl::N_PATCH: { - visualPtr = NPatchVisual::New( GetFactoryCache(), visualUrl, propertyMap ); + visualPtr = NPatchVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl, propertyMap); break; } case VisualUrl::SVG: @@ -224,7 +224,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property std::string imageUrl; if( imageURLValue && imageURLValue->Get( imageUrl ) ) { - visualPtr = NPatchVisual::New( GetFactoryCache(), imageUrl, propertyMap ); + visualPtr = NPatchVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), imageUrl, propertyMap); } break; } @@ -326,7 +326,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image { case VisualUrl::N_PATCH: { - visualPtr = NPatchVisual::New( GetFactoryCache(), visualUrl ); + visualPtr = NPatchVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl); break; } case VisualUrl::SVG: diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp index f563fc1..ead87c0 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * 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. @@ -15,7 +15,6 @@ * */ - // CLASS HEADER #include "wireframe-visual.h" @@ -51,7 +50,9 @@ WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, const WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual ) { - return new WireframeVisual( factoryCache, actualVisual ); + WireframeVisualPtr wireframeVisual(new WireframeVisual(factoryCache, actualVisual)); + wireframeVisual->Initialize(); + return wireframeVisual; } WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties ) @@ -65,7 +66,7 @@ WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visua { wireframeVisual->SetTransformAndSize( transformMap, Vector2::ZERO ); } - + wireframeVisual->Initialize(); return wireframeVisual; } @@ -134,15 +135,13 @@ void WireframeVisual::DoSetProperties( const Property::Map& propertyMap ) void WireframeVisual::DoSetOnScene( Actor& actor ) { - InitializeRenderer(); - actor.AddRenderer( mImpl->mRenderer ); // Wireframe generated and ready to display ResourceReady( Toolkit::Visual::ResourceStatus::READY ); } -void WireframeVisual::InitializeRenderer() +void WireframeVisual::OnInitialize() { Shader shader = mFactoryCache.GetShader( VisualFactoryCache::WIREFRAME_SHADER ); if( !shader ) diff --git a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h index 23b16f5..12ebfe5 100644 --- a/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * 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. @@ -92,6 +92,10 @@ protected: virtual ~WireframeVisual(); protected: // from Visual::Base + /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; /** * @copydoc Visual::Base::GetHeightForWidth() @@ -142,11 +146,6 @@ private: */ Geometry CreateQuadWireframeGeometry(); - /** - * @brief Initialise the renderer from the cache, if not available, create and save to the cache for sharing. - */ - void InitializeRenderer(); - // Undefined WireframeVisual( const WireframeVisual& visual); -- 2.7.4