X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fscene-impl.cpp;h=a157ae7df545e3843f29ade28ecc8f036256b449;hb=d2bc18872d7b4f316b86a0897e6c9fabf67a1241;hp=a944d35e6e86ee5a72bc5156b05e0c4bdd770154;hpb=a0864aec36eb5ddb147a1a7aa0cb863424f005a6;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/scene-impl.cpp b/dali/internal/event/common/scene-impl.cpp index a944d35..a157ae7 100644 --- a/dali/internal/event/common/scene-impl.cpp +++ b/dali/internal/event/common/scene-impl.cpp @@ -64,6 +64,7 @@ Scene::Scene( const Size& size ) mSurfaceSize( Vector2::ZERO ), mDpi( Vector2::ZERO ), mBackgroundColor( DEFAULT_BACKGROUND_COLOR ), + mSurfaceOrientation( 0 ), mDepthTreeDirty( false ), mEventProcessor( *this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor() ) { @@ -90,6 +91,11 @@ Scene::~Scene() mRenderTaskList.Reset(); } + if ( mFrameBuffer ) + { + mFrameBuffer.Reset(); + } + // Discard this Scene from the Core Discard(); } @@ -191,7 +197,7 @@ Actor& Scene::GetDefaultRootActor() return *mRootLayer; } -void Scene::SetSurface( Integration::RenderSurface& surface ) +void Scene::SetSurface( Integration::RenderSurface& surface, bool forceUpdate ) { mSurface = &surface; if ( mSurface ) @@ -201,18 +207,22 @@ void Scene::SetSurface( Integration::RenderSurface& surface ) mFrameBuffer = Dali::Internal::FrameBuffer::New( surface, Dali::FrameBuffer::Attachment::NONE ); defaultRenderTask->SetFrameBuffer( mFrameBuffer ); - SurfaceResized(); + SurfaceResized( forceUpdate ); } } -void Scene::SurfaceResized() +void Scene::SurfaceResized( bool forceUpdate ) { if( mSurface ) { const float fWidth = static_cast( mSurface->GetPositionSize().width ); const float fHeight = static_cast( mSurface->GetPositionSize().height ); + const int orientation = mSurface->GetOrientation(); - if( ( fabsf( mSurfaceSize.width - fWidth ) > Math::MACHINE_EPSILON_1 ) || ( fabsf( mSurfaceSize.height - fHeight ) > Math::MACHINE_EPSILON_1 ) ) + if( ( fabsf( mSurfaceSize.width - fWidth ) > Math::MACHINE_EPSILON_1 ) + || ( fabsf( mSurfaceSize.height - fHeight ) > Math::MACHINE_EPSILON_1 ) + || ( orientation != mSurfaceOrientation ) + || (forceUpdate) ) { Rect newSize( 0, 0, static_cast( mSurface->GetPositionSize().width ), static_cast( mSurface->GetPositionSize().height ) ); @@ -222,14 +232,18 @@ void Scene::SurfaceResized() mSize.width = mSurfaceSize.width; mSize.height = mSurfaceSize.height; + mSurfaceOrientation = orientation; + // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. mDefaultCamera->SetPerspectiveProjection( mSurfaceSize ); + mDefaultCamera->RotateProjection( mSurfaceOrientation ); mRootLayer->SetSize( mSize.width, mSize.height ); ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); SetDefaultSurfaceRectMessage( updateManager, newSize ); // truncated + SetDefaultSurfaceOrientationMessage( updateManager, mSurfaceOrientation ); RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); @@ -247,6 +261,15 @@ void Scene::SurfaceResized() } } +void Scene::SurfaceDeleted() +{ + if ( mFrameBuffer ) + { + // The frame buffer doesn't have a valid render surface any more. + mFrameBuffer->MarkSurfaceAsInvalid(); + } +} + Integration::RenderSurface* Scene::GetSurface() const { return mSurface; @@ -304,23 +327,48 @@ Vector4 Scene::GetBackgroundColor() const void Scene::EmitKeyEventSignal(const KeyEvent& event) { - mKeyEventSignal.Emit( event ); + if ( !mKeyEventSignal.Empty() ) + { + Dali::Integration::Scene handle( this ); + mKeyEventSignal.Emit( event ); + } +} + +bool Scene::EmitKeyEventGeneratedSignal(const KeyEvent& event) +{ + // Emit the KeyEventGenerated signal when KeyEvent is generated + return mKeyEventGeneratedSignal.Emit( event ); } void Scene::EmitEventProcessingFinishedSignal() { - mEventProcessingFinishedSignal.Emit(); + if ( !mEventProcessingFinishedSignal.Empty() ) + { + Dali::Integration::Scene handle( this ); + mEventProcessingFinishedSignal.Emit(); + } } void Scene::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch ) { - mTouchedSignal.Emit( touchEvent ); - mTouchSignal.Emit( touch ); + Dali::Integration::Scene handle( this ); + if ( !mTouchedSignal.Empty() ) + { + mTouchedSignal.Emit( touchEvent ); + } + if ( !mTouchSignal.Empty() ) + { + mTouchSignal.Emit( touch ); + } } void Scene::EmitWheelEventSignal(const WheelEvent& event) { - mWheelEventSignal.Emit( event ); + if ( !mWheelEventSignal.Empty() ) + { + Dali::Integration::Scene handle( this ); + mWheelEventSignal.Emit( event ); + } } Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal() @@ -328,6 +376,11 @@ Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal() return mKeyEventSignal; } +Integration::Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal() +{ + return mKeyEventGeneratedSignal; +} + Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal() { return mEventProcessingFinishedSignal;