To support window rotation, render-manger had a orientation value.
It has effect to the viewport and scissor function in context.
If multiple windows works, this value is reset by the second window.
To fix, the scene should have the orientation value and use each scene/surface/window.
Change-Id: I06c5b55efe94222d56f87ce70e8f4488c09e8c87
// 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, mSurfaceOrientation, false );
// Create scene graph object
mSceneObject = new SceneGraph::Scene();
OwnerPointer< SceneGraph::Scene > transferOwnership( const_cast< SceneGraph::Scene* >( mSceneObject ) );
AddSceneMessage( updateManager, transferOwnership );
+
+ SurfaceResized( size.width, size.height, orientation, false );
}
void Scene::Add(Actor& actor)
ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager();
SetDefaultSurfaceRectMessage( updateManager, newSize );
- SetDefaultSurfaceOrientationMessage( updateManager, mSurfaceOrientation );
+ SetSurfaceOrientationMessage( tls->GetEventThreadServices(), *mSceneObject, mSurfaceOrientation );
// set default render-task viewport parameters
RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u );
programController( glAbstraction ),
depthBufferAvailable( depthBufferAvailableParam ),
stencilBufferAvailable( stencilBufferAvailableParam ),
- partialUpdateAvailable( partialUpdateAvailableParam ),
- defaultSurfaceOrientation( 0 )
+ partialUpdateAvailable( partialUpdateAvailableParam )
{
// Create thread pool with just one thread ( there may be a need to create more threads in the future ).
threadPool = std::unique_ptr<Dali::ThreadPool>( new Dali::ThreadPool() );
std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
Vector<GLuint> boundTextures; ///< The textures bound for rendering
Vector<GLuint> textureDependencyList; ///< The dependency list of binded textures
- int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
};
RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
mImpl->defaultSurfaceRect = rect;
}
-void RenderManager::SetDefaultSurfaceOrientation( int orientation )
-{
- mImpl->defaultSurfaceOrientation = orientation;
-}
-
void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
{
// Initialize the renderer as we are now in render thread
return;
}
- // @TODO We need to do partial rendering rotation.
- if( mImpl->defaultSurfaceOrientation != 0 )
- {
- return;
- }
-
class DamagedRectsCleaner
{
public:
DamagedRectsCleaner damagedRectCleaner(damagedRects);
-
Internal::Scene& sceneInternal = GetImplementation(scene);
SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
- int surfaceOrientation = mImpl->defaultSurfaceOrientation;
+ int surfaceOrientation = sceneObject->GetSurfaceOrientation();
if ( instruction.mFrameBuffer )
{
void SetDefaultSurfaceRect( const Rect<int>& rect );
/**
- * Returns the orintation for the default surface (probably the application window).
- * @return Orientation for the surface.
- */
- void SetDefaultSurfaceOrientation( int orientation );
-
- /**
* Add a Renderer to the render manager.
* @param[in] renderer The renderer to add.
* @post renderer is owned by RenderManager
Scene::Scene()
: mContext( nullptr ),
mFrameRenderedCallbacks(),
- mFramePresentedCallbacks()
+ mFramePresentedCallbacks(),
+ mSurfaceOrientation( 0 )
{
}
mFramePresentedCallbacks.clear();
}
+void Scene::SetSurfaceOrientation( int orientation )
+{
+ mSurfaceOrientation = orientation;
+}
+
+int Scene::GetSurfaceOrientation() const
+{
+ return mSurfaceOrientation;
+}
+
} //SceneGraph
} //Internal
*/
void GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+ /**
+ * Set the surface orientation when surface is rotated.
+ *
+ * @param[in] scene The rotated scene.
+ * @param[in] orientation The orientation value representing the surface.
+ */
+ void SetSurfaceOrientation( int orientation );
+
+ /**
+ * Get the surface orientation.
+ *
+ * @param[in] scene The rotated scene.
+ * @return the current surface orientation
+ */
+ int GetSurfaceOrientation() const;
+
private:
Context* mContext; ///< The context holding the GL state of rendering for the scene, not owned
Dali::Integration::Scene::FrameCallbackContainer mFrameRenderedCallbacks; ///< Frame rendered callbacks
Dali::Integration::Scene::FrameCallbackContainer mFramePresentedCallbacks; ///< Frame presented callbacks
+
+ int mSurfaceOrientation;
};
/// Messages
new (slot) LocalType( &scene, &Scene::AddFramePresentedCallback, const_cast< CallbackBase* >( callback ), frameId );
}
+inline void SetSurfaceOrientationMessage( EventThreadServices& eventThreadServices, const Scene& scene, int orientation )
+{
+ using LocalType = MessageValue1<Scene, int>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &scene, &Scene::SetSurfaceOrientation, orientation );
+}
+
} // namespace SceneGraph
} // namespace Internal
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SurfaceReplaced, scene );
}
-void UpdateManager::SetDefaultSurfaceOrientation( int orientation )
-{
- typedef MessageValue1< RenderManager, int > DerivedType;
-
- // Reserve some memory inside the render queue
- unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetDefaultSurfaceOrientation, orientation );
-}
-
void UpdateManager::KeepRendering( float durationSeconds )
{
mImpl->keepRenderingSeconds = std::max( mImpl->keepRenderingSeconds, durationSeconds );
void SetDefaultSurfaceRect( const Rect<int>& rect );
/**
- * Set the default surface orientation.
- * @param[in] orientation The orientation value representing the surface.
- */
- void SetDefaultSurfaceOrientation( int orientation );
-
- /**
* @copydoc Dali::Stage::KeepRendering()
*/
void KeepRendering( float durationSeconds );
new (slot) LocalType( &manager, &UpdateManager::SurfaceReplaced, &scene );
}
-inline void SetDefaultSurfaceOrientationMessage( UpdateManager& manager, int orientation )
-{
- typedef MessageValue1< UpdateManager, int > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation );
-}
-
inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
{
using LocalType = MessageValue1<UpdateManager, float>;