dali-toolkit/internal/graphics/builtin-shader-extern-gen.h
dali-scene3d/internal/graphics/generated/*
dali-scene3d/internal/graphics/builtin-shader-extern-gen.h
+automated-tests/resources/overwritable-image.jpg
\ No newline at end of file
auto ptr = Dali::Accessibility::Accessible::Get(check_box_button);
auto attribute_map_bridge = TestGetAttributes(ptr->GetAddress());
auto counter = 0u;
+
+ // Refresh the attributes since ControlAccessible::GetAttributes() might have added something
+ attributes = check_box_button.GetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
+ attributes_map = attributes.GetMap();
for(auto i = 0u; i < attributes_map->Count(); ++i)
if((attributes_map->GetValue(i)).GetType() != Property::NONE)
++counter;
#define DALI_TOOLKIT_ADAPTOR_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
namespace Internal
{
-
namespace Adaptor
{
-
class GraphicsInterface;
class SceneHolder;
namespace Integration
{
-
class GlAbstraction;
} // namespace Integration
{
namespace Adaptor
{
-
class Adaptor
{
public:
Adaptor();
~Adaptor();
- void Start( Dali::Window window );
+ void Start(Dali::Window window);
+ void Stop();
- bool AddIdle( CallbackBase* callback, bool hasReturnValue );
- void RemoveIdle( CallbackBase* callback );
+ bool AddIdle(CallbackBase* callback, bool hasReturnValue);
+ void RemoveIdle(CallbackBase* callback);
void RunIdles();
- static Integration::Scene GetScene( Dali::Window window );
+ static Integration::Scene GetScene(Dali::Window window);
Dali::RenderSurfaceInterface& GetSurface();
- Dali::WindowContainer GetWindows();
- Dali::SceneHolderList GetSceneHolders();
+ Dali::WindowContainer GetWindows();
+ Dali::SceneHolderList GetSceneHolders();
+
+ Dali::Internal::Adaptor::SceneHolder* GetWindow(Dali::Actor& actor);
+ void AddWindow(Internal::Adaptor::SceneHolder* window);
+ void RemoveWindow(Internal::Adaptor::SceneHolder* window);
- Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor );
- void AddWindow( Internal::Adaptor::SceneHolder* window );
- void RemoveWindow( Internal::Adaptor::SceneHolder* window );
+ void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
+ void UnregisterProcessor(Integration::Processor& processor, bool postProcessor = false);
- void RegisterProcessor( Integration::Processor& processor, bool postProcessor = false);
- void UnregisterProcessor( Integration::Processor& processor, bool postProcessor = false);
+ void SetApplication(Dali::TestApplication& testApplication);
- void SetApplication( Dali::TestApplication& testApplication );
+ bool IsStopped() const
+ {
+ return mStopped;
+ }
- Dali::Adaptor::AdaptorSignalType& ResizedSignal();
- Dali::Adaptor::AdaptorSignalType& LanguageChangedSignal();
+ Dali::Adaptor::AdaptorSignalType& ResizedSignal();
+ Dali::Adaptor::AdaptorSignalType& LanguageChangedSignal();
Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
Dali::Adaptor::LocaleChangedSignalType& LocaleChangedSignal();
- static Adaptor& GetImpl( Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
- static const Adaptor& GetImpl( const Dali::Adaptor& adaptor ) { return *adaptor.mImpl; }
+ static Adaptor& GetImpl(Dali::Adaptor& adaptor)
+ {
+ return *adaptor.mImpl;
+ }
+ static const Adaptor& GetImpl(const Dali::Adaptor& adaptor)
+ {
+ return *adaptor.mImpl;
+ }
private:
-
- Vector<CallbackBase*> mCallbacks;
- Vector<CallbackBase*> mReturnCallbacks;
+ Vector<CallbackBase*> mCallbacks;
+ Vector<CallbackBase*> mReturnCallbacks;
std::vector<Internal::Adaptor::SceneHolder*> mWindows;
- Dali::Adaptor::AdaptorSignalType mResizedSignal;
- Dali::Adaptor::AdaptorSignalType mLanguageChangedSignal;
- Dali::Adaptor::WindowCreatedSignalType mWindowCreatedSignal;
- Dali::Adaptor::LocaleChangedSignalType mLocaleChangedSignal;
- TestApplication* mTestApplication;
+ Dali::Adaptor::AdaptorSignalType mResizedSignal;
+ Dali::Adaptor::AdaptorSignalType mLanguageChangedSignal;
+ Dali::Adaptor::WindowCreatedSignalType mWindowCreatedSignal;
+ Dali::Adaptor::LocaleChangedSignalType mLocaleChangedSignal;
+ TestApplication* mTestApplication;
+ bool mStopped{false};
};
} // namespace Adaptor
AddWindow(&GetImplementation(window));
}
+void Adaptor::Stop()
+{
+ if(mTestApplication)
+ {
+ Integration::Core& core = mTestApplication->GetCore();
+ tet_printf("Adaptor::UnregisterProcessors\n");
+ core.UnregisterProcessors();
+ }
+
+ mStopped = true;
+}
+
Integration::Scene Adaptor::GetScene(Dali::Window window)
{
return window.GetScene();
void Adaptor::Stop()
{
+ mImpl->Stop();
}
bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
bool Adaptor::IsAvailable()
{
- return Internal::Adaptor::gAdaptor;
+ return Internal::Adaptor::gAdaptor && (!Internal::Adaptor::Adaptor::GetImpl(*Internal::Adaptor::gAdaptor).IsStopped());
}
void Adaptor::NotifySceneCreated()
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
#include <dali/devel-api/threading/mutex.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/property-array.h>
#include <toolkit-application.h>
mFrameRate(60.0f),
mTestFrameDrop(false),
mNeedDroppedFrames(false),
+ mUseNativeImage(false),
mEventThreadCallback(new EventThreadCallback(MakeCallback(this, &VectorAnimationRenderer::OnTriggered)))
{
mCount++;
mResourceReady = true;
Dali::TextureSet textureSet = mRenderer.GetTextures();
- Dali::Texture texture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight);
- textureSet.SetTexture(0, texture);
- Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New(mWidth, mHeight, Pixel::RGBA8888);
- Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
- texture.Upload(pixelData);
+ if(mUseNativeImage)
+ {
+ Dali::NativeImageSourcePtr nativeImageSource = Dali::NativeImageSource::New(mWidth, mHeight, Dali::NativeImageSource::COLOR_DEPTH_32);
+ Dali::Texture texture = Dali::Texture::New(*nativeImageSource);
+ textureSet.SetTexture(0, texture);
+ }
+ else
+ {
+ Dali::Texture texture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight);
+ textureSet.SetTexture(0, texture);
+
+ Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New(mWidth, mHeight, Pixel::RGBA8888);
+ Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
+ texture.Upload(pixelData);
+ }
mUploadCompletedSignal.Emit();
}
bool mResourceReady{false};
bool mNeedTrigger{true};
bool mEnableFixedCache{false};
+ bool mUseNativeImage{false};
Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
std::unique_ptr<EventThreadCallback> mEventThreadCallback;
Internal::Adaptor::GetImplementation(*this).KeepRasterizedBuffer();
}
-
VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
{
return Internal::Adaptor::GetImplementation(*this).UploadCompletedSignal();
return Dali::Internal::Adaptor::gVectorAnimationRenderer->mDroppedFrames;
}
+void UseNativeImageTexture(bool useNativeImage)
+{
+ Dali::Internal::Adaptor::gVectorAnimationRenderer->mUseNativeImage = useNativeImage;
+}
+
} // namespace VectorAnimationRenderer
} // namespace Test
#define DALI_TOOLKIT_TEST_VECTOR_ANIMATION_RENDERER_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
void DelayRendering(uint32_t delay);
uint32_t GetDroppedFrames();
+void UseNativeImageTexture(bool useNativeImage);
} // namespace VectorAnimationRenderer
} // namespace Test
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <toolkit-timer.h>
#include <toolkit-vector-animation-renderer.h>
#include "dummy-control.h"
+#include "test-native-image-source.h"
#include <dali-toolkit/dali-toolkit.h>
dummyControl.Unparent();
END_TEST;
+}
+
+int UtcDaliAnimatedVectorImageNativeTextureChangeShader(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliAnimatedVectorImageNativeTextureChangeShader");
+
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base visual = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions());
+ DALI_TEST_CHECK(visual);
+
+ DummyControl actor = DummyControl::New(true);
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
+
+ // Make we use native texture now.
+ Test::VectorAnimationRenderer::UseNativeImageTexture(true);
+
+ application.GetScene().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ // Trigger count is 1 - resource ready
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Shader shader = renderer.GetShader();
+ Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK(map);
+
+ std::string resultFragmentShader, resultVertexShader;
+ Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
+ fragment->Get(resultFragmentShader);
+ DALI_TEST_CHECK(resultFragmentShader.find(NativeImageSourceTest::GetCustomFragmentPrefix()) != std::string::npos);
+
+ // Reset to make we use normal texture again.
+ Test::VectorAnimationRenderer::UseNativeImageTexture(false);
+
+ END_TEST;
}
\ No newline at end of file
application.SendNotification();
application.Render();
+ END_TEST;
+}
+
+int UtcDaliCanvasViewSetSizeAndAddDrawableAsync(void)
+{
+ ToolkitTestApplication application;
+
+ CanvasView canvasView = CanvasView::New(Vector2(100, 100));
+ DALI_TEST_CHECK(canvasView);
+
+ application.GetScene().Add(canvasView);
+
+ canvasView.SetProperty(Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING, false);
+ canvasView.SetProperty(Actor::Property::SIZE, Vector2(300, 300));
+
+ application.SendNotification();
+ application.Render();
+
+ Dali::CanvasRenderer::Shape shape = Dali::CanvasRenderer::Shape::New();
+
+ shape.AddRect(Rect<float>(10, 10, 10, 10), Vector2(0, 0));
+
+ canvasView.AddDrawable(shape);
+
+ application.SendNotification();
+ application.Render();
+
DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
END_TEST;
}
+
+int UtcDaliCanvasViewSychronousLoading(void)
+{
+ ToolkitTestApplication application;
+
+ CanvasView canvasView = CanvasView::New(Vector2(300, 300));
+ DALI_TEST_CHECK(canvasView);
+
+ application.GetScene().Add(canvasView);
+
+ canvasView.SetProperty(Actor::Property::SIZE, Vector2(300, 300));
+
+ application.SendNotification();
+ application.Render();
+
+ bool isSynchronous = canvasView.GetProperty(Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING).Get<bool>();
+ DALI_TEST_EQUALS(isSynchronous, true, TEST_LOCATION);
+
+ canvasView.SetProperty(Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING, false);
+
+ application.SendNotification();
+ application.Render();
+
+ isSynchronous = canvasView.GetProperty(Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING).Get<bool>();
+ DALI_TEST_EQUALS(isSynchronous, false, TEST_LOCATION);
+
+ END_TEST;
+}
// Test "rows" property
DALI_TEST_CHECK(tableView.GetPropertyIndex(PROPERTY_NAME_ROWS) == TableView::Property::ROWS);
- tableView.SetProperty(TableView::Property::ROWS, 4);
+ tableView.SetProperty(TableView::Property::ROWS, 7);
- DALI_TEST_CHECK(tableView.GetRows() == 4u);
- DALI_TEST_CHECK(tableView.GetProperty(TableView::Property::ROWS).Get<int>() == 4);
+ DALI_TEST_CHECK(tableView.GetRows() == 7u);
+ DALI_TEST_CHECK(tableView.GetProperty(TableView::Property::ROWS).Get<int>() == 7);
// Test "columns" property
DALI_TEST_CHECK(tableView.GetPropertyIndex(PROPERTY_NAME_COLUMNS) == TableView::Property::COLUMNS);
- tableView.SetProperty(TableView::Property::COLUMNS, 5);
+ tableView.SetProperty(TableView::Property::COLUMNS, 8);
- DALI_TEST_CHECK(tableView.GetColumns() == 5u);
- DALI_TEST_CHECK(tableView.GetProperty(TableView::Property::COLUMNS).Get<int>() == 5);
+ DALI_TEST_CHECK(tableView.GetColumns() == 8u);
+ DALI_TEST_CHECK(tableView.GetProperty(TableView::Property::COLUMNS).Get<int>() == 8);
// Test "cellPadding" property
DALI_TEST_CHECK(tableView.GetPropertyIndex(PROPERTY_NAME_CELL_PADDING) == TableView::Property::CELL_PADDING);
Property::Map item2;
item2["policy"] = "relative";
item2["value"] = 0.2f;
+ //{ "policy": "fill"},
+ Property::Map item3;
+ item3["policy"] = "fill";
+ //{ "policy": "fit"},
+ Property::Map item4;
+ item4["policy"] = "fit";
// Test "layoutRows" property
DALI_TEST_CHECK(tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ROWS) == TableView::Property::LAYOUT_ROWS);
* "layoutRows":
* {
* "1": { "policy": "fixed", "value": 30 },
- * "3": { "policy": "relative", "value": 0.2 }
+ * "3": { "policy": "relative", "value": 0.2 },
+ * "4": { "policy": "fill" },
+ * "6": { "policy": "fit" },
* }
*/
Property::Map layoutRows;
layoutRows["1"] = item1;
layoutRows["3"] = item2;
+ layoutRows["4"] = item3;
+ layoutRows["6"] = item4;
tableView.SetProperty(TableView::Property::LAYOUT_ROWS, layoutRows);
DALI_TEST_EQUALS(tableView.GetFixedHeight(1u), 30.f, TEST_LOCATION);
DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("relative") == 0);
DALI_TEST_EQUALS(childMap->Find("value")->Get<float>(), 0.2f, TEST_LOCATION);
+ childMap = layoutRowsGet.GetValue(4).GetMap();
+ DALI_TEST_CHECK(layoutRowsGet.GetKey(4).compare(layoutRows.GetKey(2)) == 0);
+ DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("fill") == 0);
+
+ childMap = layoutRowsGet.GetValue(6).GetMap();
+ DALI_TEST_CHECK(layoutRowsGet.GetKey(6).compare(layoutRows.GetKey(3)) == 0);
+ DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("fit") == 0);
+
// Test "layoutColumns" property
DALI_TEST_CHECK(tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_COLUMNS) == TableView::Property::LAYOUT_COLUMNS);
* "layoutColumns":
* {
* "2": { "policy": "relative", "value": 0.2 },
- * "3": { "policy": "fixed", "value": 30 }
+ * "3": { "policy": "fixed", "value": 30 },
+ * "5": { "policy": "fit" },
+ * "7": { "policy": "fill" }
* }
*/
Property::Map layoutColumns;
layoutColumns["2"] = item2;
layoutColumns["3"] = item1;
+ layoutColumns["5"] = item4;
+ layoutColumns["7"] = item3;
tableView.SetProperty(TableView::Property::LAYOUT_COLUMNS, layoutColumns);
DALI_TEST_EQUALS(tableView.GetRelativeWidth(2u), 0.2f, TEST_LOCATION);
DALI_TEST_EQUALS(tableView.GetFixedWidth(3u), 30.f, TEST_LOCATION);
Property::Map layoutColumnsGet = tableView.GetProperty(TableView::Property::LAYOUT_COLUMNS).Get<Property::Map>();
+
DALI_TEST_CHECK(layoutColumnsGet.GetKey(2).compare(layoutColumns.GetKey(0)) == 0);
childMap = layoutColumnsGet.GetValue(2).GetMap();
DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("relative") == 0);
DALI_TEST_EQUALS(childMap->Find("value")->Get<float>(), 0.2f, TEST_LOCATION);
+
childMap = layoutColumnsGet.GetValue(3).GetMap();
DALI_TEST_CHECK(layoutColumnsGet.GetKey(3).compare(layoutColumns.GetKey(1)) == 0);
DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("fixed") == 0);
DALI_TEST_EQUALS(childMap->Find("value")->Get<float>(), 30.f, TEST_LOCATION);
+ childMap = layoutColumnsGet.GetValue(5).GetMap();
+ DALI_TEST_CHECK(layoutColumnsGet.GetKey(5).compare(layoutColumns.GetKey(2)) == 0);
+ DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("fit") == 0);
+
+ childMap = layoutColumnsGet.GetValue(7).GetMap();
+ DALI_TEST_CHECK(layoutColumnsGet.GetKey(7).compare(layoutColumns.GetKey(3)) == 0);
+ DALI_TEST_CHECK(childMap->Find("policy")->Get<std::string>().compare("fill") == 0);
+
END_TEST;
}
#include <dali-scene3d/internal/light/light-impl.h>
// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
{
}
-void Light::Initialize()
+// From Internal::Control.
+
+void Light::OnInitialize()
{
- Self().SetProperty(Dali::Actor::Property::COLOR, Color::WHITE);
+ Actor self = Self();
+
+ // TODO : We need to check this is enough.
+ Toolkit::DevelControl::EnableCreateAccessible(Toolkit::Control::DownCast(self), false);
+
+ self.SetProperty(Dali::Actor::Property::COLOR, Color::WHITE);
// Directional Light setting
mLightSourceActor = Dali::CameraActor::New();
mLightSourceActor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
mLightSourceActor.SetProperty(Dali::Actor::Property::POSITION, Vector3::ZERO);
mLightSourceActor.SetProperty(Dali::Actor::Property::ORIENTATION, Quaternion());
- Self().Add(mLightSourceActor);
-}
-
-void Light::Enable(bool enable)
-{
- if(enable == mIsEnabled)
- {
- return;
- }
- mIsEnabled = enable;
-
- Scene3D::SceneView sceneView = mParentSceneView.GetHandle();
- if(!sceneView)
- {
- return;
- }
-
- if(mIsEnabled)
- {
- GetImpl(sceneView).AddLight(Scene3D::Light::DownCast(Self()));
- }
- else
- {
- GetImpl(sceneView).RemoveLight(Scene3D::Light::DownCast(Self()));
- }
-}
-
-bool Light::IsEnabled() const
-{
- return mIsEnabled;
-}
-
-void Light::EnableShadow(bool enable)
-{
- if(enable == mIsShadowEnabled)
- {
- return;
- }
- mIsShadowEnabled = enable;
-
- Scene3D::SceneView sceneView = mParentSceneView.GetHandle();
- if(!sceneView)
- {
- return;
- }
-
- if(mIsShadowEnabled)
- {
- GetImpl(sceneView).SetShadow(Scene3D::Light::DownCast(Self()));
- }
- else
- {
- GetImpl(sceneView).RemoveShadow(Scene3D::Light::DownCast(Self()));
- }
+ self.Add(mLightSourceActor);
}
-bool Light::IsShadowEnabled() const
-{
- return mIsShadowEnabled;
-}
-
-CameraActor Light::GetCamera() const
-{
- return mLightSourceActor;
-}
-
-void Light::EnableShadowSoftFiltering(bool useSoftFiltering)
-{
- mUseSoftFiltering = useSoftFiltering;
- UpdateShadowUniforms();
-}
-
-bool Light::IsShadowSoftFilteringEnabled() const
-{
- return mUseSoftFiltering;
-}
-
-void Light::SetShadowIntensity(float shadowIntensity)
-{
- mShadowIntensity = shadowIntensity;
- UpdateShadowUniforms();
-}
-
-float Light::GetShadowIntensity() const
-{
- return mShadowIntensity;
-}
-
-void Light::SetShadowBias(float shadowBias)
-{
- mShadowBias = shadowBias;
- UpdateShadowUniforms();
-}
-
-float Light::GetShadowBias() const
-{
- return mShadowBias;
-}
+// From CustomActorImpl.
void Light::OnSceneConnection(int depth)
{
// Public Method
+void Light::Enable(bool enable)
+{
+ if(enable == mIsEnabled)
+ {
+ return;
+ }
+ mIsEnabled = enable;
+
+ Scene3D::SceneView sceneView = mParentSceneView.GetHandle();
+ if(!sceneView)
+ {
+ return;
+ }
+
+ if(mIsEnabled)
+ {
+ GetImpl(sceneView).AddLight(Scene3D::Light::DownCast(Self()));
+ }
+ else
+ {
+ GetImpl(sceneView).RemoveLight(Scene3D::Light::DownCast(Self()));
+ }
+}
+
+bool Light::IsEnabled() const
+{
+ return mIsEnabled;
+}
+
+void Light::EnableShadow(bool enable)
+{
+ if(enable == mIsShadowEnabled)
+ {
+ return;
+ }
+ mIsShadowEnabled = enable;
+
+ Scene3D::SceneView sceneView = mParentSceneView.GetHandle();
+ if(!sceneView)
+ {
+ return;
+ }
+
+ if(mIsShadowEnabled)
+ {
+ GetImpl(sceneView).SetShadow(Scene3D::Light::DownCast(Self()));
+ }
+ else
+ {
+ GetImpl(sceneView).RemoveShadow(Scene3D::Light::DownCast(Self()));
+ }
+}
+
+bool Light::IsShadowEnabled() const
+{
+ return mIsShadowEnabled;
+}
+
+CameraActor Light::GetCamera() const
+{
+ return mLightSourceActor;
+}
+
+void Light::EnableShadowSoftFiltering(bool useSoftFiltering)
+{
+ mUseSoftFiltering = useSoftFiltering;
+ UpdateShadowUniforms();
+}
+
+bool Light::IsShadowSoftFilteringEnabled() const
+{
+ return mUseSoftFiltering;
+}
+
+void Light::SetShadowIntensity(float shadowIntensity)
+{
+ mShadowIntensity = shadowIntensity;
+ UpdateShadowUniforms();
+}
+
+float Light::GetShadowIntensity() const
+{
+ return mShadowIntensity;
+}
+
+void Light::SetShadowBias(float shadowBias)
+{
+ mShadowBias = shadowBias;
+ UpdateShadowUniforms();
+}
+
+float Light::GetShadowBias() const
+{
+ return mShadowBias;
+}
+
+// Public Static Method
+
uint32_t Light::GetMaximumEnabledLightCount()
{
return MAX_NUMBER_OF_LIGHT;
return SHADOW_VIEW_PROJECTION_MATRIX_STRING;
}
+// Private Method
+
void Light::UpdateShadowUniforms()
{
Scene3D::SceneView sceneView = mParentSceneView.GetHandle();
*/
static Scene3D::Light New();
- /**
- * @copydoc Scene3D::Light::Enable()
- */
- void Enable(bool enable);
-
- /**
- * @copydoc Scene3D::Light::IsEnabled()
- */
- bool IsEnabled() const;
-
- /**
- * @copydoc Scene3D::Light::EnableShadow()
- */
- void EnableShadow(bool enable);
-
- /**
- * @copydoc Scene3D::Light::IsShadowEnabled()
- */
- bool IsShadowEnabled() const;
-
- /**
- * @copydoc Scene3D::Light::GetCamera()
- */
- CameraActor GetCamera() const;
-
- /**
- * @copydoc Scene3D::Light::EnableShadowSoftFiltering()
- */
- void EnableShadowSoftFiltering(bool useSoftFiltering);
-
- /**
- * @copydoc Scene3D::Light::IsShadowSoftFilteringEnabled()
- */
- bool IsShadowSoftFilteringEnabled() const;
-
- /**
- * @copydoc Scene3D::Light::SetShadowIntensity()
- */
- void SetShadowIntensity(float shadowIntensity);
-
- /**
- * @copydoc Scene3D::Light::GetShadowIntensity()
- */
- float GetShadowIntensity() const;
-
- /**
- * @copydoc Scene3D::Light::SetShadowBias()
- */
- void SetShadowBias(float shadowBias);
-
- /**
- * @copydoc Scene3D::Light::GetShadowBias()
- */
- float GetShadowBias() const;
-
protected:
/**
* @brief Virtual destructor.
*/
virtual ~Light();
-protected: // From CustomActorImpl
+public: // From Internal::Control.
+ /**
+ * @copydoc Dali::Toolkit::Internal::Control::OnInitialize()
+ */
+ void OnInitialize() override;
+
+protected: // From CustomActorImpl. Note that it will make we can ignore many codes what Internal::Control using now.
/**
* @copydoc CustomActorImpl::OnSceneConnection()
* @note If overridden, then an up-call to Light::OnSceneConnection MUST be made at the end.
*/
Light();
+public: // Public Method
/**
- * @brief Second phase initialization.
+ * @copydoc Scene3D::Light::Enable()
*/
- void Initialize();
+ void Enable(bool enable);
-public: // Public Method
+ /**
+ * @copydoc Scene3D::Light::IsEnabled()
+ */
+ bool IsEnabled() const;
+
+ /**
+ * @copydoc Scene3D::Light::EnableShadow()
+ */
+ void EnableShadow(bool enable);
+
+ /**
+ * @copydoc Scene3D::Light::IsShadowEnabled()
+ */
+ bool IsShadowEnabled() const;
+
+ /**
+ * @copydoc Scene3D::Light::GetCamera()
+ */
+ CameraActor GetCamera() const;
+
+ /**
+ * @copydoc Scene3D::Light::EnableShadowSoftFiltering()
+ */
+ void EnableShadowSoftFiltering(bool useSoftFiltering);
+
+ /**
+ * @copydoc Scene3D::Light::IsShadowSoftFilteringEnabled()
+ */
+ bool IsShadowSoftFilteringEnabled() const;
+
+ /**
+ * @copydoc Scene3D::Light::SetShadowIntensity()
+ */
+ void SetShadowIntensity(float shadowIntensity);
+
+ /**
+ * @copydoc Scene3D::Light::GetShadowIntensity()
+ */
+ float GetShadowIntensity() const;
+
+ /**
+ * @copydoc Scene3D::Light::SetShadowBias()
+ */
+ void SetShadowBias(float shadowBias);
+
+ /**
+ * @copydoc Scene3D::Light::GetShadowBias()
+ */
+ float GetShadowBias() const;
+
+public: // Public Static Method
/**
* @copydoc Scene3D::Light::GetMaximumEnabledLightCount()
*/
#include <dali-scene3d/internal/model-components/model-node-impl.h>
// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
{
}
-void ModelNode::Initialize()
-{
- OnInitialize();
-}
+// From Internal::Control.
void ModelNode::OnInitialize()
{
Actor self = Self();
+
+ // TODO : We need to check this is enough.
+ Toolkit::DevelControl::EnableCreateAccessible(Toolkit::Control::DownCast(self), false);
+
self.RegisterProperty("uIsShadowCasting", static_cast<int>(mIsShadowCasting));
self.RegisterProperty("uIsShadowReceiving", static_cast<int>(mIsShadowReceiving));
}
+// From CustomActorImpl.
+
void ModelNode::OnSceneConnection(int depth)
{
}
*/
virtual ~ModelNode();
-protected: // From CustomActorImpl
+public: // From Internal::Control.
+ /**
+ * @copydoc Dali::Toolkit::Internal::Control::OnInitialize()
+ */
+ void OnInitialize() override;
+
+protected: // From CustomActorImpl. Note that it will make we can ignore many codes what Internal::Control using now.
/**
* @copydoc CustomActorImpl::OnSceneConnection()
* @note If overridden, then an up-call to ModelNode::OnSceneConnection MUST be made at the end.
*/
ModelNode();
- /**
- * @brief Second phase initialization.
- * @SINCE_2_2.99
- */
- void Initialize();
-
-public: // API for derived classes to override
- // Lifecycle
-
- /**
- * @brief This method is called after the Node has been initialized.
- *
- * Derived classes should do any second phase initialization by overriding this method.
- * @SINCE_2_2.99
- */
- virtual void OnInitialize();
-
public: // Public Method
/**
* @copydoc Dali::Scene3D::ModelNode::GetModelPrimitiveCount()
* @details Name "viewBox", type Property::VECTOR2.
*/
VIEW_BOX = PROPERTY_START_INDEX,
+
+ /**
+ * @brief Whether to load the canvas synchronously.
+ * @details Name "synchronousLoading", type Property::BOOLEAN.
+ */
+ SYNCHRONOUS_LOADING,
};
};
public:
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/public-api/object/type-info.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const
{
- std::unordered_map<std::string, std::string> attributeMap;
- auto control = Dali::Toolkit::Control::DownCast(Self());
- auto attribute = control.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
- auto map = attribute.GetMap();
+ static const std::string automationIdKey = "automationId";
+ static const std::string classKey = "class";
- if(map)
+ Accessibility::Attributes result;
+ Toolkit::Control control = Toolkit::Control::DownCast(Self());
+ Dali::Property::Value property = control.GetProperty(DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
+ Dali::Property::Map* attributeMap = property.GetMap();
+ std::size_t attributeCount = attributeMap ? attributeMap->Count() : 0U;
+
+ for(std::size_t i = 0; i < attributeCount; i++)
{
- auto mapSize = map->Count();
+ Dali::Property::Key mapKey = attributeMap->GetKeyAt(i);
+ std::string mapValue;
- for(unsigned int i = 0; i < mapSize; i++)
+ if(mapKey.type == Dali::Property::Key::STRING && attributeMap->GetValue(i).Get(mapValue))
{
- auto mapKey = map->GetKeyAt(i);
- if(mapKey.type == Dali::Property::Key::STRING)
- {
- std::string mapValue;
- if(map->GetValue(i).Get(mapValue))
- {
- attributeMap.emplace(std::move(mapKey.stringKey), std::move(mapValue));
- }
- }
+ result.emplace(std::move(mapKey.stringKey), std::move(mapValue));
}
}
- auto automationId = control.GetProperty<std::string>(Dali::Toolkit::DevelControl::Property::AUTOMATION_ID);
+ auto automationId = control.GetProperty<std::string>(DevelControl::Property::AUTOMATION_ID);
if(!automationId.empty())
{
- attributeMap.emplace("automationId", std::move(automationId));
+ result.emplace(automationIdKey, std::move(automationId));
+ }
+
+ // Add "class" if not present already
+ if(result.find(classKey) == result.end())
+ {
+ Dali::TypeInfo typeInfo;
+ Self().GetTypeInfo(typeInfo);
+ if(typeInfo)
+ {
+ const std::string& typeName = typeInfo.GetName();
+
+ result.emplace(classKey, typeName);
+
+ // Save the 'typeName' so we don't have to calculate it again
+ DevelControl::AppendAccessibilityAttribute(control, classKey, typeName);
+ }
}
- return attributeMap;
+ return result;
}
bool ControlAccessible::IsHidden() const
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
// If we find "{","}" pair but can't find matched constant
// try to find other "{","}" pair after current left position.
- pos = leftPos + 1;
+ pos = rightPos + 1;
for(uint32_t i = 0; i < mReplacementMap.Count(); i++)
{
if(0 == stringConfigValue.compare(leftPos + 1, rightPos - leftPos - 1, constant.stringKey))
{
std::string replaceString;
- mReplacementMap.GetValue(i).Get(replaceString);
-
- stringConfigValue.replace(leftPos, rightPos - leftPos + 1, replaceString);
- pos = leftPos + replaceString.size();
- break;
+ if(DALI_LIKELY(mReplacementMap.GetValue(i).Get(replaceString)))
+ {
+ stringConfigValue.replace(leftPos, rightPos - leftPos + 1, replaceString);
+ pos = leftPos + replaceString.size();
+ break;
+ }
}
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
std::vector<std::string> tips;
size_t tipsCount = tipArray->Count();
tips.resize(tipsCount);
+
+ bool valid = true;
for(size_t i = 0; i != tipsCount; ++i)
{
- tipArray->GetElementAt(i).Get(tips[i]);
+ if(DALI_UNLIKELY(!tipArray->GetElementAt(i).Get(tips[i])))
+ {
+ // Given array is invalid. Fast out.
+ valid = false;
+ break;
+ }
+ }
+
+ if(DALI_LIKELY(valid))
+ {
+ toggleButtonImpl.SetToggleTooltips(tips);
}
- toggleButtonImpl.SetToggleTooltips(tips);
}
break;
}
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN(Toolkit::CanvasView, Toolkit::Control, Create);
DALI_PROPERTY_REGISTRATION(Toolkit, CanvasView, "viewBox", VECTOR2, VIEW_BOX)
+DALI_PROPERTY_REGISTRATION(Toolkit, CanvasView, "synchronousLoading", BOOLEAN, SYNCHRONOUS_LOADING)
DALI_TYPE_REGISTRATION_END()
} // anonymous namespace
mCanvasRenderer(CanvasRenderer::New(viewBox)),
mTexture(),
mTextureSet(),
- mSize(viewBox)
+ mSize(viewBox),
+ mIsSynchronous(true)
{
}
}
break;
}
+ case Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING:
+ {
+ bool isSynchronous;
+ if(value.Get(isSynchronous))
+ {
+ canvasViewImpl.SetSynchronous(isSynchronous);
+ }
+ break;
+ }
}
}
}
value = canvasViewImpl.GetViewBox();
break;
}
+ case Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING:
+ {
+ value = canvasViewImpl.IsSynchronous();
+ break;
+ }
}
}
return value;
if(mCanvasRenderer.Commit())
{
- AsyncTaskManager::Get().AddTask(mRasterizingTask);
+ if(mIsSynchronous)
+ {
+ mRasterizingTask->Process();
+ ApplyRasterizedImage(mRasterizingTask);
+ mRasterizingTask.Reset(); // We don't need it anymore.
+ }
+ else
+ {
+ AsyncTaskManager::Get().AddTask(mRasterizingTask);
+ }
}
}
mRasterizingTask.Reset(); // We don't need it anymore
//If there are accumulated changes to CanvasRenderer during Rasterize, Rasterize once again.
- if(mCanvasRenderer && mCanvasRenderer.IsCanvasChanged())
+ if(!mIsSynchronous && mCanvasRenderer && mCanvasRenderer.IsCanvasChanged())
{
AddRasterizationTask();
}
}
return Vector2::ZERO;
}
+
+void CanvasView::SetSynchronous(const bool isSynchronous)
+{
+ mIsSynchronous = isSynchronous;
+}
+
+const bool CanvasView::IsSynchronous()
+{
+ return mIsSynchronous;
+}
+
} // namespace Internal
} // namespace Toolkit
} // namespace Dali
const Vector2& GetViewBox();
/**
+ * @brief Set to load the canvas synchronously.
+ *
+ * @param isSynchronous The synchronous
+ */
+ void SetSynchronous(const bool isSynchronous);
+
+ /**
+ * @brief Whether to load the canvas synchronously.
+ *
+ * @return Returns true if synchronously.
+ */
+ const bool IsSynchronous();
+
+ /**
* @bried Rasterize the canvas, and add it to the view.
*
* @param[in] size The target size of the canvas view rasterization.
TextureSet mTextureSet;
Vector2 mSize;
CanvasRendererRasterizingTaskPtr mRasterizingTask;
+ bool mIsSynchronous;
};
} // namespace Internal
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
*/
void InitializeOffscreenFramebuffers()
{
+ std::scoped_lock<std::recursive_mutex> lock(mTextureQueueMutex);
for(auto i = 0u; i < mCreateInfo.maxOffscreenBuffers; ++i)
{
mFramebufferTexture.emplace_back();
constexpr float FULL_OPACITY = 1.0f;
constexpr float LOW_OPACITY = 0.2f;
+constexpr float TRANSITION_EFFECT_SPEED = 0.3f;
BaseHandle Create()
{
if(handle)
{
- mTransitionAnimation = Animation::New(1.5f);
+ mTransitionAnimation = Animation::New(TRANSITION_EFFECT_SPEED);
mTransitionAnimation.SetEndAction(Animation::EndAction::DISCARD);
float destinationAlpha = (mTransitionTargetAlpha > LOW_OPACITY) ? mTransitionTargetAlpha : LOW_OPACITY;
- if(mPreviousVisual) // Transition previous image
- {
- Dali::KeyFrames fadeoutKeyFrames = Dali::KeyFrames::New();
- fadeoutKeyFrames.Add(0.0f, destinationAlpha);
- fadeoutKeyFrames.Add(1.0f, LOW_OPACITY);
- Internal::Visual::Base& visualImpl = Toolkit::GetImplementation(mPreviousVisual);
- mTransitionAnimation.AnimateBetween(visualImpl.GetPropertyObject(Toolkit::Visual::Property::OPACITY), fadeoutKeyFrames);
- }
- else if(mPlaceholderVisual) // Transition placeholder
- {
- Dali::KeyFrames fadeoutKeyFrames = Dali::KeyFrames::New();
- fadeoutKeyFrames.Add(0.0f, destinationAlpha);
- fadeoutKeyFrames.Add(1.0f, LOW_OPACITY);
- Internal::Visual::Base& visualImpl = Toolkit::GetImplementation(mPlaceholderVisual);
- mTransitionAnimation.AnimateBetween(visualImpl.GetPropertyObject(Toolkit::Visual::Property::OPACITY), fadeoutKeyFrames);
- }
-
// Transition current image
Toolkit::Visual::Base imageVisual = DevelControl::GetVisual(*this, Toolkit::ImageView::Property::IMAGE);
if(imageVisual)
Dali::KeyFrames fadeinKeyFrames = Dali::KeyFrames::New();
fadeinKeyFrames.Add(0.0f, LOW_OPACITY);
fadeinKeyFrames.Add(1.0f, destinationAlpha);
- mTransitionAnimation.AnimateBetween(DevelControl::GetVisualProperty(handle, Toolkit::ImageView::Property::IMAGE, Toolkit::Visual::Property::OPACITY), fadeinKeyFrames);
+ mTransitionAnimation.AnimateBetween(DevelControl::GetVisualProperty(handle, Toolkit::ImageView::Property::IMAGE, Toolkit::Visual::Property::OPACITY), fadeinKeyFrames, AlphaFunction::EASE_IN_OUT);
}
// Play transition animation
if(propertyIndex == Toolkit::SuperBlurView::Property::IMAGE_URL)
{
- value.Get(superBlurViewImpl.mUrl);
-
- PixelData pixels = SyncImageLoader::Load(superBlurViewImpl.mUrl);
-
- if(pixels)
- {
- Texture texture = Texture::New(TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight());
- texture.Upload(pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight());
-
- superBlurViewImpl.SetTexture(texture);
- }
- else
+ if(DALI_LIKELY(value.Get(superBlurViewImpl.mUrl)))
{
- DALI_LOG_ERROR("Cannot create image from property value\n");
+ PixelData pixels = SyncImageLoader::Load(superBlurViewImpl.mUrl);
+
+ if(pixels)
+ {
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight());
+ texture.Upload(pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight());
+
+ superBlurViewImpl.SetTexture(texture);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Cannot create image from property value\n");
+ }
}
}
}
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
std::istringstream(map->GetKey(i)) >> index;
if(childMap)
{
- Property::Value* policy = childMap->Find("policy");
- Property::Value* childMapValue = childMap->Find("value");
- if(policy && childMapValue)
+ Property::Value* policy = childMap->Find("policy");
+ if(policy)
{
std::string policyValue;
- policy->Get(policyValue);
- Toolkit::TableView::LayoutPolicy policy;
- if(Scripting::GetEnumeration<Toolkit::TableView::LayoutPolicy>(policyValue.c_str(),
- LAYOUT_POLICY_STRING_TABLE,
- LAYOUT_POLICY_STRING_TABLE_COUNT,
- policy))
+ if(DALI_LIKELY(policy->Get(policyValue)))
{
- if(policy == Toolkit::TableView::FIXED)
+ Toolkit::TableView::LayoutPolicy policy;
+ if(Scripting::GetEnumeration<Toolkit::TableView::LayoutPolicy>(policyValue.c_str(),
+ LAYOUT_POLICY_STRING_TABLE,
+ LAYOUT_POLICY_STRING_TABLE_COUNT,
+ policy))
{
- (tableViewImpl.*funcFixed)(index, childMapValue->Get<float>());
- }
- else if(policy == Toolkit::TableView::RELATIVE)
- {
- (tableViewImpl.*funcRelative)(index, childMapValue->Get<float>());
- }
- else if(policy == Toolkit::TableView::FIT)
- {
- (tableViewImpl.*funcFit)(index);
+ switch(policy)
+ {
+ case Toolkit::TableView::FIXED:
+ case Toolkit::TableView::RELATIVE:
+ {
+ Property::Value* childMapValue = childMap->Find("value");
+ float childValue = 0.0f;
+ if(DALI_LIKELY(childMapValue && childMapValue->Get(childValue)))
+ {
+ if(policy == Toolkit::TableView::FIXED)
+ {
+ (tableViewImpl.*funcFixed)(index, childValue);
+ }
+ else // if(policy == Toolkit::TableView::RELATIVE)
+ {
+ (tableViewImpl.*funcRelative)(index, childValue);
+ }
+ }
+ break;
+ }
+ case Toolkit::TableView::FIT:
+ {
+ (tableViewImpl.*funcFit)(index);
+ break;
+ }
+ default:
+ {
+ // do nothing for FILL policy
+ break;
+ }
+ }
}
- // do nothing for FILL policy
}
}
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
if(type == Property::STRING)
{
- value.Get(mBackgroundImage);
- mBackgroundBorder.Set(0, 0, 0, 0);
+ if(DALI_LIKELY(value.Get(mBackgroundImage)))
+ {
+ mBackgroundBorder.Set(0, 0, 0, 0);
+ }
}
else if(type == Property::MAP)
{
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
mRendererAdded(false),
mCoreShutdown(false),
mRedrawInScalingDown(true),
- mEnableFrameCache(false)
+ mEnableFrameCache(false),
+ mUseNativeImage(false)
{
// the rasterized image is with pre-multiplied alpha format
mImpl->mFlags |= Visual::Base::Impl::IS_PREMULTIPLIED_ALPHA;
Vector2 imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize, false);
actor.AddRenderer(mImpl->mRenderer);
+ mRendererAdded = true;
ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
}
else
else
{
mLoadFailed = status == VectorAnimationTask::ResourceStatus::FAILED ? true : false;
+ if(status == VectorAnimationTask::ResourceStatus::READY)
+ {
+ // Texture was ready. Change the shader if we need.
+ bool useNativeImage = false;
+ if(mImpl->mRenderer)
+ {
+ auto textureSet = mImpl->mRenderer.GetTextures();
+ if(textureSet && textureSet.GetTextureCount() > 0)
+ {
+ auto texture = textureSet.GetTexture(0u);
+ if(texture)
+ {
+ useNativeImage = DevelTexture::IsNative(texture);
+
+ if(mUseNativeImage != useNativeImage)
+ {
+ mUseNativeImage = useNativeImage;
+ UpdateShader();
+ }
+ }
+ }
+ }
+ }
// If weak handle is holding a placement actor, it is the time to add the renderer to actor.
Actor actor = mPlacementActor.GetHandle();
mFactoryCache,
ImageVisualShaderFeatureBuilder()
.EnableRoundedCorner(IsRoundedCornerRequired())
- .EnableBorderline(IsBorderlineRequired()));
+ .EnableBorderline(IsBorderlineRequired())
+ .SetTextureForFragmentShaderCheck(mUseNativeImage ? mImpl->mRenderer.GetTextures().GetTexture(0) : Dali::Texture()));
}
return shader;
}
#define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
WeakHandle<Actor> mPlacementActor;
DevelImageVisual::PlayState::Type mPlayState;
CallbackBase* mEventCallback; // Not owned
- bool mLoadFailed;
- bool mRendererAdded;
- bool mCoreShutdown;
- bool mRedrawInScalingDown;
- bool mEnableFrameCache;
+
+ bool mLoadFailed : 1;
+ bool mRendererAdded : 1;
+ bool mCoreShutdown : 1;
+ bool mRedrawInScalingDown : 1;
+ bool mEnableFrameCache : 1;
+ bool mUseNativeImage : 1;
};
} // namespace Internal
(mFragmentShaderNeedChange == ImageVisualShaderFeature::ChangeFragmentShader::UNDECIDED ||
mFragmentShaderNeedChange == ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE))
{
+ DALI_ASSERT_DEBUG((static_cast<int>(shaderType) >= static_cast<int>(VisualFactoryCache::IMAGE_SHADER)) &&
+ (static_cast<int>(shaderType) <= static_cast<int>(VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP)) &&
+ "Do not support native image shader for given feature!!");
shaderType = static_cast<VisualFactoryCache::ShaderType>(static_cast<int>(shaderType) + NATIVE_SHADER_TYPE_OFFSET);
}
NATIVE_IMAGE_SHADER_ROUNDED_CORNER_MASKING,
NATIVE_IMAGE_SHADER_BORDERLINE_MASKING,
NATIVE_IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING,
+ NATIVE_IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
+ NATIVE_IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
NINE_PATCH_SHADER,
NINE_PATCH_MASK_SHADER,
TEXT_SHADER_SINGLE_COLOR_TEXT,
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NATIVE_IMAGE_SHADER_ROUNDED_CORNER_MASKING)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NATIVE_IMAGE_SHADER_BORDERLINE_MASKING)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NATIVE_IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NATIVE_IMAGE_SHADER_ATLAS_DEFAULT_WRAP)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NATIVE_IMAGE_SHADER_ATLAS_CUSTOM_WRAP)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NINE_PATCH_SHADER)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, NINE_PATCH_MASK_SHADER)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Internal::VisualFactoryCache::ShaderType, TEXT_SHADER_SINGLE_COLOR_TEXT)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/integration-api/debug.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/math/math-utils.h>
-#include <dali/public-api/object/type-info.h>
-#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <cstring> // for strcmp
#include <limits>
#include <stack>
-#include <typeinfo>
// INTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
{
SetKeyboardNavigationSupport(true);
}
-
- Dali::TypeInfo type;
- Self().GetTypeInfo(type);
- if(type)
- {
- const auto& typeName = type.GetName();
- DevelControl::AppendAccessibilityAttribute(Toolkit::Control::DownCast(Self()), "class", typeName);
- }
}
void Control::OnInitialize()
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 3;
-const unsigned int TOOLKIT_MICRO_VERSION = 14;
+const unsigned int TOOLKIT_MICRO_VERSION = 15;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.3.14
+Version: 2.3.15
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT