X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fstage-impl.h;h=a6aa52e6c673863fb32e5b287f4b2ee9fb706347;hb=9697546f6395000a500259997c415d9ff3c2e337;hp=b276cc4e809ac9359784145194236f28f1ed51c4;hpb=ce20e9f082e811130930d13c9e9edc1da4ce1013;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/stage-impl.h b/dali/internal/event/common/stage-impl.h index b276cc4..a6aa52e 100644 --- a/dali/internal/event/common/stage-impl.h +++ b/dali/internal/event/common/stage-impl.h @@ -1,36 +1,41 @@ -#ifndef __DALI_INTERNAL_STAGE_H__ -#define __DALI_INTERNAL_STAGE_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +#ifndef DALI_INTERNAL_STAGE_H +#define DALI_INTERNAL_STAGE_H + +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES #include #include +#include #include +#include #include #include +#include #include #include -#include #include #include +#include #include #include #include +#include namespace Dali { @@ -40,7 +45,7 @@ struct Vector2; namespace Integration { class SystemOverlay; -class DynamicsFactory; +class RenderController; } namespace Internal @@ -62,27 +67,29 @@ class RenderTaskList; /** * Implementation of Stage */ -class Stage : public BaseObject, public RenderTaskDefaults +class Stage : public BaseObject, public RenderTaskDefaults, public Integration::ContextNotifierInterface, public EventThreadServices { public: /** * Create the stage - * @param playlist for animations - * @param dynamicsNotifier - * @param updateManager - * @param notificationManager + * @param[in] playlist for animations + * @param[in] propertyNotificationManager + * @param[in] updateManager + * @param[in] notificationManager + * @param[in] renderController */ static StagePtr New( AnimationPlaylist& playlist, PropertyNotificationManager& propertyNotificationManager, - DynamicsNotifier& dynamicsNotifier, SceneGraph::UpdateManager& updateManager, - NotificationManager& notificationManager ); + NotificationManager& notificationManager, + Integration::RenderController& renderController ); /** * Initialize the stage. + * @param[in] renderToFbo Whether to render into a Frame Buffer Object. */ - void Initialize(); + void Initialize( bool renderToFbo ); /** * Uninitialize the stage. @@ -91,6 +98,7 @@ public: /** * @copydoc Dali::Stage::GetCurrent() + * @note this version is for internal usage so it does not assert */ static StagePtr GetCurrent(); @@ -111,28 +119,6 @@ public: Layer& GetRootActor(); /** - * Retrieve the UpdateManager associated with this Stage - * @return The UpdateManager. - */ - SceneGraph::UpdateManager& GetUpdateManager(); - - /** - * Helper for actors, to retrieve the current Event buffer index. - * @return The buffer index. - */ - BufferIndex GetEventBufferIndex() const - { - // inlined as its called often from event thread - return mUpdateManager.GetEventBufferIndex(); - } - - /** - * Retrieve the interface for accessing update-thread data. - * @return The EventToUpdate interface. - */ - EventToUpdate& GetUpdateInterface(); - - /** * Returns the animation playlist. * @return reference to the animation playlist. */ @@ -144,12 +130,6 @@ public: */ PropertyNotificationManager& GetPropertyNotificationManager(); - /** - * Return the Dynamics Simulation Notifier object - * @return The Dynamics Simulation Notifier object - */ - DynamicsNotifier& GetDynamicsNotifier(); - // Root actor accessors /** @@ -163,11 +143,20 @@ public: void Remove( Actor& actor ); /** - * Sets the size of the stage and indirectly, the root actor. - * @param [in] width The new width. - * @param [in] height The new height. + * Used to calculate the size of the stage and indirectly, the root actor. + * @param [in] width The new surface width. + * @param [in] height The new surface height. + */ + void SurfaceResized( float width, float height ); + + /** + * Sets the top margin size. + * Available stage size is reduced by this size. + * The stage is located below the size at the top of the display + * initial size is zero before it is assigned + * @param[in] margin margin size */ - void SetSize( float width, float height ); + void SetTopMargin( uint32_t margin ); /** * Returns the size of the Stage in pixels as a Vector. @@ -188,6 +177,11 @@ public: void CreateDefaultCameraActor(); /** + * Set position of default camera for current stage size + */ + void SetDefaultCameraPosition(); + + /** * From RenderTaskDefaults; retrieve the default root actor. * @return The default root actor. */ @@ -204,12 +198,12 @@ public: /** * @copydoc Dali::Stage::GetLayerCount() */ - unsigned int GetLayerCount() const; + uint32_t GetLayerCount() const; /** * @copydoc Dali::Stage::GetLayer() */ - Dali::Layer GetLayer( unsigned int depth ) const; + Dali::Layer GetLayer( uint32_t depth ) const; /** * @copydoc Dali::Stage::GetRootLayer() @@ -235,6 +229,28 @@ public: */ SystemOverlay* GetSystemOverlayInternal(); + // Stereoscopy + + /** + * @copydoc Dali::Integration::Core::SetViewMode() + */ + void SetViewMode( ViewMode viewMode ); + + /** + * @copydoc Dali::Integration::Core::GetViewMode() + */ + ViewMode GetViewMode() const; + + /** + * @copydoc Dali::Integration::Core::SetStereoBase() + */ + void SetStereoBase( float stereoBase ); + + /** + * @copydoc Dali::Integration::Core::GetStereoBase() + */ + float GetStereoBase() const; + // Keyboard stuff /** @@ -279,21 +295,6 @@ public: */ void SetDpi( Vector2 dpi ); - /** - * @copydoc Dali::Stage::InitializeDynamics - */ - DynamicsWorldPtr InitializeDynamics(DynamicsWorldConfigPtr config); - - /** - * @copydoc Dali::Stage::GetDynamicsWorld - */ - DynamicsWorldPtr GetDynamicsWorld(); - - /** - * @copydoc Dali::Stage::TerminateDynamics - */ - void TerminateDynamics(); - NotificationManager& GetNotificationManager() { return mNotificationManager; @@ -305,12 +306,29 @@ public: void KeepRendering( float durationSeconds ); /** + * @copydoc Dali::DevelStage::SetRenderingBehavior() + */ + void SetRenderingBehavior( DevelStage::Rendering renderingBehavior ); + + /** + * @copydoc Dali::DevelStage::GetRenderingBehavior() + */ + DevelStage::Rendering GetRenderingBehavior() const; + + /** * Used by the EventProcessor to emit key event signals. * @param[in] event The key event. */ void EmitKeyEventSignal(const KeyEvent& event); /** + * Used by the KeyEventProcessor to emit KeyEventGenerated signals. + * @param[in] event The key event. + * @return The return is true if KeyEvent is consumed, otherwise false. + */ + bool EmitKeyEventGeneratedSignal(const KeyEvent& event); + + /** * Emits the event processing finished signal. * * @see Dali::Stage::SignalEventProcessingFinished() @@ -319,24 +337,152 @@ public: /** * Emits the touched signal. + * @param[in] touchEvent The touch event details (Old API). * @param[in] touch The touch event details. */ - void EmitTouchedSignal( const TouchEvent& touch ); + void EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch ); + + /** + * Used by the EventProcessor to emit wheel event signals. + * @param[in] event The wheel event. + */ + void EmitWheelEventSignal( const WheelEvent& event ); + + /** + * Emits the scene created. + */ + void EmitSceneCreatedSignal(); /** * @copydoc Dali::Stage::KeyEventSignal() */ - Dali::Stage::KeyEventSignalV2& KeyEventSignal(); + Dali::Stage::KeyEventSignalType& KeyEventSignal(); /** * @copydoc Dali::Stage::SignalEventProcessingFinished() */ - Dali::Stage::EventProcessingFinishedSignalV2& EventProcessingFinishedSignal(); + Dali::Stage::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); /** * @copydoc Dali::Stage::TouchedSignal() */ - Dali::Stage::TouchedSignalV2& TouchedSignal(); + Dali::Stage::TouchedSignalType& TouchedSignal(); + + /** + * @copydoc Dali::Stage::TouchSignal() + */ + Dali::Stage::TouchSignalType& TouchSignal(); + + /** + * @copydoc Dali::Stage::WheelEventSignal() + */ + Dali::Stage::WheelEventSignalType& WheelEventSignal(); + + /** + * @copydoc Dali::Stage::ContextLostSignal() + */ + Dali::Stage::ContextStatusSignal& ContextLostSignal(); + + /** + * @copydoc Dali::Stage::ContextRegainedSignal() + */ + Dali::Stage::ContextStatusSignal& ContextRegainedSignal(); + + /** + * @copydoc Dali::Stage::SceneCreatedSignal() + */ + Dali::Stage::SceneCreatedSignalType& SceneCreatedSignal(); + + /** + * @copydoc Dali::DevelStage::KeyEventGeneratedSignal() + */ + Dali::DevelStage::KeyEventGeneratedSignalType& KeyEventGeneratedSignal(); + + /** + * @copydoc Dali::DevelStage::AddFrameCallback() + */ + void AddFrameCallback( FrameCallbackInterface& frameCallback, Actor& rootActor ); + + /** + * @copydoc Dali::DevelStage::RemoveFrameCallback() + */ + void RemoveFrameCallback( FrameCallbackInterface& frameCallback ); + + /** + * Connects a callback function with the object's signals. + * @param[in] object The object providing the signal. + * @param[in] tracker Used to disconnect the signal. + * @param[in] signalName The signal to connect to. + * @param[in] functor A newly allocated FunctorDelegate. + * @return True if the signal was connected. + * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. + */ + static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + +private: // Implementation of ContextNotificationInterface: + + /** + * @copydoc Dali::Integration::NotifyContextLost(); + */ + virtual void NotifyContextLost(); + + /** + * @copydoc Dali::Integration::NotifyContextRegained(); + */ + virtual void NotifyContextRegained(); + +public: // Implementation of EventThreadServices + + /** + * @copydoc EventThreadServices::RegisterObject + */ + virtual void RegisterObject( BaseObject* object); + + /** + * @copydoc EventThreadServices::UnregisterObject + */ + virtual void UnregisterObject( BaseObject* object); + + /** + * @copydoc EventThreadServices::GetUpdateManager + */ + virtual SceneGraph::UpdateManager& GetUpdateManager(); + + /** + * @copydoc EventThreadServices::GetRenderController + */ + virtual Integration::RenderController& GetRenderController(); + + /** + * @copydoc EventThreadServices::ReserveMessageSlot + */ + virtual uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene ); + + /** + * @copydoc EventThreadServices::GetEventBufferIndex + */ + virtual BufferIndex GetEventBufferIndex() const; + + /** + * @copydoc EventThreadServices::ForceNextUpdate + */ + virtual void ForceNextUpdate(); + + /** + * @copydoc EventThreadServices::IsNextUpdateForced + */ + virtual bool IsNextUpdateForced(); + + /** + * Request that the depth tree is rebuilt + */ + void RequestRebuildDepthTree(); + + /** + * Rebuilds the depth tree at the end of the event frame if + * it was requested this frame. + */ + void RebuildDepthTree(); private: @@ -345,9 +491,9 @@ private: */ Stage( AnimationPlaylist& playlist, PropertyNotificationManager& propertyNotificationManager, - DynamicsNotifier& dynamicsNotifier, SceneGraph::UpdateManager& updateManager, - NotificationManager& notificationManager ); + NotificationManager& notificationManager, + Integration::RenderController& renderController ); /** * A reference counted object may only be deleted by calling Unreference() @@ -361,14 +507,15 @@ private: PropertyNotificationManager& mPropertyNotificationManager; - DynamicsNotifier& mDynamicsNotifier; - SceneGraph::UpdateManager& mUpdateManager; NotificationManager& mNotificationManager; - // The Actual size of the stage. + Integration::RenderController& mRenderController; + + // The stage-size may be less than surface-size (reduced by top-margin) Vector2 mSize; + Vector2 mSurfaceSize; // Cached for public GetBackgroundColor() Vector4 mBackgroundColor; @@ -380,28 +527,49 @@ private: IntrusivePtr mDefaultCamera; + ViewMode mViewMode; + float mStereoBase; + + uint32_t mTopMargin; Vector2 mDpi; // The object registry ObjectRegistryPtr mObjectRegistry; - // The Dynamics simulation world object - Integration::DynamicsFactory* mDynamicsFactory; // Not owned pointer to DynamicsFactory (PlatformAbstraction will clean up) - DynamicsWorldPtr mDynamicsWorld; - // The list of render-tasks IntrusivePtr mRenderTaskList; + Dali::RenderTask mRightRenderTask; + IntrusivePtr mRightCamera; + Dali::RenderTask mLeftRenderTask; + IntrusivePtr mLeftCamera; + Integration::SystemOverlay* mSystemOverlay; ///< SystemOverlay stage access // The key event signal - Dali::Stage::KeyEventSignalV2 mKeyEventSignalV2; + Dali::Stage::KeyEventSignalType mKeyEventSignal; + Dali::DevelStage::KeyEventGeneratedSignalType mKeyEventGeneratedSignal; // The event processing finished signal - Dali::Stage::EventProcessingFinishedSignalV2 mEventProcessingFinishedSignalV2; + Dali::Stage::EventProcessingFinishedSignalType mEventProcessingFinishedSignal; + + // The touched signals + Dali::Stage::TouchedSignalType mTouchedSignal; + Dali::Stage::TouchSignalType mTouchSignal; + + // The wheel event signal + Dali::Stage::WheelEventSignalType mWheelEventSignal; + + Dali::Stage::ContextStatusSignal mContextLostSignal; + Dali::Stage::ContextStatusSignal mContextRegainedSignal; + + Dali::Stage::SceneCreatedSignalType mSceneCreatedSignal; + + DevelStage::Rendering mRenderingBehavior; ///< The rendering behavior - // The touched signal - Dali::Stage::TouchedSignalV2 mTouchedSignalV2; + bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating + bool mForceNextUpdate:1; ///< True if the next rendering is really required. + bool mRenderToFbo:1; ///< Whether to render to a Frame Buffer Object. }; } // namespace Internal @@ -428,4 +596,4 @@ inline const Internal::Stage& GetImplementation(const Dali::Stage& stage) } // namespace Dali -#endif // __DALI_INTERNAL_STAGE_H__ +#endif // DALI_INTERNAL_STAGE_H