- This patch adds post processor that works after relayout.
Change-Id: I194763b5f512517c6a385c27f0b0728f6fcddfc4
Signed-off-by: seungho <sbsh.baek@samsung.com>
/*
- * 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.
{
}
- virtual void Process()
+ virtual void Process(bool postProcessor)
{
processRun = true;
}
DALI_TEST_CHECK(testProcessor3.processRun);
END_TEST;
+}
+
+int UtcDaliCorePostProcessorP(void)
+{
+ TestApplication application;
+
+ TestProcessor testProcessor;
+ Integration::Core& core = application.GetCore();
+ core.RegisterProcessor(testProcessor, true);
+
+ tet_infoline("Test that the processor has not been executed yet:");
+ DALI_TEST_CHECK(testProcessor.processRun == false);
+
+ application.SendNotification();
+
+ tet_infoline("Test that the processor has been executed:");
+ DALI_TEST_CHECK(testProcessor.processRun);
+
+ // Clear down for next part of test
+ testProcessor.processRun = false;
+
+ core.UnregisterProcessor(testProcessor);
+ application.SendNotification();
+ tet_infoline("Test that the processor is still executed:");
+ DALI_TEST_CHECK(testProcessor.processRun);
+
+ // Clear down for next part of test
+ testProcessor.processRun = false;
+
+ core.UnregisterProcessor(testProcessor, true);
+ application.SendNotification();
+ tet_infoline("Test that the processor has not been executed again:");
+ DALI_TEST_CHECK(testProcessor.processRun == false);
+
+ END_TEST;
}
\ No newline at end of file
mImpl->PostRender(uploadOnly);
}
-void Core::RegisterProcessor(Processor& processor)
+void Core::RegisterProcessor(Processor& processor, bool postProcessor)
{
- mImpl->RegisterProcessor(processor);
+ mImpl->RegisterProcessor(processor, postProcessor);
}
-void Core::UnregisterProcessor(Processor& processor)
+void Core::UnregisterProcessor(Processor& processor, bool postProcessor)
{
- mImpl->UnregisterProcessor(processor);
+ mImpl->UnregisterProcessor(processor, postProcessor);
}
ObjectRegistry Core::GetObjectRegistry() const
*
* Note, Core does not take ownership of this processor.
* @param[in] processor The process to register
+ * @param[in] postProcessor set this processor required to be called after size negotiation. Default is false.
*/
- void RegisterProcessor(Processor& processor);
+ void RegisterProcessor(Processor& processor, bool postProcessor = false);
/**
* @brief Unregister a processor
* @param[in] processor The process to unregister
+ * @param[in] postProcessor True if the processor to be unregister is for post processor.
*/
- void UnregisterProcessor(Processor& processor);
+ void UnregisterProcessor(Processor& processor, bool postProcessor = false);
/**
* @brief Gets the Object registry.
#define DALI_INTEGRATION_PROCESSOR_INTERFACE_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.
/**
* @brief Run the processor
*/
- virtual void Process() = 0;
+ virtual void Process(bool postProcessor = false) = 0;
protected:
/**
// Run the size negotiation after event processing finished signal
mRelayoutController->Relayout();
+ // Run any registered post processors
+ RunPostProcessors();
+
// Rebuild depth tree after event processing has finished
for(auto scene : scenes)
{
return MAXIMUM_UPDATE_COUNT;
}
-void Core::RegisterProcessor(Integration::Processor& processor)
+void Core::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
{
- mProcessors.PushBack(&processor);
+ if(postProcessor)
+ {
+ mPostProcessors.PushBack(&processor);
+ }
+ else
+ {
+ mProcessors.PushBack(&processor);
+ }
}
-void Core::UnregisterProcessor(Integration::Processor& processor)
+void Core::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
{
- auto iter = std::find(mProcessors.Begin(), mProcessors.End(), &processor);
- if(iter != mProcessors.End())
+ if(postProcessor)
{
- mProcessors.Erase(iter);
+ auto iter = std::find(mPostProcessors.Begin(), mPostProcessors.End(), &processor);
+ if(iter != mPostProcessors.End())
+ {
+ mPostProcessors.Erase(iter);
+ }
+ }
+ else
+ {
+ auto iter = std::find(mProcessors.Begin(), mProcessors.End(), &processor);
+ if(iter != mProcessors.End())
+ {
+ mProcessors.Erase(iter);
+ }
}
}
{
if(processor)
{
- processor->Process();
+ processor->Process(false);
+ }
+ }
+}
+
+void Core::RunPostProcessors()
+{
+ // Copy processor pointers to prevent changes to vector affecting loop iterator.
+ Dali::Vector<Integration::Processor*> processors(mPostProcessors);
+
+ for(auto processor : processors)
+ {
+ if(processor)
+ {
+ processor->Process(true);
}
}
}
/**
* @copydoc Dali::Integration::Core::RegisterProcessor
*/
- void RegisterProcessor(Dali::Integration::Processor& processor);
+ void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
/**
* @copydoc Dali::Integration::Core::UnregisterProcessor
*/
- void UnregisterProcessor(Dali::Integration::Processor& processor);
+ void UnregisterProcessor(Dali::Integration::Processor& processor, bool postProcessor = false);
/**
* @copydoc Dali::Internal::ThreadLocalStorage::AddScene()
*/
void RunProcessors();
+ /**
+ * Run each registered postprocessor
+ */
+ void RunPostProcessors();
+
// for use by ThreadLocalStorage
/**
OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
+ Dali::Vector<Integration::Processor*> mPostProcessors; ///< Registered post processors those will called after relayout(not owned)
using SceneContainer = std::vector<ScenePtr>;
SceneContainer mScenes; ///< A container of scenes that bound to a surface for rendering, owned by Core