X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fscene-impl.cpp;h=208c1f7805e6e7a59d436a50be4840a11fc5ab78;hb=8f612650d20752ab6aba022a9dbefdb883968e8f;hp=acb362d92b1bd3cfd16417c7e890a472940d733b;hpb=93faafb980ccea822d80f7c14e891f07869c3497;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 old mode 100644 new mode 100755 index acb362d..208c1f7 --- a/dali/internal/event/common/scene-impl.cpp +++ b/dali/internal/event/common/scene-impl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -42,19 +43,22 @@ namespace Dali namespace Internal { -namespace +ScenePtr Scene::New( Size size ) { + ScenePtr scene = new Scene; -const Vector4 DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f); // Default background color + // Second-phase construction + scene->Initialize( size, 0 ); -} //Unnamed namespace + return scene; +} -ScenePtr Scene::New( Size size ) +ScenePtr Scene::New( Size size, int orientation ) { ScenePtr scene = new Scene; // Second-phase construction - scene->Initialize( size ); + scene->Initialize( size, orientation ); return scene; } @@ -64,6 +68,7 @@ Scene::Scene() mSize(), // Don't set the proper value here, this will be set when the surface is set later mDpi(), mBackgroundColor( DEFAULT_BACKGROUND_COLOR ), + mSurfaceOrientation( 0 ), mDepthTreeDirty( false ), mEventProcessor( *this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor() ) { @@ -100,7 +105,7 @@ Scene::~Scene() // When this destructor is called, the scene has either already been removed from Core or Core has already been destroyed } -void Scene::Initialize( Size size ) +void Scene::Initialize( Size size, int orientation ) { ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); @@ -136,8 +141,9 @@ void Scene::Initialize( Size size ) // Create the default render-task and ensure clear is enabled on it to show the background color RenderTaskPtr renderTask = mRenderTaskList->CreateTask( mRootLayer.Get(), mDefaultCamera.Get() ); renderTask->SetClearEnabled(true); + mSurfaceOrientation = orientation; - SurfaceResized( size.width, size.height ); + SurfaceResized( size.width, size.height, mSurfaceOrientation, false ); // Create scene graph object mSceneObject = new SceneGraph::Scene(); @@ -205,23 +211,27 @@ Actor& Scene::GetDefaultRootActor() return *mRootLayer; } -void Scene::SurfaceResized( float width, float height ) +void Scene::SurfaceResized( float width, float height, int orientation, bool forceUpdate ) { - if( ( fabsf( mSize.width - width ) > Math::MACHINE_EPSILON_1 ) || ( fabsf( mSize.height - height ) > Math::MACHINE_EPSILON_1 ) ) + if( ( fabsf( mSize.width - width ) > Math::MACHINE_EPSILON_1 ) || ( fabsf( mSize.height - height ) > Math::MACHINE_EPSILON_1 ) + || ( orientation != mSurfaceOrientation ) || ( forceUpdate ) ) { Rect< int32_t > newSize( 0, 0, static_cast< int32_t >( width ), static_cast< int32_t >( height ) ); // truncated mSize.width = width; mSize.height = height; + mSurfaceOrientation = orientation; // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. mDefaultCamera->SetPerspectiveProjection( mSize ); + mDefaultCamera->RotateProjection( mSurfaceOrientation ); mRootLayer->SetSize( mSize.width, mSize.height ); ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); SetDefaultSurfaceRectMessage( updateManager, newSize ); + SetDefaultSurfaceOrientationMessage( updateManager, mSurfaceOrientation ); // set default render-task viewport parameters RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); @@ -291,7 +301,7 @@ SceneGraph::Scene* Scene::GetSceneObject() const return mSceneObject; } -void Scene::EmitKeyEventSignal(const KeyEvent& event) +void Scene::EmitKeyEventSignal(const Dali::KeyEvent& event) { if ( !mKeyEventSignal.Empty() ) { @@ -300,9 +310,10 @@ void Scene::EmitKeyEventSignal(const KeyEvent& event) } } -bool Scene::EmitKeyEventGeneratedSignal(const KeyEvent& event) +bool Scene::EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event) { // Emit the KeyEventGenerated signal when KeyEvent is generated + Dali::Integration::Scene handle( this ); return mKeyEventGeneratedSignal.Emit( event ); } @@ -315,20 +326,16 @@ void Scene::EmitEventProcessingFinishedSignal() } } -void Scene::EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch ) +void Scene::EmitTouchedSignal( const Dali::TouchEvent& touch ) { Dali::Integration::Scene handle( this ); if ( !mTouchedSignal.Empty() ) { - mTouchedSignal.Emit( touchEvent ); - } - if ( !mTouchSignal.Empty() ) - { - mTouchSignal.Emit( touch ); + mTouchedSignal.Emit( touch ); } } -void Scene::EmitWheelEventSignal(const WheelEvent& event) +void Scene::EmitWheelEventSignal(const Dali::WheelEvent& event) { if ( !mWheelEventSignal.Empty() ) { @@ -374,19 +381,19 @@ Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFin return mEventProcessingFinishedSignal; } -Scene::TouchedSignalType& Scene::TouchedSignal() +Integration::Scene::TouchEventSignalType& Scene::TouchedSignal() { return mTouchedSignal; } -Integration::Scene::TouchSignalType& Scene::TouchSignal() +Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal() { - return mTouchSignal; + return mWheelEventSignal; } -Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal() +std::vector& Scene::GetItemsDirtyRects() { - return mWheelEventSignal; + return mItemsDirtyRects; } } // Internal