X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fscene-impl.cpp;h=4ab51424900feab9f37161ea5b5491c42c727444;hb=refs%2Fchanges%2F21%2F244821%2F11;hp=4b4456691fc3ec3e691275bb5c82dcec7554afa4;hpb=e5f24bbdefd82ab32d7530dc44ffc321e5b42d17;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 4b44566..4ab5142 --- 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,30 +43,24 @@ namespace Dali namespace Internal { -namespace -{ - -const Vector4 DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f); // Default background color - -} //Unnamed namespace - -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; } Scene::Scene() -: mSceneObject( nullptr ), +: mSceneObject(nullptr), mSize(), // Don't set the proper value here, this will be set when the surface is set later mDpi(), - mBackgroundColor( DEFAULT_BACKGROUND_COLOR ), - mDepthTreeDirty( false ), - mEventProcessor( *this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor() ) + mBackgroundColor(DEFAULT_BACKGROUND_COLOR), + mDepthTreeDirty(false), + mEventProcessor(*this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor()), + mSurfaceOrientation(0) { } @@ -100,7 +95,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 +131,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 ); + SurfaceRotated( size.width, size.height, mSurfaceOrientation ); // Create scene graph object mSceneObject = new SceneGraph::Scene(); @@ -205,27 +201,11 @@ Actor& Scene::GetDefaultRootActor() return *mRootLayer; } -void Scene::SurfaceResized( float width, float height ) +void Scene::SurfaceResized(float width, float height) { - 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)) { - Rect< int32_t > newSize( 0, 0, static_cast< int32_t >( width ), static_cast< int32_t >( height ) ); // truncated - - mSize.width = width; - mSize.height = height; - - // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. - mDefaultCamera->SetPerspectiveProjection( mSize ); - - mRootLayer->SetSize( mSize.width, mSize.height ); - - ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); - SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); - SetDefaultSurfaceRectMessage( updateManager, newSize ); - - // set default render-task viewport parameters - RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); - defaultRenderTask->SetViewport( newSize ); + ChangedSurface(width, height, mSurfaceOrientation); } } @@ -300,6 +280,43 @@ void Scene::EmitKeyEventSignal(const Dali::KeyEvent& event) } } +void Scene::SurfaceRotated(float width, float height, int orientation) +{ + mSurfaceOrientation = orientation; + ChangedSurface(width, height, orientation); +} + +int Scene::GetSurfaceOrientation() +{ + return mSurfaceOrientation; +} + +void Scene::ChangedSurface(float width, float height, int orientation) +{ + Rect newSize(0, 0, static_cast(width), static_cast(height)); // truncated + + mSize.width = width; + mSize.height = height; + + // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. + mDefaultCamera->SetPerspectiveProjection(mSize); + // Set the surface orientation to Default camera for window/screen rotation + mDefaultCamera->RotateProjection(orientation); + + mRootLayer->SetSize(width, height); + + ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); + SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); + SetDefaultSurfaceRectMessage(updateManager, newSize); + + // Send the surface orientation to render manager for calculating glViewport/Scissor + SetDefaultSurfaceOrientationMessage(updateManager, orientation); + + // set default render-task viewport parameters + RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask(0u); + defaultRenderTask->SetViewport(newSize); +} + bool Scene::EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event) { // Emit the KeyEventGenerated signal when KeyEvent is generated @@ -319,9 +336,9 @@ void Scene::EmitEventProcessingFinishedSignal() void Scene::EmitTouchedSignal( const Dali::TouchEvent& touch ) { Dali::Integration::Scene handle( this ); - if ( !mTouchSignal.Empty() ) + if ( !mTouchedSignal.Empty() ) { - mTouchSignal.Emit( touch ); + mTouchedSignal.Emit( touch ); } } @@ -371,9 +388,9 @@ Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFin return mEventProcessingFinishedSignal; } -Integration::Scene::TouchSignalType& Scene::TouchSignal() +Integration::Scene::TouchEventSignalType& Scene::TouchedSignal() { - return mTouchSignal; + return mTouchedSignal; } Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal() @@ -381,6 +398,11 @@ Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal() return mWheelEventSignal; } +std::vector& Scene::GetItemsDirtyRects() +{ + return mItemsDirtyRects; +} + } // Internal } // Dali